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:
insert image description here
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
insert image description here
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

insert image description here
Enter the following command to update bash

source ~/.bashrc

Detect cuda installation

nvcc -V

insert image description here
The effect is remarkable! ! !

install cudnn

Here it is assumed that the cudnn deb file has been downloaded.
insert image description here
According to the official website installation file guide: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
insert image description here
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库文件

insert image description here
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.
insert image description here
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

Elegant finish! ! ! !

Guess you like

Origin blog.csdn.net/qq_19449259/article/details/129925442