After installing the CUDA Driver and CUDA, you also need to install CUDNN, NVIDIA's library for deep learning GPU acceleration.
1. Download CUDNN
VisitOfficial website link and select the CUDNN version based on the CUDA version and Ubuntu version. The previous one used CUDA 10.1, and the system version is Ubuntu 20.04, CUDA 11.04, so here we choose the corresponding CUDNN v8.2.4.
Notice that there are many different formats of CUDA here, install them accordingly The methods are also different. Below we introduce them respectively.
2. CUDNN installation (tgz format)
Select cuDNN Library for Linux (x86) to download
Open the terminal and unzip the file:
tar -xzvf cudnn-10.1-linux-x64-v7.6.5.32.tgz
Copy the decompressed file to the specified directory and grant permissions:
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
3. CUDNN installation (deb format)
Select the following three files to download
cuDNN Runtime Library for Ubuntu 16.04 (Deb)
cuDNN Developer Library for Ubuntu 16.04 (Deb)
cuDNN Code Samples and User Guide for Ubuntu 16.04 (Deb)
Open the terminal and find the location of the downloaded deb file, and then follow the steps to install the three files.
sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb
4. Check whether the installation is successful
Open terminal input
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
If the following message appears, the installation is successful: