CUDA and cudnn installation under ubuntu
download library
Determine the cuda version you need and the corresponding cudnn version.
CUDA download link:
https://developer.nvidia.com/cuda-toolkit-archive
cudnn download link:
https://developer.nvidia.cn/rdp/cudnn-download
* Among them, cudnn needs to register a developer account to download
Install CUDA
This article takes the installation of cuda11.7 as an example:
open the corresponding website, select the version you want, and input it according to the instructions in the window. It is recommended to install deb (local) and
finally add the path corresponding to cuda in your own bash
gedit ~/.bashrc
Add the following command
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
Enter the following command to update bash
source ~/.bashrc
Detect cuda installation
nvcc -V
The effect is remarkable! ! !
install cudnn
Here it is assumed that the cudnn deb file has been downloaded.
According to the official website installation file guide: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
to complete the installation, the author will follow the instructions on this machine cudnn library demo installation
sudo dpkg -i cudnn-local-repo-ubuntu2004-8.5.0.96_1.0-1_amd64.deb
#后者需要修改为自己下载的cudnn库文件
Copy this command and run
sudo cp /var/cudnn-local-repo-ubuntu2004-8.5.0.96/cudnn-local-0579404E-keyring.gpg /usr/share/keyrings/
Update the source, that is, add the content of this deb to apt
sudo apt-get update
At this point, we can find the corresponding libraries in apt.
At this time, we don’t need to follow the sentences in the official tutorial to input word by word, just install these directly;
sudo apt-get install libcudnn8 libcudnn8-dev libcudnn8-samples