Top 3 Linux GPU Monitoring Command Line Tools

Explore top GPU monitoring software for Linux and Ubuntu. Discover how to use tools like GPUStat, NVTOP, and NVITOP for comprehensive CPU and GPU monitoring.

Introduction

If you're a tech enthusiast or a Linux user who wants to keep a close eye on their GPU's performance, you've come to the right place. In this post, we'll explore the world of GPU monitoring software, specifically focusing on Ubuntu/Debian Linux. Whether you're a gamer, a data scientist, or a developer working with GPU-intensive tasks, having a reliable GPU monitor is essential for optimizing performance and ensuring your system stays cool under pressure. We'll dive into popular tools such as GPUStat, NVTOP, and NVITOP, discussing their features and how to install them to empower you with comprehensive CPU and GPU monitoring capabilities.

They are a fancy but very useful tool for GPU monitoring, an ncurses based GPU status viewer for NVIDIA GPUs, similar to the htop command or the top command. We can install it as follows using the pip/apt command on a Debian or an Ubuntu Linux. So, let's get started and unravel the power of GPU monitoring on Linux!

Top 1. GPUStat

GPUStat is a simple command-line utility for querying and monitoring GPU status. It works only with NVIDIA Graphics Devices only. There is no support for AMD GPUs. This is free and open source software.

Install GPUStat

Install from PyPI. For more information, please visit GPUStat on Github: https://github.com/wookayin/gpustat

$ pip install gpustat

If you don't have root (sudo) privilege, please try installing gpustat on user namespace:

$ pip install --user gpustat

GPUStat Usage Example

Commonly used gupstat commands are as follows:

# To periodically watch
$ gpustat --watch

# If something goes wrong, try
$ gpustat --debug

# Monitor gpu
$ gpustat -cp
Nvtop screenshot

For more usage information, please consult the usage help.

# See help details
$ gpustat --help
usage: gpustat [-h] [--force-color | --no-color] [--id ID] [-a] [-c] [-f] [-u] [-p] [-F] [-e [{,enc,dec,enc,dec}]] [-P [{,draw,limit,draw,limit,limit,draw}]] [--json] [-i [INTERVAL]] [--no-header] [--gpuname-width GPUNAME_WIDTH]
               [--debug] [--no-processes] [-v]

options:
  -h, --help            show this help message and exit
  --force-color, --color
                        Force to output with colors
  --no-color            Suppress colored output
  --id ID               Target a specific GPU (index).
  -a, --show-all        Display all gpu properties above
  -c, --show-cmd        Display cmd name of running process
  -f, --show-full-cmd   Display full command and cpu stats of running process
  -u, --show-user       Display username of running process
  -p, --show-pid        Display PID of running process
  -F, --show-fan-speed, --show-fan
                        Display GPU fan speed
  -e [{,enc,dec,enc,dec}], --show-codec [{,enc,dec,enc,dec}]
                        Show encoder/decoder utilization
  -P [{,draw,limit,draw,limit,limit,draw}], --show-power [{,draw,limit,draw,limit,limit,draw}]
                        Show GPU power usage or draw (and/or limit)
  --json                Print all the information in JSON format
  -i [INTERVAL], --interval [INTERVAL], --watch [INTERVAL]
                        Use watch mode if given; seconds to wait between updates
  --no-header           Suppress header message
  --gpuname-width GPUNAME_WIDTH
                        The width at which GPU names will be displayed.
  --debug               Allow to print additional informations for debugging.
  --no-processes        Do not display running process information (memory, user, etc.)
  -v, --version         show program's version number and exit

Top 2. NVTOP

Nvtop stands for Neat Video card TOP, a (h)top like task monitor for AMD, Intel, and NVIDIA GPUs. It can handle multiple GPUs and print information about them in a htop familiar way.

Install Nvtop

On Ubuntu Impish (21.10), Debian buster (stable) and more recent. For more information, please visit Nvtop on Github: https://github.com/Syllo/nvtop

# install nvtop
$ sudo apt install nvtop

On Ubuntu 20.04, 22.04 and newer

$ sudo add-apt-repository ppa:flexiondotorg/nvtop
$ sudo apt install nvtop

NVTOP Usage Example

## RUN the tool ##
$ nvtop
Nvtop screenshot

For quick command line arguments help.

$ nvtop --help
nvtop version 1.0.0
Available options:
  -d --delay        : Select the refresh rate (1 == 0.1s)
  -v --version      : Print the version and exit
  -s --gpu-select   : Column separated list of GPU IDs to monitor
  -i --gpu-ignore   : Column separated list of GPU IDs to ignore
  -p --no-plot      : Disable bar plot
  -C --no-color     : No colors
  -N --no-cache     : Always query the system for user names and command line information
  -f --freedom-unit : Use fahrenheit
  -E --encode-hide  : Set encode/decode auto hide time in seconds (default 30s, negative = always on screen)
  -h --help         : Print help and exit

Top 3. NVITOP

Nvitop is an interactive NVIDIA-GPU process viewer and beyond, the one-stop solution for GPU process management. Nvitop can be easily integrated into other applications. You can use Nvitop to make your own monitoring tools. The full A PI references host at https://nvitop.readthedocs.io.

Install NVITOP

Install from PyPI. For more information, please visit Nvitop on Github: https://github.com/XuehaiPan/nvitop

# Install nvitop
$ pip3 install --upgrade nvitop

It is highly recommended to install nvitop in an isolated virtual environment. Simple installation and run via pipx

pipx run nvitop

Install from conda-forge

conda install -c conda-forge nvitop

NVITOP Usage Example

# Query the status of all devices
$ nvitop -1  # or use `python3 -m nvitop -1`

# Specify query devices (by integer indices)
$ nvitop -1 -o 0 1  # only show <GPU 0> and <GPU 1>

# Run as a resource monitor
$ nvitop
Nvitop screenshot

Press h and the help screen will show, or type nvitop --help for more command options:

Nvitop help screenshot