How to configure pytorch 10.2 in cuda 11 of Linux system

Since pytorch1.8.2 can only support version 10.2 at present, the latest system driver of ubuntu directly supports cuda 11.4, and the default download supported by cuda tooklit is also 11.0.

1. Confirm the NVIDIA driver installation

lspci|grep NVIDIA

1. You need to lower the version of cuda tooklit first (uninstall the new version)

cuda-uninstaller in /usr/local/cuda-11.1/bin
sudo rm -rf /usr/local/cuda-11.1

or

cd /usr/local/cuda-11.0/bin/
sudo ./cuda-uninstaller
sudo rm -rf /usr/local/cuda-11.1

2. Then download and install cuda 10.2:

1. Check the number of bits in the Linux system

2. View the ubantu version number

3. Download and install CUDA 10.2

CUDA Toolkit 10.2 Download

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

4. Only install other content except the driver, and test whether it is successful after the installation is complete

cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery

If PASS appears, it means there is no problem.

3.输入以下命令验证是否安装成功:

 nvidia-smi 

3. Install cudnn

View the cndnn installed on the current computer

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

As you can see, the current version is 7.6.5.

Go to the official website to choose the version that suits you. There are many options. We choose v7.6.5.

Download these three files:

1. Delete the old version

If it was installed in the form of a compressed package before, just delete cudnn in the following two folders:

sudo rm -rf/usr/local/cuda/include/cudnn.h 
sudo rm -rf/usr/local/cuda/lib64/libcudnn*

If it was installed in the form of deb before, more directories will be deleted:

sudo rm -rf /usr/local/cuda/targets/x86_64-linux/include/cudnn.h
sudo rm -rf /usr/lib/x86_64-linux-gnu/libcudnn*
sudo rm -rf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn*
sudo rm -rf /usr/share/doc/libcudnn*
sudo rm -rf /var/lib/dpkg/info/libcudnn*
sudo rm -rf /usr/share/lintian/overrides/libcudnn*

2. Then use the command to install:

sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb

Guess you like

Origin blog.csdn.net/qq_41627642/article/details/128937097