every blog every motto: You can do more than you think.
https://blog.csdn.net/weixin_39190382?type=blog
0. 前言
显卡驱动安装参考之前的文章
cuda、cudnn 安装
1. cuda 安装
访问https://developer.nvidia.com/cuda-toolkit-archive
选择需要的版本:https://developer.nvidia.com/cuda-12-2-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=runfile_local
wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run
sudo sh cuda_12.2.0_535.54.03_linux.run
2. cudnn 安装
2.1 deb方法
访问https://developer.nvidia.com/cudnn-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local
wget https://developer.download.nvidia.com/compute/cudnn/9.2.1/local_installers/cudnn-local-repo-ubuntu2204-9.2.1_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.2.1_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2204-9.2.1/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudnn
对于cuda12
sudo apt-get -y install cudnn-cuda-12
如果是cuda11
sudo apt-get -y install cudnn-cuda-11
2.2 tar方法
访问https://developer.nvidia.com/rdp/cudnn-archive
根据需求选择:
如下图所示,也可以下载deb,用deb安装
复制文件:
cd \Downloads # 更改文件夹,下载后默认地址
tar -xvf cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz # 解压
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include # 复制
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
查看cudnn版本命令:
cat /usr/include/cudnn_version.h |grep CUDNN_MAJOR -A 2
参考
- https://www.cnblogs.com/fireblackman/p/18202719
- https://cloud.tencent.com/developer/article/1726582
- https://blog.csdn.net/qq_32033383/article/details/135015041
- https://blog.csdn.net/qq_44961869/article/details/115954258
- https://blog.csdn.net/h3c4lenovo/article/details/119003405
- https://blog.csdn.net/weixin_73728875/article/details/129054053
- https://blog.csdn.net/yingmohuanzhou/article/details/136826468