Ubuntu18.04 upgrade cuda

origin

  1. nvidia-smi is inconsistent with nvcc --version version,

    please refer to https://blog.csdn.net/weixin_39518984/article/details/111406728
  2. The experiment requires a higher version of cuda

Tensorflow cuda cudnn version corresponding reference https://blog.csdn.net/weixin_45184581/article/details/124583991

uninstall old cuda

sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl

Go to the /usr/local/cuda-9.0 folder to check, generally speaking, there are some cudnn files, delete it

sudo rm -rf /usr/local/cuda-9.0

install new cuda

Download address https://developer.nvidia.com/cuda-toolkit-archive
insert image description here
Download and install according to the command prompts respectively
When installing:
insert image description here


Do not install the driver
Do not install the driver
insert image description here

Modify environment variables

sudo gedit ~/.bashrc

Change the original content to

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

Save and exit execution

source ~/.bashrc

verify cuda

cd /usr/local/cuda-11.6
chmod 777 samples
cd samples
git clone https://gitee.com/liwuhaoooo/cuda-samples.git
#或者git clone samples里面给的那个地址

after downloading

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

insert image description here
Successful installation

install cudnn

The download address https://developer.nvidia.com/zh-cn/cudnn
must be registered and logged in first.
insert image description here
After downloading, unzip and enter the unzipped folder

sudo cp include/cudnn.h /usr/local/cuda-11.6/include
sudo cp lib/libcudnn* /usr/local/cuda-11.6/lib64
sudo chmod a+r /usr/local/cuda-11.6/include/cudnn.h 
sudo chmod a+r /usr/local/cuda-11.6/lib64/libcudnn*

insert image description here

Guess you like

Origin blog.csdn.net/weixin_45184581/article/details/124583767