(CentOS 7)nvidia-smi:Failed to initialize NVML: Driver/library version mismatch

[CentOS 7]nvidia-smi:Failed to initialize NVML: Driver/library version mismatch

这里仅描述自身发现的一种情况,希望对大家有所帮助。

问题源头: nvidia-smi \text{nvidia-smi} nvidia-smi报错问题

服务器系统版本: CentOS 7 \text{CentOS 7} CentOS 7
在查看显卡驱动版本信息时出错:

nvidia-smi

Failed to initialize NVML: Driver/library version mismatch

首先查看当前环境显卡驱动使用的内核版本:

cat /proc/driver/nvidia/version

返回结果:
其中 440.118.02 \text{440.118.02} 440.118.02是显卡驱动版本; 4.8.5 \text{4.8.5} 4.8.5表示 GCC \text{GCC} GCC编译器版本。

NVRM version: NVIDIA UNIX x86_64 Kernel Module  440.118.02  Thu Sep  3 09:54:46 UTC 2020
GCC version:  gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 

再查看 CUDA \text{CUDA} CUDA版本:

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

我们事先知道 440.118.02 \text{440.118.02} 440.118.02兼容 10.2 \text{10.2} 10.2 CUDA \text{CUDA} CUDA版本,因而不会是 CUDA \text{CUDA} CUDA自身版本的错误。

执行如下指令:

dmesg | grep NVRM

返回结果

[ ***] NVRM: API mismatch: the client has the version 440.33.01, but
NVRM: this kernel module has the version 440.118.02. Please
NVRM: make sure that this kernel module and all NVIDIA driver
NVRM: components have the same version.

其表示 CUDA \text{CUDA} CUDA内部基于的显卡驱动版本 440.33.01 \text{440.33.01} 440.33.01当前环境中的显卡驱动版本 440.118.02 \text{440.118.02} 440.118.02不匹配。
这里我建议如果已经装好显卡驱动的,尽量不要删了重新装,非常麻烦。这里介绍的是重新安装 CUDA \text{CUDA} CUDA的版本。

CUDA \text{CUDA} CUDA安装时的问题

CUDA \text{CUDA} CUDA官方下载路径:
https://developer.nvidia.com/cuda-toolkit-archive
打开后,这里选择 10.2 10.2 10.2版本,并按照自身系统条件进行选择。

这里服务器系统版本是 CentOS 7 \text{CentOS 7} CentOS 7,这里对应的安装指令表示如下:

wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run

从该路径的名称可以看出,该版本号10.2.89 CUDA \text{CUDA} CUDA被设定了唯一的显卡驱动版本——440.33.01

作为小白,可能会存在这样一种误区:可以将我们的显卡驱动版本440.118.02升级到440.33.01

通过指令查询当前服务器的显卡信息:

lspci | grep -i nvidia

返回结果如下,是 2 2 2 GeForce RTX 2080Ti \text{GeForce RTX 2080Ti} GeForce RTX 2080Ti显卡。

17:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti Rev. A] (rev a1)
17:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
17:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host Controller (rev a1)
17:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller (rev a1)
65:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti Rev. A] (rev a1)
65:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
65:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host Controller (rev a1)
65:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 USB Type-C UCSI Controller (rev a1)

Nvidia \text{Nvidia} Nvidia各显卡驱动版本查询路径:
https://www.nvidia.com/Download/Find.aspx?lang=en-us
将我们的显卡型号输入,查找是否存在440.33.01版本。最后结果是显而易见的:没有找到

最终我在特斯拉公司 Tesla T4 \text{Tesla T4} Tesla T4中找到了该版本:
示例
这说明: 440.33.01 \text{440.33.01} 440.33.01根本就不是 GeForce \text{GeForce} GeForce显卡的版本号
那么 GeForce \text{GeForce} GeForce的显卡驱动就不能用 CUDA=10.2 \text{CUDA=10.2} CUDA=10.2版本吗 ? ? ?自然可以用的。那么我们在安装 CUDA \text{CUDA} CUDA的时候就需要注意这个事项。

关于 CUDA \text{CUDA} CUDA安装请参考:
centos卸载cuda与安装 - 简书

重点在于:在安装 CUDA \text{CUDA} CUDA的过程中,需要将 Driver \text{Driver} Driver的项去除
需要注意的是:[X]表示被选定的意思(有点坑)。而我们要选择[ ]。

Cuda安装过程
Cuda安装过程2
在安装结束之后,我们再次执行dmesg | grep NVRM。返回结果:

[***] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  440.118.02  Thu Sep  3 09:54:46 UTC 2020

不再报版本冲突的错误了。
最终观察nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.118.02   Driver Version: 440.118.02   CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:17:00.0 Off |                  N/A |
| 36%   64C    P0    81W / 300W |      0MiB / 11019MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:65:00.0 Off |                  N/A |
| 62%   72C    P0    48W / 300W |      0MiB / 11016MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

静静的喝酒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值