[linux] How to get the nvidia driver version from the command line?

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.

This question is related to linux cuda driver

The answer is


To expand on ccc's answer, if you want to incorporate querying the card with a script, here is information on Nvidia site on how to do so:

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

Also, I found this thread researching powershell. Here is an example command that runs the utility to get the true memory available on the GPU to get you started.

# 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

Windows version:

cd \Program Files\NVIDIA Corporation\NVSMI

nvidia-smi


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) 

modinfo does the trick.

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

[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.


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) 

Examples related to linux

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt?

Examples related to cuda

Which TensorFlow and CUDA version combinations are compatible? NVIDIA NVML Driver/library version mismatch How do I select which GPU to run a job on? How to verify CuDNN installation? Using GPU from a docker container? Using Java with Nvidia GPUs (CUDA) Error Message : Cannot find or open the PDB file How can I flush GPU memory using CUDA (physical reset is unavailable) What is the canonical way to check for errors using the CUDA runtime API? How to get the nvidia driver version from the command line?

Examples related to driver

NVIDIA NVML Driver/library version mismatch php artisan migrate throwing [PDO Exception] Could not find driver - Using Laravel ADB Driver and Windows 8.1 Nexus 7 (2013) and Win 7 64 - cannot install USB driver despite checking many forums and online resources IOCTL Linux device driver How to add the JDBC mysql driver to an Eclipse project? How to get the nvidia driver version from the command line? Setting up PostgreSQL ODBC on Windows java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver