Most Linux users are well aware how to view the current CPU usage; mostly by using the top or the more modern htop commands. But what about the GPU usage, the usage from the Graphics Processing Unit? Luckily there are commands available, but most of them are not very well known (yet).
Listing the GPU
Let's start by listing the installed GPUs on your system. The easiest to use and widely available command for this lsgpu (see the similarity to lscpu? stunning!). Without any parameters the output does not really show much – only that a card was detected on /dev/dri/card1:
ck@mint ~ $ lsgpu
card1 1002:67df drm:/dev/dri/card1
└─renderD128
However when using the -p parameter, a lot of detailed information about the GPU (including capabilities) can be seen. In the following example I'm grepping only for a couple of fields to reduce the output:
ck@mint ~ $ lsgpu -p | egrep "^(ID|card device|mem)"
ID_FOR_SEAT : drm-pci-0000_04_00_0
ID_PATH : pci-0000:04:00.0
ID_PATH_TAG : pci-0000_04_00_0
ID_FOR_SEAT : drm-pci-0000_04_00_0
ID_PATH : pci-0000:04:00.0
ID_PATH_TAG : pci-0000_04_00_0
card device : /dev/dri/card1
ID_MODEL_FROM_DATABASE : Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (Radeon RX 580 Armor 4G OC)
ID_PCI_CLASS_FROM_DATABASE : Display controller
ID_PCI_INTERFACE_FROM_DATABASE : VGA controller
ID_PCI_SUBCLASS_FROM_DATABASE : VGA compatible controller
ID_VENDOR_FROM_DATABASE : Advanced Micro Devices, Inc. [AMD/ATI]
mem_busy_percent : 3
mem_info_gtt_total : 16785162240
mem_info_gtt_used : 126267392
mem_info_preempt_used : 0
mem_info_vis_vram_total : 268435456
mem_info_vis_vram_used : 66424832
mem_info_vram_total : 8589934592
mem_info_vram_used : 1562357760
The output reveals the vendor and model of the GPU: AMD Radeon RX 580 Armor 4G OC.
nvtop (for all GPUs)
To see the GPU usage, it's worth trying the nvtop command. Although the command sounds like "Nvidia Top", it actually means "Neat Videocard TOP" and is compatible with multiple GPU vendors. Fortunately this command is already available in many distribution repositories, such as Debian or Ubuntu. It can be installed as easy as:
ck@mint ~ $ sudo apt install nvtop
As an alternative, you can also grab the source code from the nvtop GitHub repository and build nvtop yourself. Or you use the downloadable AppImage, see further below.
The command can then be launched from the command line. Note that the GPU drivers (aka Kernel modules) need to be loaded as they are required by nvtop.
ck@mint ~ $ nvtop
This should work fine for Nvidia GPUs, but AMD GPUs are only supported since nvtop 2.0.0 (using the amdgpu Kernel module). In older nvtop versions you likely get an error on AMD GPUs:
ck@mint ~ $ nvtop --version
nvtop version 1.2.2
ck@mint ~ $ nvtop
No GPU to monitor.
You can also "install" nvtop as an AppImage, which is a single binary executable:
ck@mint ~ $ wget https://github.com/Syllo/nvtop/releases/download/3.1.0/nvtop-x86_64.AppImage
ck@mint ~ $ chmod 755 nvtop-x86_64.AppImage
ck@mint ~ $ ./nvtop-x86_64.AppImage
amdgpu_top: AMD GPUs
A few years ago, radeontop was THE command for AMD (formerly ATI) GPUs. However due to significant changes in AMD GPUs and lack of time of the radeontop maintainer (note: this is not shaming, it's just reality, we all have lives!), the project was forked into amdgpu_top in 2023.
amdgpu_top is available in multiple package formats, including deb package for Debian based distributions, rpm package for Enterprise Linux distributions and as independent AppImage binary.
In the following example I download and install the deb package on my Linux Mint machine:
ck@mint ~ $ wget https://github.com/Umio-Yasuno/amdgpu_top/releases/download/v0.9.2/amdgpu-top_0.9.2-1_amd64.deb
ck@mint ~ $ sudo dpkg -i amdgpu-top_0.9.2-1_amd64.deb
The amdgpu_top command is then available and can be executed:
ck@mint ~ $ amdgpu_top
The ncurses UI shows a detailed usage of not only which processes use which amount of resources, but also shows what kind of Graphics Processing (e.g. shading) is responsible for the usage.