linux ubuntu 18.04 卸载cuda10.2 安装cuda 9.0

一、 卸载cuda10.2

$ sudo /usr/local/cuda-10.2/bin/cuda-uninstaller

或者

$ cd /usr/local/cuda-10.2/bin
$ sudo ./cuda-uninstaller

等待一会,会自动提示卸载成功。

二、安装cuda 9.0

卸载了10.2,安装9.0(部分可以参考:https://blog.csdn.net/qxqxqzzz/article/details/89162810)

gcc 没有降级。以下命令安装官网:https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html#ubuntu-installation

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda

改配置,验证安装是否成功

$ sudo gedit ~/.bashrc

export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64
export CUDA_HOME=/usr/local/cuda-9.0

$ source ~/.bashrc
$ nvcc -V

安装cudnn

# 按照官网:https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
# 拷贝文件时目录有所更改。与官方略有不同

$ tar -xzvf cudnn-9.0-linux-x64-v7.4.2.24.tgz
$ sudo cp cuda/include/cudnn.h /usr/local/cuda-9.0/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64
$ sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*

可能还需要建立软连接

$ sudo ln -sf /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7.4.2 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7

 

 

$ nvidia-smi

显示 NVIDIA NVML Driver/library version mismatch

重启就好了。

你可能感兴趣的:(#,DL-基础,Linux)