- 去英伟达官网下载合适的CUDA,如果官网只提供了最新版,可以使用谷歌搜索CUDA Toolkit x.x进入官网下载
- 赋予下载文件运行权限
chmod a+x cuda_10.0.130_410.48_linux.run
- 安装
./cuda_10.0.130_410.48_linux.run
1. 会先有个阅读声明,需要输入accept
2. 一直按↓,选择install安装
3. 安装过程结束后会有以下信息:
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-10.0
Samples: Not Selected
Please make sure that
- PATH includes /usr/local/cuda-10.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/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 384.00 is required for CUDA 10.0 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 /tmp/cuda_install_11482.log
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 将cuda的bin文件和lib导出到系统环境中,注意更换其中的cuda-x.x
export PATH="/usr/local/cuda-10.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH"
或者
vi ~/.bashrc
export PATH="/usr/local/cuda-10.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH"
source ~/.bashrc
- 测试:如果下面测试的最后结果都是Result = PASS,说明CUDA安装成功啦。
1)如果成功会输出版本信息nvcc –V
2)编译并测试设备 deviceQuery:cd /usr/local/cuda-9.2/samples/1_Utilities/deviceQuery
make
./deviceQuery
3)编译并测试带宽 bandwidthTest:cd ../bandwidthTest
make
./bandwidthTest
- 所需的libcudart.so.8.0如果正确安装的话,以下两种方法同理:
1)ldconfig /usr/local/cuda-8.0/lib64
2)export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64
3)如果仍然不行,再尝试执行:export PATH=\$PATH:/usr/local/cuda-8.0/bin
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-8.0/lib64
source /etc/profile
此时会显示/sbin/ldconfig.real: /usr/local/cuda-8.0/lib64/libcudnn.so.6
不是符号连接。不用担心,这时已经解决问题了。