0% found this document useful (0 votes)
27 views4 pages

Fedora 41 CUDA and CUDNN Setup

Uploaded by

khan.ytube24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Fedora 41 CUDA and CUDNN Setup

Uploaded by

khan.ytube24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

### Update the system

``` bash
sudo dnf update -y
```

### Install RPM Fusion repositories for additional software packages

``` bash
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$
(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-
nonfree-release-$(rpm -E %fedora).noarch.rpm
```

### Enable the Cisco OpenH264 repository for multimedia support

``` bash
sudo dnf config-manager setopt fedora-cisco-openh264.enabled=1
```

### Update the system again after adding new repositories

``` bash
sudo dnf update -y
```

### Install NVIDIA drivers

``` bash
sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda
```

### Replace the free version of FFmpeg with the full version

``` bash
sudo dnf swap ffmpeg-free ffmpeg --allowerasing
```

### Update multimedia packages with specific options

``` bash
sudo dnf update @multimedia --setopt="install_weak_deps=False" --
exclude=PackageKit-gstreamer-plugin
```

### Install NVIDIA VAAPI drivers for hardware acceleration

``` bash
sudo dnf install libva-nvidia-driver.{i686,x86_64}
```

------------------------------------------------------------------------

## Setting up GCC and G++

### Install GCC 13 and G++ 13

``` bash
sudo dnf install gcc-13
sudo dnf install g++-13
```

### Backup the current GCC binary and set GCC 13 as the default

``` bash
sudo mv /usr/bin/gcc /usr/bin/gcc.bak
sudo ln -s /etc/alternatives/gcc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 50
sudo update-alternatives --set gcc /usr/bin/gcc-13
```

### Backup the current G++ binary and set G++ 13 as the default

``` bash
sudo mv /usr/bin/g++ /usr/bin/g++.bak
sudo ln -s /etc/alternatives/g++ /usr/bin/g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 50
sudo update-alternatives --set g++ /usr/bin/g++-13
```

### Verify the GCC and G++ versions

``` bash
gcc --version
g++ --version
```

### Revert to the previous GCC and G++ versions if needed

``` bash
sudo rm /usr/bin/gcc
sudo mv /usr/bin/gcc.bak /usr/bin/gcc
sudo rm /usr/bin/g++
sudo mv /usr/bin/g++.bak /usr/bin/g++
```

------------------------------------------------------------------------

## CUDA Installation

### Install development tools required for building software

``` bash
sudo dnf5 group install "development-tools" -y
```

### Install additional tools required for building kernel modules

``` bash
sudo dnf install -y make kernel-devel dkms
```

### Download and install the CUDA 12.5.1 installer

``` bash
wget https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/
cuda_12.5.1_555.42.06_linux.run
sudo sh cuda_12.5.1_555.42.06_linux.run
```

### Update environment variables for CUDA

``` bash
export PATH=/usr/local/cuda-12.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH
```

### Apply changes to the shell environment

For Zsh users:

``` bash
source ~/.zshrc
```

For Bash users:

``` bash
source ~/.bashrc
```

### Verify CUDA installation

``` bash
nvcc --version
```

------------------------------------------------------------------------

## CUDNN Installation

### Download CUDNN archive for CUDA 12

``` bash
wget https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-
x86_64/cudnn-linux-x86_64-9.3.0.75_cuda12-archive.tar.xz
```

### Extract the CUDNN archive

``` bash
tar -xvf cudnn-linux-x86_64-9.3.0.75_cuda12-archive.tar.xz
```

### Copy CUDNN files to the CUDA directory

``` bash
sudo cp cudnn-*-archive/include/* /usr/local/cuda-12.5/include/
sudo cp cudnn-*-archive/lib/* /usr/local/cuda-12.5/lib64/
```

### Set proper permissions for the CUDNN files

``` bash
sudo chmod a+r /usr/local/cuda-12.5/include/cudnn*.h
/usr/local/cuda-12.5/lib64/libcudnn*
```

### Verify the CUDNN installation

``` bash
cat /usr/local/cuda-12.5/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
```

You might also like