Installing cuDNN
As with CUDA installation, the versions must be compatible. If you installed CUDA 12.2 above, select the corresponding cuDNN version according to the NVIDIA documentation: cuDNN…
2 min read · English documentation1. Determine the cuDNN Version to Install
As with CUDA installation, the versions must be compatible. If you installed CUDA 12.2 above, select the corresponding cuDNN version according to the NVIDIA documentation: cuDNN Archive.

Version 8.9.3 is selected here. Several cuDNN versions support CUDA 12.x. Version 8.9.3 is selected because its release date is closest to the CUDA 12.2 GA release date. A common practice in development is to choose a working but slightly older software version, which is generally more stable and less likely to have compatibility problems. You may select a different version if you have specific requirements.

Click the link. A page similar to the following will appear.

Select the corresponding version and click it to begin the download automatically, as shown below.

2. Install cuDNN
Open a terminal in the download directory and enter the following extraction command:
tar -zxvf cudnn-linux-x86_64-8.9.3.28_cuda11-archive.tar.xz
Copy the core files to the specified locations:
sudo cp cudnn-linux-x86_64-8.9.3.28_cuda11-archive/include/cudnn* /usr/local/cuda/include/
sudo cp cudnn-linux-x86_64-8.9.3.28_cuda11-archive/lib/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn* /usr/local/cuda/lib64/libcudnn*
Also create the CUDA symbolic links here:
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.9.3 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
cuDNN is now installed.
3. Verify cuDNN
Open a new terminal and enter the following command:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
Under normal conditions, output similar to the following will appear, showing cuDNN version 8.9.3.

4. About cuDNN

The NVIDIA CUDA® Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. cuDNN provides highly tuned implementations of standard routines such as forward and backward convolution, attention, matrix multiplication, pooling, and normalization.
Its main functions include:
1. Accelerating deep-learning computations: Provides efficient convolution, pooling, normalization, and other operations to accelerate neural-network training and inference. 2. Performance optimization: Optimizes operations for different GPU architectures to improve computational efficiency. 3. Support for multiple frameworks: Compatible with mainstream deep-learning frameworks such as TensorFlow, PyTorch, and Caffe. 4. Simplified development: Provides easy-to-use APIs, reducing the work required for developers to implement complex algorithms.
Using cuDNN significantly increases the training speed and performance of deep-learning models, making it an important component of the deep-learning workflow.
To learn about the relationship between CUDA and cuDNN, read What Exactly Is the Relationship Between CUDA and cuDNN?.
