Post of final script and solution 参考1
0) Download your relevant CUDA.run file:
mine was: cuda_7.0.28_linux.run
Note, that once again this install is if you purely want to use your graphics card (Titan X) for GPU/CUDA purposes and not for rendering.
准备:下载相应的CUDA文件,该安装只用显卡来实现GPU/CUDA功能,而非用来渲染。
Also run:
$sudo apt-get install build-essential
1) I start off with the regular GUI and Ubuntu working with no login problems.
正常进入GUI界面,并未出现login问题。
2) No need to create an xorg.conf file. If you have one, remove it (assuming you have a fresh OS install).
$ sudo rm /etc/X11/xorg.conf
没有必要建立xorg.conf文件,如果有,删除。
3) Create the /etc/modprobe.d/blacklist-nouveau.conf file with :
建立/etc/modprobe.d/blacklist-nouveau.conf,并加入以下内容。
blacklist nouveau
option nouveau modeset=0
Then 运行
$sudo update-initramfs -u
4) Reboot computer. Nothing should have changed in loading up menu. You should be taken to the login screen. Once there type: Ctrl + Alt + F1, and login to your user.
重启,Ctrl + Alt + F1并登录。
5) Go to the directory where you have the CUDA driver, and run
进入文件路径,并进行
$chmod a+x cuda_7.0.28_linux.run
7) Now, run
$sudo service lightdm stop
The top line is a necessary step for installing the driver.
必要的步骤。
8) I run the CUDA driver run file.
*Notice that I explicitly don’t want the OpenGL flags to be installed:
注意我特意不安装OpenGL。
$ sudo bash cuda-7.0.28_linux.run --no-opengl-libs
9) During the install:
Accept EULA conditions
Say YES to installing the NVIDIA driver
SAY YES to installing CUDA Toolkit + Driver
Say YES to installing CUDA Samples
Say NO rebuilding any Xserver configurations with Nvidia.
10) Installation should be complete. Now check if device nodes are present:
Check if /dev/nvidia* files exist. If they don’t, do :
检查安装完成后是否有NVIDIA的设备节点,如果没有,运行:
$ sudo modprobe nvidia
(我安装完也没有,但是CUDA安装正确。)
11) Set Environment path variables:
设置环境变量。
$ export PATH=/usr/local/cuda-7.0/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH
*Change depending on your cuda version.
根据版本的不同,更改路径。
12) Verify the driver version:
检查驱动版本。
$ cat /proc/driver/nvidia/version
13) Check CUDA driver version:
检查CUDA版本。
$ nvcc -V
[Optional] At this point you can switch the lightdm back on again by doing:
可以运行:
$ sudo service lightdm start.
You should be able to login to your session through the GUI without any problems or login-loops.
可以成功登录。
14) Create CUDA Samples. Go to your NVIDIA_CUDA-7.5_Samples folder and type $make.
15) Go to NVIDIA_CUDA-7.5_Samples/bin/x86_64/linux/release/ for the demos, and do the two standard checks:
./deviceQuery
to see your graphics card specs and
./bandwidthTest
to check if its operating correctly.
Both tests should ultimately output a ‘PASS’ in your terminal.
进入NVIDIA的sample并运行以上两个文件,如果结果有‘PASS’则安装成功。
16) Reboot. Everything should be ok.
重启。
17)监视显存:
设置每 1s 显示一次显存运行状态
watch -n 1 nvidia-smi