Ubuntu16.04多版本cuda切换 ——cuda8.0与cuda10.1
本机已安装cuda8.0+cudnn6.0,现在需要安装cuda10.1+cudnn7.5
cuda:
https://developer.nvidia.com/cuda-80-ga2-download-archive
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu
cudnn:
https://developer.nvidia.com/rdp/cudnn-archive
1.安装
sudo ./cuda_10.1.105_418.39_linux.run
然后输入accept,回车
因为系统中已安装NVIDIA显卡驱动,如果不想安装CUDA 10.1中附带的驱动,移动到Driver选项上,按空格键将该项取消。
遇到以下选择No
显示如下安装完成
2.修改配置文件
sudo gedit ~/.bashrc
将cuda8.0修改为cuda
保存退出
source ~/.bashrc
3.由cuda8.0切换到cuda10.1
sudo rm -rf /usr/local/cuda
sudo ln -s /usr/local/cuda-10.1 /usr/local/cuda
//查看版本号
nvcc --version
同样的由cuda10.1切换到cuda8.0
sudo rm -rf /usr/local/cuda
sudo ln -s /usr/local/cuda-8.0 /usr/local/cuda
4.切换成功后安装cudnn7.5
解决cudnn文件 放在home下命名为cuda10.1
打开终端
sudo cp cuda10.1/include/cudnn.h /usr/local/cuda-10.1/include/
sudo cp cuda10.1/lib64/libcudnn* /usr/local/cuda-10.1/lib64/
sudo chmod a+r /usr/local/cuda-10.1/include/cudnn.h
sudo chmod a+r /usr/local/cuda-10.1/lib64/libcudnn*
//查看cudnn版本号
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2