网上似乎比较少cuda8.0的环境搭建博客,本人也倒腾了几天,分享下。
服务器重装ubuntu系统后,接上独立显卡,频率太高,黑屏:
切换成集显,安装ssh
$ apt-get install ssh
切换独显,在另一台电脑用xshell登陆服务器
To verify that your GPU is CUDA-capable, go to your distribution’s equivalent of System
Properties, or, from the command line, enter:
显卡受CUDA支持的话,就会打印显卡信息,CUDA支持显卡列表:https://developer.nvidia.com/cuda-gpus
$ lspci | grep -i nvidia
The kernel headers and development packages for the currently running kernel can be installed with:
$ apt-get install linux-headers-$(uname -r)
To install the Display Driver, the Nouveau drivers must first be disabled . Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
$ vim /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
$ update-initramfs -u
重启服务器,发现显示没问题了。
Reboot into text mode (runlevel 3)//字符界面启动
$ cp /etc/default/grub /etc/default/grub_bk //备份一份
$ vim /etc/default/grub
按照下图修改:
$ update-grub
重启进入字符界面
$ ./cuda_8.0.27_linux.run //安装cda过程中跳过driver不安装,其他安装
cuda_8.0.27_linux.run下载地址(https://developer.nvidia.com/cuda-toolkit) 按照相应系统下载,需要注册账号
$./NVIDIA-Linux-x86_64-367.27.run //安装driver
NVIDIA-Linux-x86_64-367.27.run下载地址(http://www.geforce.cn/drivers/results/104314)
重启服务器,恢复图形桌面
$ cp /etc/default/grub_bk /etc/default/grub
再重启服务器进入图形桌面
添加环境变量
$ vim ~/.bashrc
export PATH=/usr/local/cuda-8.0/bin{PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
本文参考这两份文件:
CUDA_Installation_Guide_Linux.pdf
CUDA_Quick_Start_Guide.pdf