GPU cuda驱动安装

cuda驱动官方下载地址(根据操作系统下载安装):https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=rpmlocal

下载安装cuda仓库环境
wget http://developer.download.nvidia.com/compute/cuda/11.0.1/local_installers/cuda-repo-rhel7-11-0-local-11.0.1_450.36.06-1.x86_64.rpm
sudo rpm -i cuda-repo-rhel7-11-0-local-11.0.1_450.36.06-1.x86_64.rpm
sudo yum clean all

 1、安装dkms

wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/epel/7.2020-04-20/ppc64/Packages/d/dkms-2.6.1-1.el7.noarch.rpm
yum install dkms-2.6.1-1.el7.noarch.rpm

2、安装cuda

sudo yum -y install nvidia-driver-latest-dkms cuda
sudo yum -y install cuda-drivers

3、配置环境变量

[root@localhost ~]# vim /etc/profile
export CUDA_HOME="/usr/local/cuda-11.0"
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

4、启动驱动

450.36.06是NVIDIA的版本号,当你不知道的时候,进入/usr/src目录中,可以看到里面有nvidia文件夹,后缀就是其版本号

dkms install -m nvidia -v 450.36.06

5、检查驱动安装是否正常

如果报错(NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running),检查是否有gpu,系统日志/var/log/messages的报错

[root@localhost ~]# nvidia-smi
Fri Jul  3 15:27:16 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.36.06    Driver Version: 450.36.06    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  Tesla P40           Off  | 00000000:04:00.0 Off |                  Off |
| N/A   20C    P8     9W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla P40           Off  | 00000000:06:00.0 Off |                  Off |
| N/A   25C    P8     9W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   2  Tesla P40           Off  | 00000000:07:00.0 Off |                  Off |
| N/A   20C    P8     9W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   3  Tesla P40           Off  | 00000000:0D:00.0 Off |                  Off |
| N/A   18C    P8     8W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   4  Tesla P40           Off  | 00000000:0E:00.0 Off |                  Off |
| N/A   20C    P8     9W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   5  Tesla P40           Off  | 00000000:0F:00.0 Off |                  Off |
| N/A   20C    P8     8W / 250W |      0MiB / 24451MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

相关连接:https://blog.csdn.net/hangzuxi8764/article/details/86572093

你可能感兴趣的:(linux)