您的位置:首页 > 其它

Ubuntu 14.04 64bit + CUDA 6.5 配置说明

2015-01-29 01:14 447 查看
纠结了三四天,在网上搜各种资料以及尝试后,在重装了不下10遍的ubuntu下,终于在ubuntu14.04 64bit配置成功了CUDA6.5,先说明在配置过程中,参照网上的博客及安装方法出现的问题:

1,在如下命令行下参看自己的显卡驱动,只显示了一个intel的集成显卡,并没有显示nvidia的显卡,在查阅了一些资料后,发现在较高版本的GETFORCE系列,至少在700+以上,我的是GETFORCE 840M,nvidia显卡是当做3D的加速器在对待了,这个不影响安装过程,所以只要你确定你的电脑拥有支持cuda的nvidia显卡,就不用管这个了。

<span style="font-size:12px;">~$ lspci|grep VGA</span>


2,在安装完cuda6.5包里面的nvidia显卡驱动后,重启后,ubuntu的桌面一片空白或者无法进入Xwindows,这个问题困扰了我将近2天,最终解决了,解决思路是不再重装包含在cuda6.5里面的nvidia显卡驱动,具体解决方案参看具体步骤。

安装过程如下:

准备工作:在NVIDIA官网上下载最新版的cuda 6.5,新版的cuda包含了三个文件:cuda-toolkit、cudaSDK以及nvidia driver,下面是我下载时的下载链接:http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.14_linux_64.run

1,安装显卡驱动

1)在Crtl+Alt+T的控制台下,编辑blacklist.conf。

<span style="font-size:12px;">sudo gedit /etc/modprobe.d/blacklist.conf</span>
在最后面添加以下部分并保存:

<span style="font-size:12px;">blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

</span>
注意最后一行要留出一行空格来

2)删除之前所安装的nVidia驱动。

<span style="font-size:12px;">sudo apt-get remove --purge nvidia-*
sudo apt-get remove --purge xserver-xorg-video-nouveau</span>
3)重启电脑后 按Ctrl + Alt +F1到进入tty,(Ctrl + Alt +F7是回到xservers)。

4)登录tty后输入用户名和密码后,登录后执行(数字不能用小键盘输入),关闭集成显卡:

<span style="font-size:12px;">sudo service lightdm stop</span>
5)输入下列命令添加驱动源

<span style="font-size:12px;">sudo add-apt-repository ppa:xorg-edgers/ppa  //sudo add-apt-repository remove ppa:xorg-edgers/ppa
sudo apt-get update</span>
安装340版驱动 (CUDA 6.5.14目前最高仅支持340版驱动, 343, 346版驱动暂不支持)

<span style="font-size:12px;">sudo apt-get install nvidia-340</span>
安装完成后, 继续安装下列包 (否则在运行sample时会报错)

<span style="font-size:12px;">sudo apt-get install nvidia-340-uvm</span>
安装完成后 重启reboot.

2,安装cuda

1)将下载的cuda_6.5.14_linux_64.run放在一个文件夹,我是放在home下的download文件下

然后通过下列命令, 将下载得到的.run文件解压成三个文件, 分别为

CUDA安装包: cuda-linux64-rel-6.5.14-18749181.run

NVIDIA驱动: NVIDIA-Linux-x86_64-340.29.run

SAMPLE包: cuda-samples-linux-6.5.14-18745345.run

这里不安装NVIDIA驱动

<span style="font-size:12px;">sudo sh cuda*.run --noexec --target . </span>
解压到当前目录下(注意target后面有一个点),解压后的三个安装包在目录下run_files文件夹下


2) 安装CUDA

通过下列命令安装CUDA, 按照说明一步一步安装至完成.

<span style="font-size:12px;">sudo ./cuda-linux64-rel-6.5.14-18749181.run</span>
2.1 添加环境变量[/code]

安装完成后需要在/etc/profile中添加环境变量,

<span style="font-size:12px;">sudo gedit /etc/profile</span>


<span style="background-color: rgb(244, 244, 244); font-family: verdana, 微软雅黑, 'ms song', 宋体, Arial, Helvetica, sans-serif; "><span style="font-size:12px;">在文件最后添加:</span></span>

<span style="font-size:12px;">PATH=/usr/local/cuda-6.5/bin:$PATH
export PATH</span>
保存后, 执行下列命令, 使环境变量立即生效[/code]

<span style="font-size:12px;">source /etc/profile</span>
2.2 添加lib库路径[/code]

在 /etc/ld.so.conf.d/新建文件 cuda.conf,并编辑

<span style="font-size:12px;">cd /etc/ld.so.conf.d
sudo touch cuda.conf
sudo gedit cuda.conf </span>


内容如下:

<span style="font-size:12px;">/usr/local/cuda-6.5/lib64</span>


执行下列命令使之立刻生效

<span style="font-size:12px;">sudo ldconfig</span>

[/code]3) 安装CUDA SAMPLE

首先安装下列依赖包

<span style="font-size:12px;">sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev</span>


然后进入run_files目录下,用下述命令安装sample文件

<span style="font-size:12px;">sudo ./cuda-samples-linux-6.5.14-18745345.run</span>


完成后编译Sample文件, 整个过程大概10分钟左右

<span style="font-size:12px;">cd /usr/local/cuda-6.5/samples
sudo make</span>


全部编译完成后, 进入 samples/bin/x86_64/linux/release, sudo下运行deviceQuery

<span style="font-size:12px;">sudo ./deviceQuery</span>


如果出现下列显卡信息, 则驱动及显卡安装成功:(截图截的别人的)

<span style="font-size:12px;">./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 670"
CUDA Driver Version / Runtime Version          6.5 / 6.5
CUDA Capability Major/Minor version number:    3.0
Total amount of global memory:                 4095 MBytes (4294246400 bytes)
( 7) Multiprocessors, (192) CUDA Cores/MP:     1344 CUDA Cores
GPU Clock rate:                                1098 MHz (1.10 GHz)
Memory Clock rate:                             3105 Mhz
Memory Bus Width:                              256-bit
L2 Cache Size:                                 524288 bytes
Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
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: 65536
Warp size:                                     32
Maximum number of threads per multiprocessor:  2048
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): (2147483647, 65535, 65535)
Maximum memory pitch:                          2147483647 bytes
Texture alignment:                             512 bytes
Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
Run time limit on kernels:                     Yes
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 Bus ID / PCI location ID:           1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GTX 670
Result = PASS</span>
这样cuda6.5就完成了[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: