下载https://developer.nvidia.com/cuda-downloads
Verify You Have a CUDA-Capable GPU
1 首先验证你是否有nvidia的显卡(http://developer.nvidia.com/cuda-gpus这个网站查看你是否有支持gpu的显卡):
- $ lspci | grep -i nvidia
Verify You Have a Supported Version of Linux
$ uname -m && cat /etc/*release
Verify the System Has gcc Installed
gcc --version
Verify the System has the Correct Kernel Headers and Development Packages Installed
For example, if your system is running kernel version 3.17.4-301, the 3.17.4-301 kernel headers and development packages must also be installed.
2 it is best to manually ensure the correct version of the kernel headers and development packages are installed prior to installing the CUDA Drivers, as well as whenever you change the kernel version.The version of the kernel your system is running can be found
$ uname -r
The kernel headers and development packages for the currently running kernel can be
installed with:
$ sudo apt-get install linux-headers-$(uname -r)
3 Use the following command to uninstall a Toolkit runfile installation:
$ sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl
Use the following command to uninstall a Driver runfile installation:
$ sudo /usr/bin/nvidia-uninstall
Use the following commands to uninstall a RPM/Deb installation:
$ sudo apt-get --purge remove <package_name>
$ sudo yum remove <package_name>
$ sudo zypper remove <package_name>
4 Installation Instructions:
- `sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb`
- `sudo apt-get update`
- `sudo apt-get install cuda`
5 设置环境变量 export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
设置完毕之后,你还可以选择是否安装cuda附带的示例代码(<dir>表示你要安装的位置,你可以将<dir>替换成~):
- $ cuda-install-samples-7.5.sh <dir>
- cuda-install-samples-7.5.sh ~
6 接下来做一些验证工作:
查看显卡的驱动版本
- cat /proc/driver/nvidia/version
查看nvcc编译器的版本
- nvcc -V i
编译cuda的示例代码:
- cd ~/NVIDIA_CUDA-6.5_Samples
然后make一下编译代码。
进入bin路径运行devicequery
- cd ~/NVIDIA_CUDA-6.5_Samples/bin
- ./ deviceQuery
7 正常情况就不说了
非正常安装之后 ,重启了电脑,进入不了图形界面,我每次安装之后都会出现这样情况。
我用deviceQuery 结果显示, driver驱动版本低于cuda驱动。就是显卡驱动还是没有装上。
baidu了几个 下面的方法可以:
http://zhidao.baidu.com/link?url=BMu6HL6mpY6xuUEkyb6dU1XkjX94bX6pyIIlLhmkHiXGEWimf0VyvRu8XRJBrKBOs6XtMSYIZ1PboKXy6ltdj5DDyOxAKciQX4cOw6KarN7
1. 用板载vga安装ubuntu系统,下载最新的nvidia官网驱动(NVIDIA-Linux-x86_64-352.21.run).
2. 禁用开源nouveau驱动:
在/etc/modprobe.d 下创建名为disable-nouveau.conf的文件,内容为:
blacklist nouveau
options nouveau modeset=0
执行: sudo update-initramfs -u 使其生效。
3. 配置kernel以text模式启动:
修改/etc/default/grub文件:
将GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"行改为:GRUB_CMDLINE_LINUX_DEFAULT="quietsplash text"
将GRUB_CMDLINE_LINUX=""行改为:GRUB_CMDLINE_LINUX="rdblacklist=nouveaunouveau.modeset=0"
执行: sudo update-grub 使其生效
4. 重启电脑,在text模式下,终端中执行安装文件
$sh NVIDIA-Linux-x86_64-352.21.run
安装过程中交互的地方一直选择继续.
安装完成之后,将grub中添加的 text 删掉,再执行update-grub,是重启后用图形模式进入系统。
重新安装驱动之后 再deviceQuery:
evice 0: "GeForce GTX 770"
CUDA Driver Version / Runtime Version 7.5 / 7.5
CUDA Capability Major/Minor version number: 3.0
.....
正常了
ubuntu系统,下载最新的nvidia官网驱动(NVIDIA-Linux-x86_64-352.21.run).
2. 禁用开源nouveau驱动:
在/etc/modprobe.d 下创建名为disable-nouveau.conf的文件,内容为:
blacklist nouveau
options nouveau modeset=0
执行: sudo update-initramfs -u 使其生效。
3. 配置kernel以text模式启动:
修改/etc/default/grub文件:
将GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"行改为:GRUB_CMDLINE_LINUX_DEFAULT="quietsplash text"
将GRUB_CMDLINE_LINUX=""行改为:GRUB_CMDLINE_LINUX="rdblacklist=nouveaunouveau.modeset=0"
执行: sudo update-grub 使其生效
4. 重启电脑,在text模式下,终端中执行安装文件
$sh NVIDIA-Linux-x86_64-352.21.run
安装过程中交互的地方一直选择继续.
安装完成之后,将grub中添加的 text 删掉,再执行update-grub,是重启后用图形模式进入系统。
重新安装驱动之后 再deviceQuery:
evice 0: "GeForce GTX 770"
CUDA Driver Version / Runtime Version 7.5 / 7.5
CUDA Capability Major/Minor version number: 3.0
.....
正常了