Download the cuda_9.1.85_387.26_linux.run file from https://developer.nvidia.com/cuda-downloads
$ sudo sh cuda_9.1.85_387.26_linux.run --no-opengl-libs
After that is some prompt information, enter accept after ctrl+c directly ends.
The next important point is when prompted whether to install the graphics card driver, be sure to select no (the driver for the corresponding graphics card version has been installed before)
Choose Yes for other prompts, and install the path by default. It is prompted to enter y for y, if not, press enter. Installed.
Then declare the environment variable and write it to the end of the ~/.bashrc file (under the user directory), the input is as follows
export PATH=/usr/local/cuda-9.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64:$LD_LIBRARY_PATH
Save and exit, and enter the following command to make the environment variable take effect immediately:
$source ~/.bashrc
$sudo vim /etc/profile
Add at the end of the opened file:
export PATH=/usr/local/cuda/bin:$PATH
$ sudo vim /etc/ld.so.conf.d/cuda.conf
Add the following statement to the opened file:
/usr/local/cuda/lib64
Save and exit, then execute
$ sudo ldconfig
Make the link effective immediately.
Switch to the default installation path of CUDA 9.1 Samples (that is, under the /home/user/NVIDIA_CUDA-9.1_Samples directory), enter in the terminal
$ cd NVIDIA_CUDA-9.1_Samples
$ sudo make all –j8
$ cd bin/x86_64/linux/release
$ ./deviceQuery
Report an error
$ ./deviceQuery
. /deviceQuery Starting...
CUDA Device Query(Runtime API)version(CUDART static linking)
cudaGetDeviceCount returned 30-> unknown error
Result = FAIL
Check if the graphics card is installed
$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
Found that the graphics card driver was not installed successfully
And nouveau disable failed
$ lsmod | grep nouveau
nouveau 16015361
mxm_wmi 163841 nouveau
ttm 983041 nouveau
i2c_algo_bit 163842 nouveau,i915
drm_kms_helper 1515522 nouveau,i915
drm 35225614 nouveau,i915,ttm,drm_kms_helper
wmi 163842 mxm_wmi,nouveau
video 409603 thinkpad_acpi,nouveau,i915
This is to disable nouveau again and install the graphics driver
If the CUDA installation is successful, there are:
$ ./deviceQuery
. /deviceQuery Starting...
CUDA Device Query(Runtime API)version(CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0:"GeForce GT 635M"
CUDA Driver Version / Runtime Version 9.0/8.0
CUDA Capability Major/Minor version number:2.1
Total amount of global memory:1985MBytes(2081619968 bytes)(2) Multiprocessors,(48) CUDA Cores/MP:96 CUDA Cores
GPU Max Clock rate:950MHz(0.95 GHz)
Memory Clock rate:900 Mhz
Memory Bus Width:128-bit
L2 Cache Size:131072 bytes
Maximum Texture Dimension Size(x,y,z) 1D=(65536), 2D=(65536,65535), 3D=(2048,2048,2048)
Maximum Layered 1D Texture Size,(num) layers 1D=(16384),2048 layers
Maximum Layered 2D Texture Size,(num) layers 2D=(16384,16384),2048 layers
Total amount of constant memory:65536 bytes
Total amount of shared memory per block:49152 bytes
Total number of registers available per block:32768
Warp size:32
Maximum number of threads per multiprocessor:1536
Maximum number of threads per block:1024
Max dimension size of a thread block(x,y,z):(1024,1024,64)
Max dimension size of a grid size(x,y,z):(65535,65535,65535)
Maximum memory pitch:2147483647 bytes
Texture alignment:512 bytes
Concurrent copy and kernel execution: Yes with1 copy engine(s)
Run time limit on kernels: No
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing(UVA): Yes
Device PCI Domain ID / Bus ID / location ID:0/1/0
Compute Mode:<Default(multiple host threads can use ::cudaSetDevice()with device simultaneously)>
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version =9.0, CUDA Runtime Version =8.0, NumDevs =1, Device0 = GeForce GT 635M
Result = PASS
In the /usr/local/cuda/bin directory, there is the uninstall tool uninstall_cuda_9.1.pl that comes with cuda
$ cd /usr/local/cuda/bin
$ sudo ./uninstall_cuda_9.1.pl
View NVIDIA GPU version information
$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 635M](rev a1)
Verify that your Linux version supports CUDA
$ uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Check the running system kernel version:
$ uname –r
4.10.0- 28- generic
Install the kernel header and package development corresponding to the kernel version
sudo apt-get install linux-headers-$(uname -r)
Check whether nouveau driver is disabled
lsmod | grep nouveau
If there is output, it means nouveau is loading. We need to manually ban nouveau, Ubuntu’s nouveau ban method mentioned earlier
See link:
http://blog.csdn.net/qlulibin/article/details/78714596
Recommended Posts