Ubuntu14.04安装cuda (GTX780)

来源:互联网 发布:淘宝女装店铺介绍模板 编辑:程序博客网 时间:2024/06/06 09:42
系统是ubuntu14.04, 显卡 gtx-780

1. 安装开发所需要的一些基本包

sudo apt-get install build-essential

2. 安装NVIDIA驱动 (352)

2 安装驱动

输入下列命令添加驱动源

sudo add-apt-repository ppa:xorg-edgers/ppasudo apt-get update

安装352版驱动

sudo apt-get install nvidia-352

安装完成后 reboot.

检测一下装好了没:

$glxinfo | grep rendering

direct rendering: Yes

    GL_NV_path_rendering, GL_NV_pixel_data_range, GL_NV_point_sprite, 

    GL_NV_path_rendering, GL_NV_pixel_data_range, GL_NV_point_sprite, 


3. 安装CUDA 6.5

 下载CUDA 6.5. 

然后通过下列命令, 

$./cuda6.5XXX.run --extract=extract_path

将下载得到的.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


ll一下,如果没有可执行权限, 需要通过下面命令给所有.run文件可执行权限

$chmod +x *.run

 

3.1 安装CUDA

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

sudo ./cuda-linux64-rel-6.5.14-18749181.run

3.1.1 添加环境变量

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

3.1.2 添加lib库路径

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

 

3.2 安装CUDA SAMPLE

首先安装下列依赖包

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/samplessudo make
 会出现错误:


"/usr/local/cuda-6.5"/bin/nvcc -ccbin g++ -I../../common/inc  
-m64     -gencode arch=compute_11,code=compute_11 -o cudaProcessFrame.o 
-c cudaProcessFrame.cpp
nvcc warning : The 'compute_11', 
'compute_12', 'compute_13', 'sm_11', 'sm_12', and 'sm_13' architectures 
are deprecated, and may be removed in a future release.
"/usr/local/cuda-6.5"/bin/nvcc
 -ccbin g++ -I../../common/inc  -m64     -gencode 
arch=compute_11,code=compute_11 -o videoDecodeGL.o -c videoDecodeGL.cpp
nvcc
 warning : The 'compute_11', 'compute_12', 'compute_13', 'sm_11', 
'sm_12', and 'sm_13' architectures are deprecated, and may be removed in
 a future release.
"/usr/local/cuda-6.5"/bin/nvcc -ccbin g++   
-m64       -gencode arch=compute_11,code=compute_11 -o cudaDecodeGL 
FrameQueue.o ImageGL.o VideoDecoder.o VideoParser.o VideoSource.o 
cudaModuleMgr.o cudaProcessFrame.o videoDecodeGL.o  
-L../../common/lib/linux/x86_64 -L/usr/lib/"nvidia-340" -lGL -lGLU -lX11 -lXi -lXmu -lglut -lGLEW -lcuda -lcudart -lnvcuvid
nvcc
 warning : The 'compute_11', 'compute_12', 'compute_13', 'sm_11', 
'sm_12', and 'sm_13' architectures are deprecated, and may be removed in
 a future release.
/usr/bin/ld: cannot find -lnvcuvid
collect2: error: ld returned 1 exit status
make[1]: *** [cudaDecodeGL] 错误 1
因为我们用的是nvidia-352.


$cd /usr/local/cuda-6.5/samples


$grep "nvidia-340" -r ./


将 UBUNTU_PKG_NAME = "nvidia-340" 换成UBUNTU_PKG_NAME = "nvidia-352"

 
$sudo sed -i "s/nvidia-340/nvidia-352/g" `grep nvidia-340 -rl .`

 接着$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 780"

  CUDA Driver Version / Runtime Version          7.5 / 6.5

  CUDA Capability Major/Minor version number:    3.5

  Total amount of global memory:                 3071 MBytes (3220504576 bytes)

  (12) Multiprocessors, (192) CUDA Cores/MP:     2304 CUDA Cores

  GPU Clock rate:                                941 MHz (0.94 GHz)

  Memory Clock rate:                             3004 Mhz

  Memory Bus Width:                              384-bit

  L2 Cache Size:                                 1572864 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:           3 / 0

  Compute Mode:

     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >


deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GTX 780

Result = PASS


0 0
原创粉丝点击