Cyberithub

How to Install nvidia-smi on Ubuntu or Debian Linux

Advertisements

In this article, we will see how to install nvidia-smi on Ubuntu or Debian Linux. nvidia-smi (NVIDIA System Management Interface) is a free and open source command-line tool to monitor and manage NVIDIA GPUs. It comes pre-installed with NVIDIA drivers and is used for monitoring GPU performance, utilization, and processes. Using this utility, you can keep an eye on GPU temperature, memory usage, power consumption, and utilization. It can also show the lists of active processes using the GPU. You can use nvidia-smi utility to adjust GPU power limits and performance modes.

There are lot many other things you can do using nvidia-smi utility to manage GPU in your server. More can checked on official website. You can install this utility in almost all famous platforms including linux based systems without much hassle. Here we will see how to install and use this utility in ubuntu or debian based linux systems.

 

How to Install nvidia-smi on Ubuntu or Debian Linux

How to Install nvidia-smi on Ubuntu or Debian Linux

Also Read: How to Install clang tool on Ubuntu or Debian Linux

Step 1: Prerequisites

a) You should have a running Ubuntu or Debian Linux Server.

b) You should have sudo or root access to run privileged commands.

c) You should have appropriate NVIDIA driver installed in your System.

d) You should have NVIDIA GPU available in your Server.

 

Step 2: Update Your Server

Before installing a new package, check for latest available bug fixes and features upgrades and install them first by using sudo apt update && sudo apt upgrade command as shown below. This will keep your system stable and secure.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade

 

Step 3: Install nvidia-smi

To install nvidia-smi utility, you have to download and install latest nvidia utility package from default ubuntu repo. At the time of writing this article, latest available package is nvidia-utils-550 so to install this package, run sudo apt install nvidia-utils-550 command as shown below. This will download and install the package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install nvidia-utils-550
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libnvidia-compute-550
Suggested packages:
nvidia-driver-550
The following NEW packages will be installed:
libnvidia-compute-550 nvidia-utils-550
0 upgraded, 2 newly installed, 0 to remove and 88 not upgraded.
Need to get 42.4 MB of archives.
After this operation, 182 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 libnvidia-compute-550 amd64 550.120-0ubuntu0.22.04.1 [41.8 MB]
Get:2 http://in.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 nvidia-utils-550 amd64 550.120-0ubuntu0.22.04.1 [532 kB]
Fetched 42.4 MB in 9s (4,861 kB/s)
Selecting previously unselected package libnvidia-compute-550:amd64.
(Reading database ... 240941 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-550_550.120-0ubuntu0.22.04.1_amd64.deb ...
Unpacking libnvidia-compute-550:amd64 (550.120-0ubuntu0.22.04.1) ...
Selecting previously unselected package nvidia-utils-550.
Preparing to unpack .../nvidia-utils-550_550.120-0ubuntu0.22.04.1_amd64.deb ...
Unpacking nvidia-utils-550 (550.120-0ubuntu0.22.04.1) ...
Setting up libnvidia-compute-550:amd64 (550.120-0ubuntu0.22.04.1) ...
Setting up nvidia-utils-550 (550.120-0ubuntu0.22.04.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.9) ...
Processing triggers for man-db (2.10.2-1) ...

 

Step 4: Verify Installation

After successful installation, you can run nvidia-smi command to check GPU utilization, memory usage, and running processes.

cyberithub@ubuntu:~$ nvidia-smi

 

Step 5: List running GPU Processes

If you are looking to display all the running gpu processes then run nvidia-smi pmon command as shown below.

cyberithub@ubuntu:~$ nvidia-smi pmon

 

Step 6: Set maximum GPU Power Consumption

If you are looking to set maximum gpu power consumption in watts, you have to use -pl option to set the limit. For example, if you would like to set power consumption limit to 150 Watts then you have to use sudo nvidia-smi -pl 150 command as shown below.

cyberithub@ubuntu:~$ sudo nvidia-smi -pl 150 

 

Step 7: Enable/Disable Persistence Mode

If you are looking to enable or disable persistence mode then you can do that by setting -pm option to 0 or 1 with nvidia-smi command. For example, if you are looking to keep gpu persistence mode on then you have to use sudo nvidia-smi -pm 1 command as shown below.

cyberithub@ubuntu:~$ sudo nvidia-smi -pm 1

Similarly, if you are looking to keep gpu persistence mode off then you have to use sudo nvidia-smi -pm 0 command as you can see below.

cyberithub@ubuntu:~$ sudo nvidia-smi -pm 0

 

Step 8: Set GPU Fan Speed 

You can also control GPU Fan speed by setting it manually. For example, if you are looking to set gpu fan speed to 80% then run sudo nvidia-smi -i 0 -fan 80 command as shown below.

cyberithub@ubuntu:~$ sudo nvidia-smi -i 0 -fan 80

 

Step 9: Reset GPU Processes

You also have an option to reset processes in case it got stuck while using gpu. This can be done by running sudo nvidia-smi -i 0 -gpu-reset command as shown below.

cyberithub@ubuntu:~$ sudo nvidia-smi -i 0 -gpu-reset 

 

Step 10: Check all available options

If you are looking for all options available with nvidia-smi utility then run nvidia-smi --help command as shown below.

cyberithub@ubuntu:~$ nvidia-smi --help

 

Step 11: Uninstall nvidia-smi

Once you are done using nvidia-smi utility, you can choose to remove it from your system by removing nvidia-utils-550 package using sudo apt remove nvidia-utils-550 command as shown below.

cyberithub@ubuntu:~$ sudo apt remove nvidia-utils-550
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
libnvidia-compute-550
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
nvidia-utils-550
0 upgraded, 0 newly installed, 1 to remove and 87 not upgraded.
After this operation, 1,538 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 243252 files and directories currently installed.)
Removing nvidia-utils-550 (550.120-0ubuntu0.22.04.1) ...
Processing triggers for man-db (2.10.2-1) ...

Leave a Comment