Ubuntu 16.04安装CUDA8.0 CUDA9.0 cuDNN5.1 cuDNN6 cuDNN7

安装显卡驱动

系统设置→软件和更新→附加驱动
选择使用NVIDIA binary driver - version 375.66 来自 nvidia-375 应用更改
安装完成后重启
在终端中输入nvidia-smi

CUDA

官网下载
PyTorch 0.3 支持 cuda9.0

Ubuntu 16.04安装CUDA8.0 CUDA9.0 cuDNN5.1 cuDNN6 cuDNN7_第1张图片
CUDA下载

运行
cuda8.0
sudo sh cuda_8.0.61_375.26_linux.run
cuda9.0
sudo sh cuda_9.0.176_384.81_linux.run

显卡驱动安装选择n
其他选择y

添加环境变量

sudo gedit /etc/profile

末尾添加
cuda8.0

export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64$LD_LIBRARY_PATH

cuda9.0

export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64$LD_LIBRARY_PATH

运行

source /etc/profile

测试

cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
Ubuntu 16.04安装CUDA8.0 CUDA9.0 cuDNN5.1 cuDNN6 cuDNN7_第2张图片
安装成功

cuDNN

官网注册后下载
选择cuDNN5.1或者cuDNN6(TensorFlow 1.3需要cuDNN6.0),下载cuDNN后解压,

Download cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0→cuDNN v5.1 Library for Linux
Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0→cuDNN v6.0 Library for Linux
[Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0]→cuDNN v7.0.5 Library for Linux

cuda8.0

sudo cp cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda-8.0/lib64/libcudnn*

cuda9.0

sudo cp cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*

参考资料

Ubuntu 16.04 CUDA 8 cuDNN 5.1安装

你可能感兴趣的:(Ubuntu 16.04安装CUDA8.0 CUDA9.0 cuDNN5.1 cuDNN6 cuDNN7)