您的位置:首页 > 其它

ubuntu12.04下 cudatoolkit的安装总结

2013-06-14 10:23 267 查看
不说闲话啦,我装这个还是破费周折的。 总结一下:

主要的参考内容就是cuda的在线文档:http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html 

我自己比较注意的步骤如下:

1. 下载 Toolkit  https://developer.nvidia.com/cuda-downloads
2. 保证gcc,支持cuda的GPU 这三个条件都具备。

   2.1 查看gcc版本 

    gcc --version

   2.2 查看显卡型号

 lspci | grep -i nvidia


3. 关闭图形界面

   3.1 切换runlevel   
CTRL +ALT + F1/F2/F3/F4/F5/F6  (F7会回到图形界面)

   3.2  获取root权限  
sudo -s (输入密码)

   3.2 关闭图形界面(X server)

                   方法一: stop lightdm 

                   方法二: service lightdm stop

4. 安装 Toolkit

    4.1 进入Toolkit (“cuda_*.run ”)所在的目录 。(不同版本的Toolkit全称不同,目前的64位的版本是cuda_5.0.35_linux_64_ubuntu11.10-1.run)

   4.2 安装 Toolkit    sh cuda_*.run

         可能会遇到这个问题:

         An NVIDIA kernel module 'nvidia' appears to already be loaded in your

         kernel.  This may be because it is in use (for example, by the X
         server), but may also happen if your kernel was configured without
         support for module unloading.  Please be sure you have exited X
         before attempting to upgrade your driver.  If you have exited X, know
         that your kernel supports module unloading, and still receive this
         message, then an error may have occured that has corrupted the NVIDIA
         kernel module's usage count; the simplest remedy is to reboot your
         computer.

      

        原因一: 可能是没有关闭X server    解决办法:(通过第三步的介绍,可以关闭)

        原因二 : 已有kernel卸载方面的问题,可能会使得usage count 方面出现问题(我比较菜,不太确定)。

           这里我遇到了第二个问题,解决的办法是先卸载驱动,我原来的安装文件还在。可以使用命令来卸载 :

             sh  *.run -uninstall 。(卸载后重启电脑)

           还有一种方法,我这里并没有成功: 

$ sudo apt-get –purge remove nvidia-glx nvidia-glx-new
$ sudo apt-get –purge remove nvidia-settings nvidia-kernel-common

             参考的文章是    :http://blog.163.com/thinki_cao/blog/static/83944875201303125444265/ 

       4.3 回答yse or no  (设置安装路径,我用的是默认的。)

       4.4 进入安装界面 继续回答yes or no 

             1) 接受条款 2) register kernel module 3)安装32位openGL 4)运行NVIDIA x—config

5. 安装成功回到图形化界面

              start lightdm 

      或者 service lightdm start


6. 验证安装的驱动  

glxinfo | grep rendering
或者:
cat /proc/driver/nvidia/version


7. 配置路径 

   
gedit ~/.bashrc   

    在文章末尾追加:

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

   64位:
   export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib:$LD_LIBRARY_PATH

   32位:

   export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib:/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH

8.安装其他需要的包

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

9.编译Samples 这里面的例子很棒的

进入~/NVIDIA_CUDA-5.0_Samples/C 下
make.结果在 ~/NVIDIA_CUDA-5.0_Samples/C/bin
9552
/linux/release.

10 运行DeviceQuery

进入~/NVIDIA_CUDA-5.0_Samples/C/bin/linux/release

运行 deviceQuery
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Ubuntu NVIDIA Toolkit