Ubuntu system NVIDIA graphics driver + cuda10.2 + cudnn8.0.5 installation

ubuntu18.04 system

Set up the ubuntu environment
graphics card driver + cuda10.2 + cudnn8.0.5
(requires internet connection)
and update the local software:

sudo apt-get update

View system recommended drivers:

ubuntu-drivers devices


The suffix recommended is the recommended driver.
Terminal input:

sudo apt-get install nvidia-driver-xxx


The corresponding driver can be installed.
Restart the computer and enter in the terminal:

nvidia-smi


Check whether the installation is successful.

cuda download address, select the corresponding version
cuda download address
. Taking 10.2 as an example, enter:

wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run


On the pop-up interface, select continue
and enter accept
to cancel the driver option (the installation has been completed before, no need to repeat the installation)
and wait for the installation to be completed.

After completing the installation, you need to configure environment variables.
Open the environment variable file:

gedit ~/.bashrc


At the bottom of the code add:

export PATH="/usr/local/cuda-10.2/bin:$PATH" 
export LD_LIBRARY_PATH="/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH" 


Save, close, and exit.
Update environment variables in the terminal:

source ~/.bashrc


Terminal input

nvcc -V


Verify that the installation is successful.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89


Showing this is a success.

Install cudnn
official website: Official website
Select the required version and select cuDNN Library for Linux [x86] to download. You need to log in. If you do not have an account, register one.
Unzip the downloaded installation package, enter the cuda folder, and enter the terminal on this page.
Enter the following code to copy the file to the corresponding folder:

sudo cp cuda/include/* /usr/local/cuda/include
sudo cp include/* /usr/local/cuda/include/
sudo chmod a+r /usr/local/cuda/lib64/*
sudo chmod a+r /usr/local/cuda/include/*


In order to prevent errors, the entire header file is copied using code.
After completion, you can enter the command:

cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2


Check whether the installation is complete.
Installation success interface:
 

#define CUDNN_MAJOR 8
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 5
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

#endif /* CUDNN_VERSION_H */

This article is for my own study notes, welcome to exchange.

Guess you like

Origin blog.csdn.net/weixin_68583698/article/details/131454864