1. PRE-INSTALLATION ACTIONS
1. 1 Verify You Have a CUDA-Capable GPU
$ lspci | grep -i nvidia
1. 2 Verify You Have a Supported Version of Linux
$ uname -m && cat /etc/*release
1. 3 Verify the System Has gcc Installed
$ gcc --version
1. 4 Verify the System has the Correct Kernel Headers and Development Packages Installed
$ uname -r
1. 5 Choose an Installation Method
http://developer.nvidia.com/cuda-downloads
2. RUNFILE INSTALLATION
2. 1 Disabling Nouveau
The Nouveau drivers are loaded if the following command prints anything:
$ lsmod | grep nouveau
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kevnel initramfs:
$ sudo update-initramfs -u
Restart the computer.
2. 2 Installation
$ sudo service lightdm stop
$ cd Downloads
$ sudo sh cuda_8.0.61_375.26_linux.run
If the GPU used for display is not an NVIDIA GPU, the NVIDIA openGL libraries should not be installed.
$ sudo service lightdm start
For non-standard systems, such as those with more than one GPU, it is recommended to manually edit the X server configuration file, /etc/X11/xorg.conf, like https://m.douban.com/note/262885853/.
Device Node Verification:
Check that the device files /dev/nvidia* exist and have the correct(0666) file permission. if these files do not exist, create them manually by using a startup script such as the one below:
#!/bin/bash
/sbin/modprobe nvidia
if [ "$?" -eq 0 ]; then
# Count the number of NVIDIA controllers found.
NVDEVS=`lspci | grep -i NVIDIA`
N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
N=`expr $N3D + $NVGA - 1`
for i in `seq 0 $N`; do
mknod -m 666 /dev/nvidia$i c 195 $i
done
mknod -m 666 /dev/nvidiactl c 195 255
else
exit 1
fi
/sbin/modprobe nvidia-uvm
if [ "$?" -eq 0 ]; then
# Find out the major device number used by the nvidia-uvm driver
D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
mknod -m 666 /dev/nvidia-uvm c $D 0
else
exit 1
fi
2. 3 Environment Setup
$ sudo vi /etc/profile
Insert the following contents at the last line:
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
Restart the computer.
只安装驱动的时候:
sudo sh NVIDIA-Linux-x86_64-375.20.run -no-x-check -no-nouveau-check -no-opengl-files
3. Verify the Installation
3. 1 Verify the Driver Version
$ cat /proc/driver/nvidia/version
3. 2 Verify the version of the CUDA Toolkit
$ nvcc -V
3. 3 Compiling the Examples
$ cd NVIDIA_CUDA-8.0_Samples
$ make
The resulting binaries will be placed under ~/NVIDIA_CUDA-8.0_Samples/bin.
$ cd bin/x86_64/linux/release
$ ./deviceQuery
$ ./bandwidthTest
Notice
- To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin.
- To uninstall the NVIDIA Driver, run
nvidia-uninstall
.
Tips:
Ubuntu Packages Search