Monitor NVIDIA GPUs in Ubuntu

In this article, we would cover how to monitor NVIDIA GPUs in Ubuntu through three command-line utilities – gpustat, nvtop and nvidia-smi. We can have these command-line utilities by installing relevant packages.

Note: Some of the instructions below may require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

Since, all the packages are available through standard Ubuntu repository. Therefore, we need to first update the repository to have the latest version of packages. Hence, open a terminal and issue the following –

sudo apt update

Now, we first start with nvidia-smi.

Monitor NVIDIA GPUs in Ubuntu through nvidia-smi

It is better to first install the relevant NVIDIA drivers to access the utility. Therefore, follow the article – Install NVIDIA Drivers in Ubuntu 22.04. After installing the required package, we would have access to command-line utility – nvidia-smi

nvidia-smi is NVIDIA’s System Management Interface application. Devices based on Fermi architecture and later are supported with nvidia-smi. If we want to see the basic output then, just use the following code –

nvidia-smi

To extract more out of it, use command-line options. So, to list all NVIDIA GPUs and their Universal Unique Identifier (UUIDs) –

nvidia-smi -L

To get detailed GPU info –

nvidia-smi -q

If we have multiple Units, then to get data for a specific Unit –

nvidia-smi --id=<UUID>

here, UUID can easily be obtained through nvidia-smi -L

To make the utility report data on a loop –

nvidia-smi -l <seconds>

Monitor NVIDIA GPUs in Ubuntu through nvtop

To install the package nvtop –

sudo apt install nvtop

It is a ncurses-based NVIDIA GPU status viewer utility. Just use the following code –

nvtop

To use the utility in monochrome mode –

nvtop -C

To delay updates, we can use –

nvtop -d <delay_sec>

where, <delay_sec> is equivalent to (delay_sec * 0.1) seconds. For instance, 50 would result in delay of 5 seconds.

Monitor NVIDIA GPUs in Ubuntu through gpustat

To install the package gpustat –

sudo apt install gpustat

Just use the following code to see the output –

gpustat

Note: Since it won’t be possible for us to cover all command-line options therefore if you want more then, either look for man pages or use any of the following for your preferred utility –

nvidia-smi -h
nvtop -h
gpustat -h

In conclusion, we have covered three command-line utilities which can be used to monitor NVIDIA GPUs here.

Similar Posts