deep learning
Article directory
1. Install CUDA
cuda is the programming language platform of NIVEA. If you want to use GPU, you must use cuda. Download the installation file of cuda from here.
First select the appropriate version, and download the latest cuda 11.4 here.
Install according to the instructions above.
Because the NVIDIA driver is already installed, do not choose to install the NVIDIA driver here. The rest are default. As shown in the figure below, the first one is not selected.
After the installation is successful, you need to configure the environment variables. Otherwise, when using GPU acceleration, the GPU
configuration environment variables cannot be found:
gedit ~/.bashrc
Add the following statement at the end of the opened file and save:
export PATH=/usr/local/cuda-11.4/bin${
PATH:+:${
PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${
LD_LIBRARY_PATH:+:${
LD_LIBRARY_PATH}}
Then update the environment variable
source ~/.bashrc
Enter nvcc -V to view related information
2. Install cudnn
Go to the official website to download the cudnn version matched with CUDA 11.4. To download cudnn, you need to register a NIVDIA account . Officials have given suggestions for matching cuda with cudnn. The sample download is cuDNN v8.8.2.
Select cuDNN Library for Linux as shown below, download cudnn-11.4-linux-x64-v8.2. 2.26.tgz and
decompress
tar -xvf cudnn-11.4-linux-x64-v8.2.2.26.tgz
Copy the relevant library files
sudo cp include/cudnn* /usr/local/cuda/include/
sudo cp lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
View cudnn version
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
This is the configuration is successful
monitor gpu status
watch -n 1 nvidia-smi