nvtop – Awesome Linux task monitor for NVIDIA, AMD & Intel GPUs

nvtop command – Awesome Linux task monitor for NVIDIA, AMD & Intel GPUs

The nvtop command is a ncurses-based (new curses lib that displays info in terminals) GPU status viewer for AMD, Intel and NVIDIA GPUs. In other words, you can use this interactive GPU process viewer for the following GPUs on Linux:

  1. AMD GPUs using the amdgpu driver.
  2. Intel graphic card using the i915 Linux driver.
  3. Nvidia GPUs using NVIDIA driver and anything starting at GeForce 600, GeForce 800M and successor should work fine.
  4. Adreno GPU by Qualcomm

Installing the nvtop command on Linux

You can also install the nvtop command as per your Linux distro on your desktop or GPU computer server.

Arch Linux

Run the pacman command as follows:
sudo pacman -Syu nvtop

Installing the nvtop command on Arch Linux using pacman

Click to enlarge

Gentoo Linux

Use the following emerge command:
vivek@gentoo:~$ sudo layman -a guru
vivek@gentoo:~$ sudo emerge -av nvtop

Ubuntu Impish (21.10), Debian buster (stable) and more recent

Try the apt command/apt-get command:
sudo apt update
sudo apt install nvtop

Debian Linux 10+ user please enable contrib repo in the /etc/apt/sources.list:

deb http://deb.debian.org/debian buster main non-free contrib 
deb http://deb.debian.org/debian buster-updates main non-free contrib 
deb http://deb.debian.org/debian-security/ buster/updates main non-free contrib

Then search with the apt-cache command and install it using the sudo apt install nvtop:
sudo apt update
sudo apt search nvtop
sudo apt-cache policy nvtop

nvtop:
  Installed: (none)
  Candidate: 1.0.0-1
  Version table:
     1.0.0-1 500
        500 http://deb.debian.org/debian buster/contrib amd64 Packages

Fedora Linux version 36+

Try the dnf command:
sudo dnf install nvtop

CetOS Stream, RHEL, Rocky, and AlmaLinux version 8/9

Enable EPEL repo and install the nvtop:
## RHEL 8/9 ##
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %{rhel}).noarch.rpm
sudo dnf install nvtop
## CentOS Stream, Rocky Linux, AlmaLinux ##
sudo dnf install -y epel-release
sudo dnf install nvtop

All other Linux distro

Try the snap command. For example:
snap search nvtop
sudo snap install nvtop

Next, add the capability to kill GPU processes inside nvtop:
sudo snap connect nvtop:process-control
You can also add the capability to inspect GPU info (Fan, PCIe, Power, etc) easily as follows:
sudo snap connect nvtop:hardware-observe
Here is how to add AMDGPU process list support:
sudo snap connect nvtop:system-observe
You may need temporary workaround to get per-process GPU usage. For example:
sudo snap connect nvtop:kubernetes-support

How to use Docker nvtop image

Try the following command at the Linux terminal. You must have working Docker installation. For example:
git clone https://github.com/Syllo/nvtop.git
cd nvtop
sudo docker build --tag nvtop .
sudo docker run -it --rm --runtime=nvidia --gpus=all --pid=host nvtop

Getting started with the nvtop

Now that tool is installed, it is time to get your hands dirty. All you have to do is type the following command:
nvtop

nvtop command on Ubuntu Linux

nvtop command running on my Ubuntu Linux desktop with NVIDIA GPU and apps

You can also state the delay between updates in tenths of seconds. For example:
nvtop -d 0.25
Do you want monochrome mode? Here is how to disable colour output:
nvtop -C
Here is how to display only one bar plot corresponding to the maximum of all GPUs:
nvtop -p

nvtop command keyboard shortcuts

Table 1: INTERACTIVE COMMANDS
Shortcut Description
Up Select (highlight) the previous process.
Down Select (highlight) the next process.
Left / Right Scroll in the process row.
+ Sort increasingly.
- Sort decreasingly.
F2 Enter the setup utility to modify the interface options.
F12 Save the current interface options to persistent storage.
F9 “Kill” process: Select a signal to send to the
highlighted process.
F6 Sort: Select the field for sorting. The current sort field is
highlighted inside the header bar.
F10q, Esc Quit nvtop command.

Summing up

I found nvtop very useful when I need to see what is stressing out my GPU and other critical info like GPU temperature or fan speed. You can quickly kill the process with this tool that is eating all your GPU without using the combination of ps command/grep command or egrep command and then kill the PID. Most modern apps like Firefox, Chrome and your code written in Python can use dedicated NVIDIA or AMD GPU. Hence, having this little tool is useful. Give it a try.

Getting help about the nvtop

You can read the nvtop manual page offline or online at the project repo. For example, try the man command or pass the -h option as follows:
man nvtop
nvtop -h

Source: nixCraft

Leave a Reply

Your email address will not be published. Required fields are marked *