Linux nvidia command line

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.

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 

Источник

How to Install Nvidia Drivers on Ubuntu 20.04

Nvidia GPUs (graphics processing units) have exceptional parallel computing potential, much higher than that of CPUs. That is why GPUs are becoming the main choice for high-performance workloads.

Читайте также:  Linux security and hardening

Aside from gaming, Nvidia GPUs are also used for 3D rendering, mining, visualization, machine learning, AI, and in data centers. For example, phoenixNAP GPU dedicated servers use Nvidia Tesla GPUs.

In this tutorial, you will learn how to install the latest proprietary Nvidia drivers on Ubuntu 20.04.

How to install Nvidia drivers on Ubuntu 20.04

  • A machine running Ubuntu 20.04
  • An account with sudo/root permissions
  • An Nvidia GPU

Note: Learn why and how GPUs are used for machine learning and AI in our article on GPU Machine Learning.

Install Nvidia Driver Using GUI

Ubuntu comes with open-source Nouveau drivers for Nvidia GPUs out of the box. The Nouveau driver does not harness the GPU’s full power and sometimes performs worse or even causes system instability. Nvidia proprietary drivers are much more reliable and stable.

The first way to install Nvidia drivers is by using the GUI Software & Updates app.

Step 1: Open Software and Updates From the App Menu

1. Open the Applications menu and type “software and updates.”

2. Select the Software and Updates app.

Step 2: Click the Additional Drivers Tab

Wait for the app to download a list of additional drivers available for your GPU.

Install proprietary Nvidia drivers via a GUI app.

The driver installed on your machine is selected by default. It is usually an open-source Nouveau display driver.

Step 3: Choose a Driver

1. From the list, select the latest Nvidia driver labeled proprietary, tested. This is the latest stable driver published by Nvidia for your GPU.

Choose a proprietary Nvidia driver to install on Ubuntu 20.04

2. Click Apply Changes.

3. Enter your password and wait for the installation to finish.

Step 4: Restart

Restart the machine for the changes to take effect.

Install Nvidia Driver via Command Line

The second way to install Nvidia drivers is by using the terminal.

Step 1: Search for Nvidia Drivers

1. Open the terminal by pressing Ctrl+Alt+T or search for “terminal” in the Applications menu.

2. Run the following command:

Search for available Nvidia drivers using the terminal in Ubuntu 20.04.

The output shows a list of available drivers for your GPU.

Step 2: Update the System Package Repository

Before installing the driver, make sure to update the package repository. Run the following commands:

Step 3: Install the Right Driver for Your GPU

1. Choose a driver to install from the list of available GPU drivers. The best fit is the latest tested proprietary version.

2. The syntax for installing the driver is:

sudo apt install [driver_name]

Install Nvidia drivers by using the terminal in Ubuntu 20.04

For this tutorial, we installed nvidia-driver-340, the latest tested proprietary driver for this GPU.

Step 4: Reboot

Reboot your machine with the following command:

Install Nvidia Beta Drivers via PPA Repository

The PPA repository allows developers to distribute software that is not available in the official Ubuntu repositories. This means that you can install the latest beta drivers, however, at the risk of an unstable system.

To install the latest Nvidia drivers via the PPA repository, follow these steps:

Читайте также:  Linux mint как настроить прокси

Step 1: Add PPA GPU Drivers Repository to the System

1. Add the graphics drivers repository to the system with the following command:

sudo add-apt-repository ppa:graphics-drivers/ppa

Add the GPU PPA repository to Ubuntu 20.04.

2. Enter your password and hit Enter when asked if you want to add the repository.

Step 2: Identify GPU Model and Available Drivers

To verify which GPU model you are using and to see a list of available drivers, run the following command:

Identify GPU and available Nvidia drivers in Ubuntu 20.04.

The output shows your GPU model as well as any available drivers for that specific GPU.

Step 3: Install Nvidia Driver

1. To install a specific driver, use the following syntax:

sudo apt install [driver_name]

Install Nvidia drivers by using the terminal in Ubuntu 20.04

For example, we installed the nvidia-340 driver version.

2. Alternatively, install the recommended driver automatically by running:

sudo ubuntu-drivers autoinstall

Install the recommended Nvidia driver automatically in Ubuntu 20.04.

In this example, no changes were made as the recommended driver is already installed.

Step 4: Restart the System

Reboot the machine for the changes to take effect.

How to Uninstall Nvidia Driver

If you want to uninstall the proprietary Nvidia driver, the best option is to remove —purge the driver.

Step 1: See Installed Packages

To check which Nvidia packages are installed on the system, run the following command:

See installed Nvidia packages on Ubuntu 20.04.

The output returns a list of all Nvidia packages on the system.

Note: The ubuntu-desktop package could also be purged because it is a dependency of the nvidia-common package, so you may need to reinstall it if it gets removed.

Step 2: Purge Nvidia Packages

1. Run the following command:

sudo apt-get remove --purge '^nvidia-.*'

Remove all Nvidia packages from Ubuntu 20.04.

The command purges every Nvidia package from the system.

2. If the ubuntu-desktop package is removed, reinstall it with the following command:

sudo apt-get install ubuntu-desktop

Step 4: Reboot the System

Reboot your system by running sudo reboot . By default, the system loads the open-source Nouveau driver during boot.

Note: Check out our other Nvidia installation guides:

You now know how to install proprietary Nvidia drivers on your system using the GUI app, official Ubuntu repository, or the PPA repository if you want the beta versions.

You also know how to uninstall Nvidia drivers if you want to go back to using the open-source Nouveau driver.

Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.

Puppet is an open-source solution that helps you perform administrative tasks remotely. This tutorial takes.

KVM (short for Kernel-based Virtual Machine) is a Linux kernel module which enables creating and running.

Nginx is an open-source application used for managing web servers, load balancing, and security. This.

Growing demands for extreme compute power lead to the unavoidable presence of bare metal servers in today’s.

Источник

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