NVIDIA cuDNN Logo

This is guide, howto install NVIDIA cuDNN 9.6.0 on Fedora 41/40/39. I assume here that you have installed NVIDIA drivers successfully using my Fedora NVIDIA Drivers Install Guide and installed NVIDIA CUDA successfully using Fedora NVIDIA CUDA Install Guide. You will need NVIDIA 565.xx or 560.xx drivers. As always remember backup important files before doing anything!

Check video version of guide, howto install NVIDIA cuDNN on Fedora 41/40/39:

Support inttf:

Buy Me a Coffee:

1. Install NVIDIA cuDNN 9.6.0 on Fedora 41/40/39

1.1 Build and Install GCC 13.3

Note: This step is only for Fedora 41/40 users.

Check guide howto build and install GCC 13 on Fedora 41/40.

1.2 Install NVIDIA Drivers >= 560.xx

Check guide howto install NVIDIA Drivers 565.xx and 560.xx on Fedora 41/40/39.

1.3 Install NVIDIA CUDA Toolkit 12.6.3

Check guide howto install NVIDIA CUDA Toolkit 12.6.3 on Fedora 41/40/39.

1.4 Download NVIDIA cuDNN 9.6.0

Download NVIDIA cuDNN 9.6.0 from official NVIDIA cuDNN download page.

I use here ~/cudnn directory, you this works under ~/Downloads or any other directory too.

cd ~

mkdir cudnn

cd cudnn

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

1.5 Extract NVIDIA cuDNN package

tar xvf cudnn-linux-x86_64-9.6.0.74_cuda12-archive.tar.xz

1.6 Change root user

su -
## OR ##
sudo -i

1.7 Install needed dependencies

dnf install zlib

1.8 Copy NVIDIA cuDNN files to correct places

Copy cuDDN files to correct places to /usr/local/cuda/lib64 and /urs/local/cuda/include and add read permission.

Fedora 41/40/39

cp /home/<user>/cudnn/cudnn-linux-x86_64-9.6.0.74_cuda12-archive/include/cudnn*.h /usr/local/cuda/include 

cp -P /home/<user>/cudnn/cudnn-linux-x86_64-9.6.0.74_cuda12-archive/lib/libcudnn* /usr/local/cuda/lib64 

chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*

1.9 Download cuDNN Samples

Run this as normal user.

cd ~/cudnn

wget https://developer.download.nvidia.com/compute/cudnn/redist/cudnn_samples/source/cudnn_samples-source-9.6.0.74-archive.tar.xz

1.10 Extract cuDNN Samples

tar xvf cudnn_samples-source-9.6.0.74-archive.tar.xz

1.11 Download and Build FreeImage

This is workaround to following error on Fedora 41/40 when building mnistCUDNN:

cudnn_samples-source-9.6.0.74-archive/src/cudnn_samples_v9/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
CUDA_VERSION is 12060
Linking agains cublasLt = true
CUDA VERSION: 12060
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 50 53 60 61 62 70 72 75 80 86 87 90
test.c:1:10: fatal error: FreeImage.h: No such file or directory
    1 | #include "FreeImage.h"
      |          ^~~~~~~~~~~~~
compilation terminated.
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
[@] /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -ccbin gcc-13.3 -lstdc++ -lm -m64 -std=c++11 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o fp16_dev.o -c fp16_dev.cu
[@] gcc-13.3 -lstdc++ -lm -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -std=c++11 -o fp16_emu.o -c fp16_emu.cpp
[@] gcc-13.3 -lstdc++ -lm -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -std=c++11 -o mnistCUDNN.o -c mnistCUDNN.cpp
[@] /usr/local/cuda/bin/nvcc -ccbin gcc-13.3 -lstdc++ -lm -m64 -std=c++11 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm

1.11.1 Download FreeImage

wget -O FreeImage3180.zip "https://sourceforge.net/projects/freeimage/files/Source%20Distribution/3.18.0/FreeImage3180.zip/download"

1.11.2 Unzip FreeImage

unzip FreeImage3180.zip

1.11.3 Download FreeImage patch

wget https://www.if-not-true-then-false.com/files/freeimage-makefile-gnu.patch

1.11.3 Build FreeImage

cd FreeImage

patch -u Makefile.gnu -i ../freeimage-makefile-gnu.patch

export CC=gcc-13.3

make clean

make -j6

1.12 Copy FreeImage to mnistCUDNN

cd ../cudnn_samples-source-9.6.0.74-archive/src/cudnn_samples_v9/mnistCUDNN/

mkdir -p FreeImage/include 

mkdir -p FreeImage/lib/linux/x86_64

cp ~/cudnn/FreeImage/Dist/FreeImage.h FreeImage/include/
cp ~/cudnn/FreeImage/Dist/libfreeimage.a FreeImage/lib/linux/x86_64/

1.13 Build and Run mnistCUDNN

1.13.1 Build mnistCUDNN

make clean

make

1.13.2 Run mnistCUDNN

./mnistCUDNN
Executing: mnistCUDNN
cudnnGetVersion() : 90600 , CUDNN_VERSION from cudnn.h : 90600 (9.6.0)
Host compiler version : GCC 13.3.0

There are 1 CUDA capable devices on your machine :
device 0 : sms 30  Capabilities 7.5, SmClock 1695.0 Mhz, MemSize (Mb) 5733, MemClock 7001.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision
Loading binary file data/conv1.bin
Loading binary file data/conv1.bias.bin
Loading binary file data/conv2.bin
Loading binary file data/conv2.bias.bin
Loading binary file data/ip1.bin
Loading binary file data/ip1.bias.bin
Loading binary file data/ip2.bin
Loading binary file data/ip2.bias.bin
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
...
Testing cudnnFindConvolutionForwardAlgorithm ...
...
Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
...
Testing cudnnFindConvolutionForwardAlgorithm ...
...
Resulting weights from Softmax:
0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000 
Loading image data/three_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
...
Testing cudnnFindConvolutionForwardAlgorithm ...
...
Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
...
Testing cudnnFindConvolutionForwardAlgorithm ...
...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!

Testing half precision (math in single precision)
Loading binary file data/conv1.bin
...
...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000 
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006 

Result of classification: 1 3 5

Test passed!

1.14 Support inttf

Buy Me a Coffee:

Thats all!

Please let me know if you have any problems!