Ubuntu18.04安装CUDA10.2+cuDNN

1 安装CUDA10.2

  • 下载CUDA:CUDA-Toolkit-Archive,选择CUDA Toolkit 10.2版本
    Ubuntu18.04安装CUDA10.2+cuDNN

  • 选择操作系统、架构、Distribution及其版本(这里是Ubuntu18.04)和runfile(local)文件格式
    Ubuntu18.04安装CUDA10.2+cuDNN

  • 可以使用wget下载,亦可复制链接进行下载
    Ubuntu18.04安装CUDA10.2+cuDNN

  • 下载完成后:sudo sh cuda_10.2.89_440.33.01_linux.run

步骤说明:
(1)Do you accept the above EULA? accept
Ubuntu18.04安装CUDA10.2+cuDNN

(2)CUDA Installer 取消Driver安装(Enter选择/取消)-> Install
Ubuntu18.04安装CUDA10.2+cuDNN
(3)日志
Ubuntu18.04安装CUDA10.2+cuDNN

  • 配置环境变量:vim ~/.bashrc
    添加:
export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
  • 生效:source ~/.bashrc
  • 验证:
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery

出现如下输出,则CUDA安装成功
Ubuntu18.04安装CUDA10.2+cuDNN

nvcc -V出现如下输出,则CUDA安装成功。
Ubuntu18.04安装CUDA10.2+cuDNN

2 安装cuDNN

  • 下载cuDNN:cuDNN Download(需注册)

  • 选择:I Agree To the Terms of the cuDNN Software License Agreement -> Archived cuDNN Releases
    Ubuntu18.04安装CUDA10.2+cuDNN

  • 选择适配Ubuntu、CUDA 10.2的最新版cuDNN v8.2.2 -> cuDNN Library for Linux (x86)
    Ubuntu18.04安装CUDA10.2+cuDNN

  • 下载完成后,解压,进入相应目录,运行以下命令:

sudo cp cuda/include/cudnn.h /usr/local/cuda-10.2/include
sudo cp cuda/include/cudnn_version.h /usr/local/cuda-10.2/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-10.2/lib64
sudo chmod a+r /usr/local/cuda-10.2/include/cudnn.h
sudo chmod a+r /usr/local/cuda-10.2/include/cudnn_version.h 
sudo chmod a+r /usr/local/cuda-10.2/lib64/libcudnn*
  • 验证:cat /usr/local/cuda-10.2/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
    Ubuntu18.04安装CUDA10.2+cuDNN
上一篇:支付宝“咻一咻”峰值达到177亿次/分钟,技术如何支撑?


下一篇:故障处理流程浅谈