GPU计算力分析
https://blog.csdn.net/iefenghao/article/details/97956440?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight
Table 2. CUDA Toolkit and Minimum Compatible Driver Versions
CUDA Toolkit | Linux x86_64 Driver Version | Windows x86_64 Driver Version |
---|---|---|
CUDA 11.2.1 Update 1 | >=460.32.03 | >=461.09 |
CUDA 11.2.0 GA | >=460.27.03 | >=460.82 |
CUDA 11.1.1 Update 1 | >=455.32 | >=456.81 |
CUDA 11.1 GA | >=455.23 | >=456.38 |
CUDA 11.0.3 Update 1 | >= 450.51.06 | >= 451.82 |
CUDA 11.0.2 GA | >= 450.51.05 | >= 451.48 |
CUDA 11.0.1 RC | >= 450.36.06 | >= 451.22 |
CUDA 10.2.89 | >= 440.33 | >= 441.22 |
CUDA 10.1 (10.1.105 general release, and updates) | >= 418.39 | >= 418.96 |
CUDA 10.0.130 | >= 410.48 | >= 411.31 |
CUDA 9.2 (9.2.148 Update 1) | >= 396.37 | >= 398.26 |
CUDA 9.2 (9.2.88) | >= 396.26 | >= 397.44 |
CUDA 9.1 (9.1.85) | >= 390.46 | >= 391.29 |
CUDA 9.0 (9.0.76) | >= 384.81 | >= 385.54 |
CUDA 8.0 (8.0.61 GA2) | >= 375.26 | >= 376.51 |
CUDA 8.0 (8.0.44) | >= 367.48 | >= 369.30 |
CUDA 7.5 (7.5.16) | >= 352.31 | >= 353.66 |
CUDA 7.0 (7.0.28) | >= 346.46 | >= 347.62 |
1、NVidia显示驱动安装:
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
GPU显示驱动安装:
在docker终端输入ubuntu-drivers devices,查看显卡配置信息,正常显示如下:
root@e25881d8e29d:/# ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001F36sv0000103Csd0000860Fbc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-driver-450-server - distro non-free
driver : nvidia-driver-440-server - distro non-free
driver : nvidia-driver-460 - distro non-free recommended
driver : nvidia-driver-450 - distro non-free
driver : nvidia-driver-418-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
== /sys/devices/pci0000:00/0000:00:1d.5/0000:70:00.0 ==
modalias : pci:v00008086d00002723sv00008086sd00000088bc02sc80i00
vendor : Intel Corporation
driver : backport-iwlwifi-dkms - distro free
如果提示
bash: ubutnu-drivers: command not found
,则安装:sudo apt-get install ubuntu-drivers-common
安装显卡驱动:
sudo ./NVIDIA-Linux-x86_64-460.39.run -no-x-check -no-nouveau-check -no-opengl-files //只有禁用opengl这样安装才不会出现循环登陆的问题 Ubuntu 16.04安装NVIDIA驱动后导致的循环登录问题
-no-x-check:安装驱动时关闭X服务
-no-nouveau-check:安装驱动时禁用nouveau
-no-opengl-files:只安装驱动文件,不安装OpenGL文件
或者
sudo apt-get install nvidia-driver-460 (460.32)
查看驱动版本:cat /proc/driver/nvidia/version
root@e25881d8e29d:/workspace# cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 450.102.04 Tue Dec 29 06:51:23 UTC 2020
GCC version: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
卸载GPU驱动:
sudo apt-get purge nvidia*
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-get install nvidia-415 nvidia-settings nvidia-prime
nvidia-smi
2、Cuda安装
ls /dev/nvidia*,显示如下:
/dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia-uvm-tools /dev/nvidia0 /dev/nvidiactl
/dev/nvidia-caps:
nvidia-cap1 nvidia-cap2
CUDA版本下载链接:https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu1804/x86_64/
先下载与显卡驱动版本对应的CUDA包:
dpkg -i cuda-repo-ubuntu1804-11-2-local_11.2.1-460.32.03-1_amd64.deb,存入当前目录
#install CUDA
sudo dpkg -i sudo dpkg -i cuda-repo-ubuntu1804-11-2-local_11.2.1-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
安装完之后,需要设置环境变量
sudo gedit ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda/lib
export PATH=$PATH:/usr/local/cuda/bin
然后,输入以下命令使配置的环境变量立即生效:
source ~/.bashrc
查看当前cuda是否成功安装
nvcc -V
root@e25881d8e29d:/usr/local/cuda-10.2/lib64# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
出现以上信息,说明cuda10.2即已安装完成。
3.CUDNN安装
先下载好包libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb要本地目录
sudo dpkg -i libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb
碰到一个问题:先安装好GPU显卡,然后再装CUDA,CUDNN,重启下显卡驱动直接掉了,需要再次安装GPU显卡,nvidia-smi显示460.39,一切正常!