These are the steps I took for the installation of the NVIDIA drivers and CUDA toolkit for use with TensorFlow on Fedora 35. I have documented them since I had a lot of difficulty getting it to work and couldn't boot to a graphical desktop a few times. These steps worked for me, hopefully they do for others.
I am running on a 64 bit system and used KDE Plasma with X11 so these instructions may differ for people using GNOME, Wayland and any other combinations.
- If you have installed any NVIDIA drivers other than the
akmod-nvidia
drivers from the@rpmfusion-nonfree
repo, remove them completely. - Remove any other NVIDIA/CUDA installations. Find them with
sudo dnf list installed | egrep '(nvidia|cuda)'
- If the
nvidia-driver
module is enabled, disable it -sudo dnf module disable nvidia-driver
- this caused me issues when trying to install the akmod drivers
It's available in the @rpmfusion-nonfree repo. Current docs on the Fedora Docs - Setup RPMFusion
sudo dnf install akmod-nvidia
I didn't need to do all the steps in the NVIDIA docs so I'm just documenting what I did. Please read through them in case you might need to do additional steps
- Follow the Pre-Install Actions on the NVIDIA docs for Fedora. This will ensure you have the correct kernel-headers and kernel-devel packages.
From the Package Manager Installation on the NVIDIA docs for Fedora.
- Add the CUDA repo -
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/${FEDORA_RELEASE}/x86_64/cuda-${FEDORA_RELEASE}.repo
-FEDORA_RELEASE
for me wasfedora35
- Install CUDA -
sudo dnf install cuda
The cuDNN libraries do not exist in the CUDA repo (at the time of writing - for fedora35 at least). It does exist for rhel. I downloaded them as a tar and then installed manually.
- Download the tar cuDNN - you'll need to sign up unfortunately and fill out a small survey. I got the Linux x86_64
- Follow the Tar File Installation on the NVIDIA docs. Steps copied below in-case link becomes broken.
tar -xvf cudnn-linux-x86_64-8.x.x.x_cudaX.Y-archive.tar.xz
# Copy the following files into the CUDA toolkit directory.
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
Add the following to your shell profile. I use zsh so it went in the ~/.zshrc
CUDA_HOME=/usr/local/cuda-11.6/bin
export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64
export PATH=$PATH:$CUDA_HOME
- akmod-nvidia - https://rpmfusion.org/Howto/NVIDIA
- NVIDIA CUDA Docs - https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
- NVIDIA cuDNN Docs - https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html