Ubuntu14.04和Centos6.7安装CUDA(Nvidia)

1、安装前的准备工作

system has a CUDA-capable GPU.

            命令:lspci | grep -i nvidia

Verify the system is running a supportedversion of Linux.

        命令:uname -m && cat /etc/*release

Verify the system has gcc installed.

       命令:gcc --version

Verify the system has the correct kernelheaders and development packages installed.

       命令:sado yum install kernel-devel-$(uname -r) kernel-headers-$(uname-r)#/Centossudo apt-get install linux-headers-$(uname-r) #Ubuntu

Download the NVIDIA CUDA Toolkit.

       http://developer.nvidia.com/cuda-downloads

Handle conflicting installation methods.

      命令: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 # Ubuntu

       命令:$sudo yum remove # Redhat/CentOS

2、库文件需要下载

需要DKMS libvdpau等等,但所有的库文件都在epel第三方文件库里面

解决之道:Download the latest epel-release rpm from  :                    http://dl.fedoraproject.org/pub/epel/6/x86_64/

Install epel-release rpm:  # rpm -Uvh epel-release*rpm这个必须在库里面找到并安装!!!!

Install libvdpau rpm package:  # yum install libvdpau这儿可以不安装,安装cuda时让其自动安装就行。

3、xorg.conf文件问题

解决之道:如果在/etc/X11/下没有这个文件,那就不用管了。如果有的话,那需要手动处理一下。但是这种东西最好不要手动处理,咱们只安装驱动,不用nvidia显示,所以等安装好cuda之后,进入该目录下,一定删除xorg.conf,要不然无法显示(centos6环境下)。而ubuntu环境下不用处理,顺其自然。

4、开始安装

             首先sudo rpm -ivh --forcecuda-repo--..rpm必须强行安装!

              然后sudo yum clean expire-cache清除Yum repository cachei

              最后sudo yum install cuda

              以上过程必须在连网下进行。

5、配置环境变量.bashrc

        $ export PATH=/usr/local/cuda-6.5/bin:$PATH

        $export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH

6、检验安装正确与否

         查看nvcc编译器的版本nvcc -V i

        进入/usr/local/cuda-7*/bin/$ cuda-install-samples-6.5.sh

        编译cuda的示例代码: cd ~/NVIDIA_CUDA-6.5_Samples然后make一下编译代码。

       进入bin路径运行devicequerycd~/NVIDIA_CUDA-6.5_Samples/bin./deviceQuery

注意:centos在安好系统更新系统后安装;而ubuntu14.04必须在不更新前安装!!!切忌切忌切忌

英文安装说明:http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#package-manager-installation

中文学习教程:http://www.nvidia.cn/object/cuda_education_cn_old.html#1

你可能感兴趣的:(Ubuntu14.04和Centos6.7安装CUDA(Nvidia))