各个版本: https://developer.nvidia.com/cuda-toolkit-archive
我选择的就是 cuda=11.2.2
还是选择 .run
文件吧, .deb
总是出错。
wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux.run
vim /etc/modprobe.d/blacklist-nouveau.conf
# add
## blacklist nouveau
## options nouveau modeset=0
sudo update-initramfs -u
sudo bash cuda_11.2.2_460.32.03_linux.run --no-opengl-libs
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}}
各个版本:https://developer.nvidia.com/rdp/cudnn-archive
我的选择:
cuDNN Runtime Library for Ubuntu20.04 x86_64 (Deb)
cuDNN Developer Library for Ubuntu20.04 x86_64 (Deb)
cuDNN Code Samples and User Guide for Ubuntu20.04 x86_64 (Deb)
下载并且通过 dpkg
安装完毕之后, 我们进行验证操作.
为防止破坏原有代码的架构, 我们将其 复制 出来.
sudo apt install libfreeimage3 libfreeimage-dev
mkdir ${HOME}/test
cd ${HOME}/test
cp -r /usr/src/cudnn_samples_v8/ ${HOME}/test
cd cudnn_samples_v8/mnistCUDNN/
make clean && make
./mnistCUDNN # 出现 Test passed! 代表 cudnn 正常使用
如果提示错误, 那么需要安装依赖:
test.c:1:10: fatal error: FreeImage.h: No such file or directory
1 | #include “FreeImage.h”
| ^~~~~~~~~~~~~
compilation terminated.
sudo apt install libfreeimage3 libfreeimage-dev