ubuntu16.04 cuda cudnn 升级部署

cuda10升级cuda11详细教程ubuntu16.04 cudnn部署


前言

`
随着显卡更新换代,很多程序需要cuda11环境,下面我们开始不卸载cuda10.直接升级cuda11


一、cuda是什么?

CUDA(Compute Unified Device Architecture),是显卡厂商NVIDIA推出的运算平台。 CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题

二、使用步骤

1.下载cuda11

https://developer.nvidia.com/cuda-downloads


## 不用卸载cuda10,直接安装cuda11,取消驱动勾选。选择install
sudo ./cuda_11.2.0_460.27.04_linux.run
#设置环境变量
echo 'export CUDA_HOME=/usr/local/cuda-11.2'   >>~/.bashrc
echo 'export LD_LIBRARY_PATH=${CUDA_HOME}/lib64'  >>~/.bashrc
echo 'export PATH=${CUDA_HOME}/bin:${PATH}'  >>~/.bashrc

source ~/.bashrc
cd /etc/ld.so.conf.d
sudo  sh -c "echo  /usr/local/cuda-11.2/lib64   >>  /etc/ld.so.conf.d/cuda-11-2.conf"
-

2.安装cudnn

#下载cudnn解压,
#将cuda下的文件复制到对应目录
sudo cp cuda/lib64/* /usr/local/cuda-11.2/lib64/
sudo cp cuda/include/* /usr/local/cuda-11.2/include/
sudo chmod a+r /usr/local/cuda-11.2/include/cudnn.h /usr/local/cuda-11.2/lib64/libcudnn*
cd /usr/local/cuda-11.2/lib64
sudo rm libcudnn.so.8
sudo rm libcudnn.so
sudo ln -s libcudnn.so.8.0.5 libcudnn.so.8
sudo ln -s libcudnn.so.8 libcudnn.so
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
sudo ln -sf /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.0.5 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
sudo ldconfig

总结

注意确认驱动版本支持的最高cuda版本,否则会安装失败,本文是用cuda11.2 和cudnn8.0.5版本

你可能感兴趣的:(linux,ubuntu)