linux 安装 cuda
1. 访问 https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=RHEL&target_version=7&target_type=runfilelocal
下载 cuda_10.2.89_440.33.01_linux.run
2. 执行安装命令
1 2 |
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run sudo sh cuda_10.2.89_440.33.01_linux.run |
需要注意,先输入accept,然后去掉驱动前的 [X],只装 CUDA Toolkit。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@localhost ~]# sh cuda_10.2.89_440.33.01_linux.run =========== = Summary = =========== Driver: Not Selected Toolkit: Installed in /usr/local/cuda-10.2/ Samples: Installed in /root/, but missing recommended libraries Please make sure that - PATH includes /usr/local/cuda-10.2/bin - LD_LIBRARY_PATH includes /usr/local/cuda-10.2/lib64, or, add /usr/local/cuda-10.2/lib64 to /etc/ld.so.conf and run ldconfig as root To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-10.2/bin Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.2/doc/pdf for detailed information on setting up CUDA. ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 440.00 is required for CUDA 10.2 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file: sudo <CudaInstaller>.run --silent --driver Logfile is /var/log/cuda-installer.log [root@localhost ~]# echo 'export PATH=/usr/local/cuda-10.2/bin:$PATH' >> /etc/profile.d/cuda-10.0.sh [root@localhost ~]# echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH' >> /etc/profile.d/cuda-10.0.sh [root@localhost ~]# [root@localhost ~]# source /etc/profile.d/cuda-10.0.sh |
配置完环境变量后
(1). 终端输入:
1 |
nvcc -V |
如果有CUDA的版本信息代表正常。
(2). 编译samples例子
#编译并测试设备 deviceQuery:
1 2 3 |
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery sudo make ./deviceQuery |
#编译并测试带宽 bandwidthTest:
1 2 3 |
cd …/bandwidthTest sudo make ./bandwidthTest |
如果这两个测试的最后结果都是Result = PASS,说明CUDA安装成功啦。
安装cudnn
1. 访问这里下载对应版本的cudnn
2. RPM包安装 安装说明在这里
安装过程
1) 下载 libcudnn*.rpm 包到本地。
2) 安装 rpm 包,安装 cuDNN 库文件.
1 2 3 |
rpm -ivh libcudnn8-*.x86_64.rpm rpm -ivh libcudnn8-devel-*.x86_64.rpm rpm -ivh libcudnn8-samples-*.x86_64.rpm |
3.验证安装
1)拷贝样例程序
1 |
$cp -r /usr/src/cudnn_samples_v8/ $HOME |
2)进入程序目录
1 |
$ cd $HOME/cudnn_samples_v8/mnistCUDNN |
3)编译 mnistCUDNN sample.
1 |
$make clean && make |
4. 运行
1 |
$ ./mnistCUDNN |
看到 Test passed! 输出表示安装成功。
分类: linux