1 安装CUDA10.2
-
下载CUDA:CUDA-Toolkit-Archive,选择CUDA Toolkit 10.2版本
-
选择操作系统、架构、Distribution及其版本(这里是Ubuntu18.04)和runfile(local)文件格式
-
可以使用wget下载,亦可复制链接进行下载
-
下载完成后:
sudo sh cuda_10.2.89_440.33.01_linux.run
步骤说明:
(1)Do you accept the above EULA? accept
(2)CUDA Installer 取消Driver安装(Enter选择/取消)-> Install
- 配置环境变量
vim ~/.bashrc
添加:
点击查看代码
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/lcoal/cuda-10.1/lib64:$LD_LIBRARY_PATH
- 生效:
source ~/.bashrc
- 验证:
点击查看代码
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
出现如下输出,则CUDA安装成功
或nvcc -V
出现如下输出,则CUDA安装成功。
2 安装cuDNN
-
下载cuDNN:cuDNN Download(需注册)
-
选择:I Agree To the Terms of the cuDNN Software License Agreement -> Archived cuDNN Releases
-
选择适配Ubuntu、CUDA 10.2的最新版cuDNN v8.2.2 -> cuDNN Library for Linux (x86)
-
下载完成后,解压,进入相应目录,运行以下命令:
点击查看代码
sudo cp cuda/include/cudnn.h /usr/local/cuda-10.1/include
sudo cp cuda/include/cudnn_version.h /usr/local/cuda-10.1/include
sudo cp cuda/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*
- 验证:cat /usr/local/cuda-10.1/include/cudnn_version.h | grep CUDNN_MAJOR -A 2