sudo apt-get install build-essential
具體步驟如下:
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
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驅動
cuda6.5.run --extract=extract_path注意, 需要通過下面命令給所有.run文件可執行權限
chmod +x *.run
sudo ./cuda-linux64-rel-6.5.14-18749181.run3.1.1 添加環境變量
安裝完成後需要在/etc/profile中添加環境變量, 在文件最後添加:
PATH=/usr/local/cuda-6.5/bin:$PATH export PATH保存後, 執行下列命令, 使環境變量立即生效
source /etc/profile3.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