安装开发所需要的一些基本包
sudo apt-get install build-essential
在关闭桌面管理 lightdm 的情况下安装驱动似乎可以实现Intel 核芯显卡 来显示 + NVIDIA 显卡来计算。
具体步骤如下:
1. 进入Ubuntu, 按 ctrl+alt+F1 进入tty, 登录tty后输入如下命令
sudo service lightdm stop
该命令会关闭lightdm。如果你使用 gdm或者其他的desktop manager 请在安装NVIDIA驱动前关闭他。
2. 屏蔽cpu集显
sudo vim /etc/modprobe.d/blacklist.conf
添加以下内容:
vga16fb
nouveau
rivafb
nvidiafb
rivatv
下载与计算机显卡匹配的驱动源<文件名>.run
sudo sh ./<文件>.run
下载CUDA 6.5.
然后通过下列命令, 将下载得到的.run文件解压成三个文件, 分别为
这里不安装NVIDIA驱动
cuda6.5.run --extract=extract_path
注意, 需要通过下面命令给所有.run文件可执行权限
chmod +x *.run
通过下列命令安装CUDA, 按照说明一步一步安装至完成.
sudo ./cuda-linux64-rel-6.5.14-18749181.run
3.1.1 添加环境变量
安装完成后需要在/etc/profile中添加环境变量, 在文件最后添加:
PATH=/usr/local/cuda-6.5/bin:$PATH export PATH
保存后, 执行下列命令, 使环境变量立即生效
source /etc/profile
3.1.2 添加lib库路径
在 /etc/ld.so.conf.d/加入文件 cuda.conf, 内容如下
/usr/local/cuda-6.5/lib64
执行下列命令使之立刻生效
sudo ldconfig
首先安装下列依赖包
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev
然后用下述命令安装sample文件
sudo ./cuda-samples-linux-6.5.14-18745345.run
完成后编译Sample文件, 整个过程大概10分钟左右
cd /usr/local/cuda-6.5/samples sudo make
全部编译完成后, 进入 samples/bin/x86_64/linux/release, sudo下运行deviceQuery
sudo ./deviceQuery
如果出现下列显卡信息, 则驱动及显卡安装成功:
./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