一 配置显卡驱动
(sudo ubuntu-drivers autoinstall)
(sudo reboot)
(nvidia-smi)
英伟达官方网站下载驱动
二 配置CUDA10.0
(1)去cuda官网下载cuda 8.0 tool kit,注意务必下载.runfile包
(2)重启电脑,然后进入控制台,将lightdm关闭。
sudo systemctl set-default multi-user.target
sudo reboot
sudo systemctl set-default graphical.target
sudo reboot
(3)Cuda的安装
执行下面的命令进行安装:
sudo sh cuda_10.1.168_418.67_linux.run
注意:在安装的时候首先要一直按enter键完成安装文档的阅读,然后选择 accept 接下来会出现让你选择是否安装nvidia361驱动,因为前面驱动已经安装好了,所以这里要选择no,不安装默认驱动
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?#就是这里要选择no
(4) cuda环境的配置
添加环境变量
home文件下 ctrl+H显示隐藏文件 打开 .bashrc文件在最后添加
export LD_LIBRARY_PATH=
L
D
L
I
B
R
A
R
Y
P
A
T
H
:
/
u
s
r
/
l
o
c
a
l
/
c
u
d
a
−
10.0
/
l
i
b
64
e
x
p
o
r
t
P
A
T
H
=
LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64 export PATH=
LDLIBRARYPATH:/usr/local/cuda−10.0/lib64exportPATH=PATH:/usr/local/cuda-10.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.0
source ~/.bashrc 保存操作
nvcc --version 检查cuda是否安装成功
cat /usr/local/cuda/version.txt
查看cuda版本
三 配置 CUDNN
(1 )下载Cudnn压缩包
上官网下载对应的Cudnn
https://developer.nvidia.com/cudnn
(1) sudo cp cuda/include/cudnn.h /usr/local/cuda/include
(2) sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
(3) sudo chmod a+r /usr/local/cuda/include/cudnn.h
(4) sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
(5) sudo gedit ~/.bashrc
(6) export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
(7) source ~/.bashrc
(8) cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2