Centos7离线安装nvidia驱动的两种方法

  • 方法1 在nvida官网下载对应的驱动安装
  • 方法2 直接安装cuda,安装过程中cuda会自动安装对应的nvida驱动(推荐)

方法1

1.首先查看机器是否具有GPU

[javis@node5 rpm_resource]$ lspci | grep -i nvidia
06:00.0 3D controller: NVIDIA Corporation GP100GL (rev a1)
81:00.0 3D controller: NVIDIA Corporation GP100GL (rev a1)

2.在官网下载对应的驱动http://www.nvidia.cn/Download/index.aspx?lang=cn
Centos7离线安装nvidia驱动的两种方法_第1张图片
然后跳转到下载页面,下载 nvidia-diag-driver-local-repo-rhel7-390.30-1.0-1.x86_64.rpm
Centos7离线安装nvidia驱动的两种方法_第2张图片
(PS:注意下面红色的框内是安装步骤,安装后可以使用nvidia-smi命令)

3.安装步骤建议使用官方的

Once you accept the download please follow the steps listed below 

i) `rpm -i nvidia-diag-driver-local-repo-rhel7-390.30-1.0-1.x86_64.rpm' 
ii) `yum clean all`
iii) `yum install cuda-drivers` 
iv) `reboot`

但这里安装的时候可能会遇到

Error: Package: 1:nvidia-kmod-390.30-2.el7.x86_64 (nvidia-diag-driver-local-390.30)Requires: dkms

下载安装dkms-2.2.0.3-31.1.noarch.rpm即可解决问题

sudo rpm -vih dkms-2.2.0.3-31.1.noarch.rpm

4.测试是否安装成功

[javis@node5 cuda_example]$ nvidia-smi
Thu Mar  1 09:03:20 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 387.26                 Driver Version: 387.26                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla P100-PCIE...  Off  | 00000000:06:00.0 Off |                    0 |
| N/A   28C    P0    29W / 250W |      0MiB / 16276MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  Tesla P100-PCIE...  Off  | 00000000:81:00.0 Off |                    0 |
| N/A   26C    P0    27W / 250W |      0MiB / 16276MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

方法2

下载对应版本的cuda:https://developer.nvidia.com/cuda-downloads
比如我下载的为Centos7版本的RPM包,下载后直接安装

sudo rpm -i cuda-repo-rhel7-10-2-local-10.2.89-440.33.01-1.0-1.x86_64.rpm

安装cuda的时候会自动安装nvidia驱动,控制台信息:

Installing the NVIDIA display driver...
Installing the CUDA Toolkit in /usr/local/cuda-9.1 ...

cudann安装

下载地址:https://developer.nvidia.com/rdp/cudnn-archive

解压cudann.tgz包后后运行:
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

你可能感兴趣的:(随笔,杂类)