0. 阐明
这是2022年5月4日胜利装置nvidia driver
&cuda11.6
&cudnn
的案例,仅供参考。
每项蕴含装置和验证两个步骤,每个小标题都是对应的领导地址,请点击之。
1. NVIDIA Driver
装置
举荐510版本(对应cuda11.6)
验证
能在命令行中应用nvidia-smi
指令就胜利了,如果不行可能是没有重启的起因
2. CUDA(CUDA Toolkit)
装置
次要是看nvidia-smi
中的cuda版本,在官网列表中找到本人的版本,按机器的状况抉择,就会失去残缺的指令(runfile是图形界面,deb是命令行,集体举荐deb)
参考官网教程 是deb形式的
验证
进行装置胜利验证如下:
$ git clone --depth=1 https://github.com/NVIDIA/cuda-samples.git$ cd cuda-samples/Samples/1_Utilities/deviceQuery$ sudo make$ ./deviceQuery # 最初输入PASS就胜利了./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking)........Result = PASS
仿佛须要给.bashrc加内容,但我不分明作用是什么。
$ vim ~/.bashrc# 在最初退出以下两句,cuda版本号我是11.6,可能须要批改export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}# 最初$ source ~/.bashrc
3. CUDNN
装置
- Navigate to your <cudnnpath> directory containing the cuDNN Debian local installer file.
下载 deb文件,登录拿qq、wechat就行 - Enable the local repository.
sudo dpkg -i cudnn-local-repo-${OS}-8.x.x.x_1.0-1_amd64.deb
orsudo dpkg -i cudnn-local-repo-${OS}-8.x.x.x_1.0-1_arm64.deb
- Import the CUDA GPG key.
sudo apt-key add /var/cudnn-local-repo-*/7fa2af80.pub
Refresh the repository metadata.
sudo apt-get update
在这一步中,你会看到相似于Get:8 file:/var/cudnn-local-repo-ubuntu2004-8.4.0.27 Release [564 B]
进入这个文件夹,外面是你能选的cudnn版本,也就是步骤5 6 7须要的版本号,- Install the runtime library.
sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y
- Install the developer library.
sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y
- Install the code samples and the cuDNN library documentation.
sudo apt-get install libcudnn8-samples=8.x.x.x-1+cudaX.Y
验证
- Copy the cuDNN samples to a writable path.
cp -r /usr/src/cudnn_samples_v8/ $HOME
- Go to the writable path.
cd $HOME/cudnn_samples_v8/mnistCUDNN
Compile the mnistCUDNN sample.
make clean && make
在这一步我显示了test.c:1:10: fatal error: FreeImage.h: No such file or directory 1 | #include "FreeImage.h" | ^~~~~~~~~~~~~compilation terminated.>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
须要装置好
FreeImage
,参考$ sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev$ sudo apt-get install libfreeimage3 libfreeimage-dev
- Run the mnistCUDNN sample.
./mnistCUDNN
如果没问题的话会显示:
Test passed!
祝贺!到此曾经实现装置! 你曾经领有nvidia driver
& cuda11.6
& cudnn8.4.0.27-1
! XD
其余
Google pinyin
搜狗是shit