参考网址:http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile
下载runfile可以去官网根据gpu型号选择,这里不多说了;主要说说安装过程:
1、Disable the Nouveau drivers.
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
$ sudo update-initramfs -u(用来更新内核,即删除内核后运行此命令会重新生成内核)
2、$ sudo sh cuda_<version>_linux.run --no-opengl-libs ‘–kernel-source-path’(‘'/usr/src'’)
3、The PATH variable needs to include /usr/local/cuda-8.0/bin
To add this path to the PATH variable:
$ export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-8.0/lib64 on a 64-bit system, or /usr/local/cuda-8.0/lib on a 32-bit system
To change the environment variables for 64-bit operating systems:
$ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
To change the environment variables for 32-bit operating systems:
$ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5、下载cudnn,我这里用的是5.1版本
下载后直接解压到指定路径下即可使用
sudo tar -xvf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local/
6、出现Installing the NVIDIA display driver…
The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly.
If you know that the kernel source packages are installed and set up correctly, you may pass the location of the kernel source with the ‘–kernel-source-path’ flag.
解决办法两种:
1)、升级cuda,因为cuda8.0支持的事4.4的内核
参考网址:https://blog.csdn.net/lewif/article/details/79625151
2)、内核降级,适应cuda版本对应的内核即可
参考网址:https://blog.csdn.net/wangong/article/details/44699441(按照现有的内核搜索,可以删除现有内核,也可切换内核优先级)