[Linux] installation cuda + cudnn

Check the Driver

Note:

  • A machine corresponds to only one nvidia driver, and may correspond to a plurality of CUDA nvidia driver. As long as his path in the cuda designated to a specific version of the line.
  • Try not to use / usr / local / following default cuda /, ln prevent because the object will change and impact.
  • nvidia driver version determines the available cuda range, thereby determining the available tensorflow-gpu version. So, each time before a new machine, first determine the nvidia driver version.

View nvidia driver version:

cat /proc/driver/nvidia/version

Table 1. CUDA Toolkit and Compatible Driver Versions
Screen shot 2019-09-18 11.35.08.png am

Installation Cuda

View native operating system:

cat /etc/issue

Go head loss Sheriff network, download the corresponding version of cuda:
Screenshot 2.18.11.png 2019-09-18 PM

Note:

  • The following case study to cuda9.0.

Installation cuda:

sudo sh cuda_9.0.176_384.81_linux.run

Note:

  • Do not install driver! Otherwise, the installation fails!
    Screenshot 10.07.12.png 2019-08-12 PM

Into the corresponding path:

vim ~/.bashrc
export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
source ~/.bashrc

View cuda version, verify that the installation was successful:

nvcc -V

Installation Cudnn

Cudnn download the corresponding installation package.

Note:

  • The following order cuda9.0, cudnn7.6.2 example.

Decompression:

mkdir cudnn
tar -xvzf cudnn-9.0-linux-x64-v7.6.2.24.tgz -C cudnn/

Copy the file:

sudo cp cudnn/cuda/lib64/lib* /usr/local/cuda-9.0/lib64/
sudo cp cudnn/cuda/include/cudnn.h /usr/local/cuda-9.0/include/

Set soft links:

cd /usr/local/cuda-9.0/lib64
sudo rm -rf libcudnn.so libcudnn.so.7
sudo ln -s libcudnn.so.7.6.2 libcudnn.so.7
sudo ln -s libcudnn.so.7 libcudnn.so
sudo ldconfig
Published 628 original articles · won praise 863 · Views 1.85 million +

Guess you like

Origin blog.csdn.net/JNingWei/article/details/104878973