ubuntu 14.04 1080ti 安装 CUDA8 & cudnn

前端之家收集整理的这篇文章主要介绍了ubuntu 14.04 1080ti 安装 CUDA8 & cudnn前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

环境

OS : ubuntu 14.04.5 desktop ( x64 )
Graphics : NVIDIA 1080ti 单卡
主板无视频接口 (VGA DVI HDMI)

1 准备

1> 下载 NVIDIA driver

http://www.geforce.com/drivers
手动搜索,最后一项选择recommended,下载的文件是 .run

2> 下载 CUDA

https://developer.nvidia.com/cuda-downloads
选择runfile (local)
文件很大,下载好之后记得验证checksum,以免出错。Linux 可以用md5sum,win请google搜索fciv

3> 下载 cudnn

https://developer.nvidia.com/cudnn
目前需要登录之后才能下载,如果下载v6.0的时候出现了403,请fan&qiang之后再尝试。

2 检查硬件连接情况

lspci | grep VGA

如果连接正常,会看到 NVIDIA Corporation 字样

3 install NVIDIA Graphics Driver

nvidia-uninstall #卸载driver
apt remove --purge nvidia*

卸载所有和nvidia相关的包
如果有 nouveau ,则需要关掉,或者卸载

设置开机启动到console界面,编辑 /etc/default/grub
保留以下内容,并update-grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"
GRUB_TERMINAL=console

reboot后进入console

lightdm stop  #停止light
chmod +x /path/to/NVIDIA-Linux-x86_64-xxx.run
/path/to/NVIDIA-Linux-x86_64-xxx.run  #安装

中间有提示nvidia xconfig,因为它会备份系统本身的配置,卸载这个driver的时候会给你恢复,所以给它自己配置
装完之后检查下

root@caffe-1080ti:/home/cnn# nvidia-smi
Fri Jul 7 10:28:16 2017 +-----------------------------------------------------------------------------+
| NVIDIA-SMI 381.22                 Driver Version: 381.22                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 0000:02:00.0     Off |                  N/A |
| 0% 39C P0 55W / 250W | 0MiB / 11172MiB | 2% Default | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
| No running processes found | +-----------------------------------------------------------------------------+

Name 已经显示出型号了, nvidia-smi -q 可以看到更多的细节。driver安装完毕

4 安装CUDA

执行前面下载的很大的那个run文件
首先会显示很长的license,按 q ,然后输入accept

1 Install NVIDIA Accelerated Graphics Driver for Linux-x86_64

填 n
如果安装了这个driver,而不是按照上面3的单独的driver 安装文件,那么执行 nvidia-smi 和 nvidia-smi -q 就会显示下面的内容,意思就是没识别出显卡

nvidia-smi +-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.26                 Driver Version: 375.26                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  ERR!                Off  | 0000:02:00.0     Off |                  N/A |
| 0% 38C P0 54W / 250W | 0MiB / 11171MiB | 3% Default | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
| No running processes found | +-----------------------------------------------------------------------------+

nvidia-smi -q
Product Name                    : Unknown Error

2 Do you want to install the OpenGL libraries?

填 n

3 Do you want to run nvidia-xconfig?

填 y提示里面说了会给你恢复,不要虚

4 Install the CUDA 8.0 Toolkit?

Enter Toolkit Location
 [ default is /usr/local/cuda-8.0 ]:
'Do you want to install a symbolic link at /usr/local/cuda?

如果你装过了,也没有卸载,就不用再装了。这个link 环境变量需要用到,填y

5 Install the CUDA 8.0 Samples?

Enter CUDA Samples Location

sample 可以用来检测CUDA 是否正确地被安装了。

装完之后,提示修改 PATH 和 LD_LIBRARY_PATH

Driver:  Installed
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /home/cnn/CUDA-samples,but missing recommended libraries

Please make sure that - PATH includes /usr/local/cuda-8.0/bin - LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64,or,add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root To uninstall the CUDA Toolkit,run the uninstall script in /usr/local/cuda-8.0/bin To uninstall the NVIDIA Driver,run nvidia-uninstall Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA. Logfile is /tmp/cuda_install_2602.log

直接修改 /etc/profile 对所有用户生效。文件增加以下内容,并 source生效

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

添加链接参数

echo "/usr/local/cuda/lib64" > /etc/ld.so.conf.d/cuda.conf
ldconfig

5 安装cuDNN

参考
https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/Doc/cudnn_install-txt
分别安装
Runtime Lib 和 Dev Lib

参考

Ubuntu-安装-cuda7.0-单显卡-超详细教程
ubuntu 14.04 如何安装nvidia显卡驱动 [转载]

原文链接:https://www.f2er.com/ubuntu/352285.html

猜你在找的Ubuntu相关文章