How to get the nvidia driver version from the command line?

匿名 (未验证) 提交于 2019-12-03 02:44:02

问题:

For debugging CUDA code and checking compatibilities I need to find out what nvidia driver version for the GPU I have installed. I found How to get the cuda version? but that does not help me here.

回答1:

Using nvidia-smi should tell you that:

bwood@mybox:~$ nvidia-smi  Mon Oct 29 12:30:02 2012        +------------------------------------------------------+                        | NVIDIA-SMI 3.295.41   Driver Version: 295.41         |                        |-------------------------------+----------------------+----------------------+ | Nb.  Name                     | Bus Id        Disp.  | Volatile ECC SB / DB | | Fan   Temp   Power Usage /Cap | Memory Usage         | GPU Util. Compute M. | |===============================+======================+======================| | 0.  GeForce GTX 580           | 0000:25:00.0  N/A    |       N/A        N/A | |  54%   70 C  N/A   N/A /  N/A |  25%  383MB / 1535MB |  N/A      Default    | |-------------------------------+----------------------+----------------------| | Compute processes:                                               GPU Memory | |  GPU  PID     Process name                                       Usage      | |=============================================================================| |  0.           Not Supported                                                 | +-----------------------------------------------------------------------------+ 


回答2:

On any linux system with the NVIDIA driver installed and loaded into the kernel, you can execute:

cat /proc/driver/nvidia/version 

to get the version of the currently loaded NVIDIA kernel module, for example:

$ cat /proc/driver/nvidia/version  NVRM version: NVIDIA UNIX x86_64 Kernel Module  304.54  Sat Sep 29 00:05:49 PDT 2012 GCC version:  gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)  


回答3:

modinfo does the trick.

root@nyx:/usr/src# modinfo nvidia|grep version: version:        331.113 


回答4:

[NOTE: I am not deleting my answer on purpose, so people see how not to do it]

If you use:

me@over_there:~$  dpkg --status nvidia-current | grep Version | cut -f 1 -d '-' | sed 's/[^.,0-9]//g' 260.19.06 

you will get the version of the nVIDIA driver package installed through your distribution's packaging mechanism. But this may not be the version that is actually running as part of your kernel right now.



回答5:

Windows version:

cd \Program Files\NVIDIA Corporation\NVSMI

nvidia-smi



回答6:

If you need to get that in a program with Python on a Linux system for reproducibility:

with open('/proc/driver/nvidia/version') as f:     version = f.read().strip() print(version) 

gives:

NVRM version: NVIDIA UNIX x86_64 Kernel Module  384.90  Tue Sep 19 19:17:35 PDT 2017 GCC version:  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)  


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!