Find nvidia driver 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.

11 Answers 11

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 | +-----------------------------------------------------------------------------+ 

In my centos 6.4 system, it gives me error as «-bash: nvidia-smi: command not found». What might be the problem ?

@Shyamkkhadka Likely something wrong with your PATH. You could try to find nvidia-smi like so: locate nvidia-smi

@BrendanWood, with locate command it shows blank output. I suspect if it has no gpu hardware either. Because it is HPC. And I am accessing it from remote, with ssh.

@Shyamkkhadka Yes, that’s probably it. HPC generally don’t have GPUs unless they are supposed to be a GPU cluster. You can check available hardware with lspci . For example: stackoverflow.com/questions/10310250/…

@BrendanWood, As suggested in your link, when I did «lspci | grep VGA». It shows output as «lspci | grep VGA 01:03.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] ES1000 (rev 02)». So I think it has GPU hardware.

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) 

Or if you have Bumblebee installed (due to NVIDIA Optimus dual GPU), then run this instead: «optirun cat /proc/driver/nvidia/version»

This is especially useful when the output of nvidia-smi is: Failed to initialize NVML: GPU access blocked by the operating system

In my centos 6.4 system, I don’t have directory nvidia inside /proc/driver. What might be the problem ? Due to this, I am not able to see my nvidia driver version.

Читайте также:  Linux рекурсивный вывод файлов директории

Also useful when you get the output Failed to initialize NVML: Driver/library version mismatch from nvidia-smi .

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

On my system the module was named nvidia_XXX corresponding to the major driver series I had installed, and since modinfo doesn’t support wildcards or partial name matches I had to do this modinfo $(find /lib/modules/$(uname -r) -iname nvidia_*.ko | head -1) | grep ^version: which returns the correct major and minor driver version.

On ubuntu 18.04 my version of modinfo has a —field command line option. So you can skip the grep: modinfo nvidia —field version . Also, in ubuntu 16.04 this doesn’t seem to work. I always get ERROR: Module nvidia not found .

modinfo shows a different version from the /proc/driver/nvidia/version file. I suppose it reads the version from the module file, not from the one actually in use. I just installed the new driver and I still have to reboot.

cd \Program Files\NVIDIA Corporation\NVSMI

nvidia-smi

nvidia-smi --query-gpu=driver_version --format=csv,noheader --id=0 

returns result as a string that doesn’t require further parsing like: 470.82.00

In case nvidia-smi is not available for some reason, information can be obtained by calling into driver APIs. Driver libraries can be loaded using Python ctypes library.

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

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.

That doesn’t tell you what version of the driver is actually installed and in use by the kernel. Use the proc file system to see that. Also this only works in debian style distributions.

@Framester: You totally gamed the system! I just gave you another +1 on a useful wrong answer. you cunning devil 🙂

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:

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 

Источник

NvidiaDriversInstallation

This page shows how to install the NVIDIA drivers from the command line, using either the ubuntu-drivers tool (recommended), or apt.

NVIDIA drivers releases

  • UDA (Unified Driver Architecture) drivers — which are recommended for the generic desktop use, and which you can also find here: https://www.nvidia.com/en-us/drivers/unix/
  • ERD (Enterprise Ready Drivers) — which are recommended on servers, and for computing tasks. Their packages can be recognised by the -server suffix. You can read more about these drivers here: https://docs.nvidia.com/datacenter/tesla/index.html
Читайте также:  Восстановить образ системы linux

Additionally, we package the NVIDIA Fabric Manager and the NVIDIA Switch Configuration and Query (NSCQ) Library, which you will only need if you have NVswitch hardware. The Fabric Manager and NSCQ library are only available with the ERDs or -server driver versions.

Check driver versions

To check the version of your currently running driver:

cat /proc/driver/nvidia/version

The ubuntu-drivers tool relies on the same logic as the «Additional Drivers» graphical tool, and allow more flexibility on desktops and on servers.

The ubuntu-drivers tool is recommended if your computer uses Secure Boot, since it always tries to install signed drivers which are known to work with Secure Boot.

Check the available drivers for your hardware

sudo ubuntu-drivers list --gpgpu

You should see a list such as the following:

nvidia-driver-418-server nvidia-driver-515-server nvidia-driver-525-server nvidia-driver-450-server nvidia-driver-515 nvidia-driver-525

Installing the drivers for generic use (e.g. desktop and gaming)

You can either rely on automatic detection, which will install the driver that is considered the best match for your hardware:

sudo ubuntu-drivers install

Or you can tell the ubuntu-drivers tool which driver you would like installed. If this is the case, you will have to use the driver version (such as 525) that you saw when you used the ubuntu-drivers list command.

Let’s assume we want to install the 525 driver:

sudo ubuntu-drivers install nvidia:525

Installing the drivers on servers and/or for computing purposes

You can either rely on automatic detection, which will install the driver that is considered the best match for your hardware:

sudo ubuntu-drivers install --gpgpu

Or you can tell the ubuntu-drivers tool which driver you would like installed. If this is the case, you will have to use the driver version (such as 525) and the -server suffix that you saw when you used the ubuntu-drivers list --gpgpu command.

Let’s assume we want to install the 525-server driver (listed as nvidia-driver-525-server):

sudo ubuntu-drivers install --gpgpu nvidia:525-server

You will also want to install the following additional components:

sudo apt install nvidia-utils-525-server

[Optional] If your system comes with NVswitch hardware, then you will want to install Fabric Manager and the NVSwitch Configuration and Query library. You can do so by running the following:

sudo apt install nvidia-fabricmanager-525 libnvidia-nscq-525

NOTE: while nvidia-fabricmanager and libnvidia-nscq do not have the same -server label in their name, they are really meant to match the -server drivers in the Ubuntu archive. For example, nvidia-fabricmanager-525 will match the nvidia-driver-525-server package version (not the nvidia-driver-525 package).

Manual driver installation (using APT)

Installing the NVIDIA driver manually means installing the correct kernel modules first, then installing the metapackage for the driver series.

Installing the kernel modules

If your system uses Secure Boot (as most x86 modern systems do), your kernel will require the kernel modules to be signed. There are two ( mutually exclusive ) ways to achieve this:

Читайте также:  Linux mint virtualbox dkms

Installing the pre-compiled NVIDIA modules for your kernel

Install the metapackage for your kernel flavour (e.g. generic, lowlatency, etc) which is specific to the driver branch (e.g. 525) that you want to install, and whether you want the compute vs general display driver (e.g. -server or not):

sudo apt install linux-modules-nvidia-$$-$

Check that the modules for your specific kernel/ABI were installed by the metapackage:

sudo apt-cache policy linux-modules-nvidia-$$-$(uname -r)

(e.g. sudo apt-cache policy linux-modules-nvidia-525-$(uname -r) )

If the modules were not installed for your current running kernel, upgrade to the latest kernel or install them by specifying the running kernel version:

sudo apt install linux-modules-nvidia-$$-$(uname -r)

(e.g. sudo apt install linux-modules-nvidia-525-$(uname -r) )

Building your own kernel modules using the NVIDIA DKMS package

Install the relevant NVIDIA DKMS package and linux-headers to build the kernel modules, and enroll your own key to sign the modules.

Install the linux-headers metapackage for your kernel flavour (e.g. generic, lowlatency, etc):

sudo apt install linux-headers-$

Check that the headers for your specific kernel were installed by the metapackage:

sudo apt-cache policy linux-headers-$(uname -r)

If the headers for your current running kernel were not installed, install them by specifying the running kernel version:

sudo apt install linux-headers-$(uname -r)

Finally, install the NVIDIA DKMS package for your desired driver series (this may automatically guide you through creating and enrolling a new key for Secure Boot):

sudo apt install nvidia-dkms-$$

Installing the user-space drivers and the driver libraries

After installing the correct kernel modules (see the relevant section of this document), install the correct driver metapackage:

sudo apt install nvidia-driver-$$

[Optional] Installing Fabric Manager and the NVSwitch Configuration and Query library

If your system comes with NVswitch hardware, then you will want to install Fabric Manager and the NVSwitch Configuration and Query library. You can do so by running the following:

sudo apt install nvidia-fabricmanager-$ libnvidia-nscq-$

Note: while nvidia-fabricmanager and libnvidia-nscq do not have the same -server label in their name, they are really meant to match the -server drivers in the Ubuntu archive. For example, nvidia-fabricmanager-525 will match the nvidia-driver-525-server package version (not the nvidia-driver-525 package).

Switching between pre-compiled and DKMS modules

Uninstalling the NVIDIA drivers

Remove any NVIDIA packages from your system:

sudo apt --purge remove '*nvidia*$*'

Remove any additional packages that may have been installed as a dependency (e.g. the i386 libraries on amd64 systems) and which were not caught by the previous command:

Transitional packages to new driver branches

When NVIDIA stops support on a driver branch, then Canonical will transition you to the next supported driver branch automatically if you try to install that driver branch.

NvidiaDriversInstallation (последним исправлял пользователь victorvavan 2023-04-04 18:46:45)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Оцените статью
Adblock
detector