¿Cómo obtener la versión del controlador nvidia desde la línea de comandos?


Para depurar código CUDA y comprobar compatibilidades necesito averiguar qué versión del controlador nvidia para la GPU que he instalado. He encontrado Cómo obtener la versión cuda? pero eso no me ayuda aquí.

Author: Community, 2012-10-29

7 answers

Usar nvidia-smi debería decirte que:

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                                                 |
+-----------------------------------------------------------------------------+
 119
Author: Brendan Wood,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-29 16:32:16

En cualquier sistema linux con el controlador NVIDIA instalado y cargado en el núcleo, puede ejecutar:

cat /proc/driver/nvidia/version

Para obtener la versión del módulo NVIDIA kernel actualmente cargado, por ejemplo:

$ 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) 
 77
Author: talonmies,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-05 10:36:56

modinfo hace el truco.

root@nyx:/usr/src# modinfo nvidia|grep version:
version:        331.113
 10
Author: Michael,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-29 11:35:06

[NOTA: No estoy borrando mi respuesta a propósito, para que la gente vea cómo no hacerlo]

Si usa:

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

Obtendrá la versión del paquete de controladores nVIDIA instalado a través del mecanismo de empaquetado de su distribución. Pero esta puede no ser la versión que realmente se está ejecutando como parte de su núcleo en este momento.

 4
Author: Framester,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-09 20:34:26

Versión de Windows:

Cd \ Archivos de programa \ NVIDIA Corporation \ NVSMI

Nvidia-smi

 2
Author: ccc,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-06-17 05:43:40

Para ampliar la respuesta de ccc, si desea incorporar la consulta de la tarjeta con un script, aquí hay información sobre el sitio de Nvidia sobre cómo hacerlo:

Https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries

Además, encontré este hilo investigando powershell. Aquí hay un comando de ejemplo que ejecuta la utilidad para obtener la verdadera memoria disponible en la GPU para comenzar.

# get gpu metrics
$cmd = "& 'C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi' --query-gpu=name,utilization.memory,driver_version --format=csv"
$gpuinfo = invoke-expression $cmd | ConvertFrom-CSV
$gpuname = $gpuinfo.name
$gpuutil = $gpuinfo.'utilization.memory [%]'.Split(' ')[0]
$gpuDriver = $gpuinfo.driver_version
 1
Author: Jeff Blumenthal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-21 19:46:07

Si necesita obtener eso en un programa con Python en un sistema Linux para la reproducibilidad:

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

Da:

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) 
 0
Author: Martin Thoma,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-12 20:46:31