安装cuda-8.0

来源:互联网 发布:淘宝宝贝首图优化 编辑:程序博客网 时间:2024/06/02 01:25

下载安装文件

CUDA下载地址

如果找不到对应的版本,可以前往历史发行版本中浏览,地址如下:CUDA历史发行版

准备安装文件

把cuda_8.0.61_375.26_linux.run安装文件移动至当前用户根目录下

开始安装

sudo ~/cuda_8.0.61_375.26_linux.run

在安装界面中,可参照下面的描述进行选择

Do you accept the previously read EULA?accept/decline/quit: acceptInstall NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?(y)es/(n)o/(q)uit: nInstall the CUDA 8.0 Toolkit?(y)es/(n)o/(q)uit: yEnter Toolkit Location [ default is /usr/local/cuda-8.0 ]:Do you want to install a symbolic link at /usr/local/cuda?(y)es/(n)o/(q)uit: nInstall the CUDA 8.0 Samples?(y)es/(n)o/(q)uit: n

添加环境变量

安装结束后,在管理员用户根目录下,找到.bashrc文件并打开,在最后添加下面三行文本,保存退出即可

# added by cuda_8.0 installerexport PATH="/usr/local/cuda-8.0/bin:$PATH"export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH"

检测cuda是否安装成功

检测方案A:重启终端后,执行nvcc -V,若显示以下信息,则安装cuda成功

nvcc: NVIDIA (R) Cuda compiler driverCopyright (c) 2005-2016 NVIDIA CorporationBuilt on Tue_Jan_10_13:22:03_CST_2017Cuda compilation tools, release 8.0, V8.0.61

检测方案B:依次输入以下命令,测试cuda的执行结果

cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuerysudo make./deviceQuery

示例显示信息如下

CUDA Device Query (Runtime API) version (CUDART static linking)Detected 1 CUDA Capable device(s)Device 0: "GeForce GTX 1080"  CUDA Driver Version / Runtime Version          9.0 / 8.0  CUDA Capability Major/Minor version number:    6.1  Total amount of global memory:                 8112 MBytes (8506048512 bytes)  (20) Multiprocessors, (128) CUDA Cores/MP:     2560 CUDA Cores  GPU Max Clock rate:                            1734 MHz (1.73 GHz)  Memory Clock rate:                             5005 Mhz  Memory Bus Width:                              256-bit  L2 Cache Size:                                 2097152 bytes  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 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 2 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 Domain ID / Bus ID / location ID:   0 / 1 / 0  Compute Mode:     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 1080Result = PASS

若最后显示Result = PASS,表明cuda查询显卡信息成功

最后执行sudo make clean清除垃圾文件,并重启终端

原创粉丝点击