查看显卡驱动
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 TITAN V Off | 00000000:02:00.0 On | N/A |
| 32% 47C P2 37W / 250W | 367MiB / 12061MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1415 G /usr/lib/xorg/Xorg 18MiB |
| 0 N/A N/A 1559 G /usr/bin/gnome-shell 58MiB |
| 0 N/A N/A 3833 G /usr/lib/xorg/Xorg 148MiB |
| 0 N/A N/A 3967 G /usr/bin/gnome-shell 104MiB |
| 0 N/A N/A 4782 G /usr/lib/firefox/firefox 6MiB |
| 0 N/A N/A 5011 G /usr/lib/firefox/firefox 6MiB |
| 0 N/A N/A 6501 G /usr/lib/firefox/firefox 6MiB |
| 0 N/A N/A 6600 G /usr/lib/firefox/firefox 6MiB |
| 0 N/A N/A 6866 G /usr/lib/firefox/firefox 6MiB |
+-----------------------------------------------------------------------------+
一、先分别下载CUDA CUDNN
选runfile下载 https://developer.nvidia.com/cuda-toolkit-archive
https://developer.nvidia.com/rdp/cudnn-download
二、自己安装显卡驱动,最好是新的
三、在软件包下载存放的目录执行以下命令
1 进入下载好的文件夹,输入:sudo sh cuda_10.1.243_418.87.00_linux.run
然后选择,不安装驱动,其他默认。
2 安装完后,
要配置一下环境。
(1) 打开bashrc文件: sudo gedit ~/.bashrc
(2)添加三条路径:export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
(3)让配置生效:source ~/.bashrc
3 检测是否安装成功
nvcc -V
四 配置CUDNN
1将下载的包解压
2执行以下命令
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.1/lib64/
sudo cp cuda/include/cudnn.h /usr/local/cuda-10.1/include/
# 为所有用户设置读取权限
sudo chmod a+r /usr/local/cuda-10.1/include/cudnn.h sudo chmod a+r /usr/local/cuda-10.1/lib64/libcudnn*