nvitop: An Easier GPU Monitoring & Process Management Alternative to nvidia-smi
Summary
nvitop is an interactive NVIDIA-GPU process viewer — the "one-stop solution for GPU process management". It queries device status directly through NVML Python bindings and renders a colorized terminal UI with curses, acting as a modern, richer alternative to nvidia-smi: live refresh, history graphs, process sorting/filtering, keystroke process management, a process tree view and an environment-variable screen.
- Project: https://github.com/XuehaiPan/nvitop (Apache-2.0)
- Docs: https://nvitop.readthedocs.io
- Latest PyPI release: 1.6.1
1. Why nvitop
nvidia-smi prints a snapshot once; tracking utilization, memory, temperature or power trends means repeatedly rerunning it or writing loop scripts. On shared-GPU AI/HPC clusters you typically need to answer three questions:
- What is the GPU doing — utilization, memory, temperature and power of every device right now;
- Who occupies it — which user/task runs which process on which GPU;
- How to act — once an abnormal process is found, end it quickly.
nvidia-smi offers limited help on #2 and #3. nvitop combines all of this into a top-like interactive screen:
- Informative & fancy: shows more than
nvidia-smi, colorized with box drawing; - Monitor mode: refreshes continuously like
topinstead of printing once; - Bar charts & history graphs: visualize utilization, memory, temperature and power trends;
- Process sorting & filtering: sort by utilization, memory, CPU, user and more;
- Keystroke process management: send signals to processes right in the UI;
- Process tree view: GPU processes and their parent hierarchy;
- Environment-variable & help screens;
- Mouse support.
2. Installation
nvitop depends on NVML (via nvidia-ml-py/pynvml) and psutil, requires Python 3.7+, and needs NVIDIA drivers installed (nvidia-smi available).
# pip install (recommended)
pip install nvitop
# upgrade
pip install --upgrade nvitop
# or via conda
conda install -c conda-forge nvitopThen run:
nvitopIf the command is not on PATH (e.g. installed with pip3 install --user), use the module form:
python3 -m nvitopTip: it also starts without a GPU (CPU/memory only).
3. Basic Usage
Interactive monitor (default)
Run nvitop to enter a top-like screen that refreshes all devices and processes continuously.
One-shot output (like nvidia-smi)
# Print device status once (faster, lower resource usage)
nvitop -1
# Only GPU 0 and GPU 1
nvitop -1 -o 0 1
# Only devices in CUDA_VISIBLE_DEVICES
nvitop -1 -ov
# Only GPU processes with a compute context
nvitop -1 -cRemote monitoring over SSH
ssh user@host -t nvitopUse -t to force a pseudo-terminal and enter the interactive screen directly.
4. Common Key Bindings
In the interactive screen (press h for the full help screen):
| Key | Action |
|---|---|
q | Quit and return to terminal |
h | Go to the help screen |
a / f / c | Switch display mode: auto / full / compact |
r | Force refresh the window |
/ | Search inside process information |
Process sorting (GPU utilization, memory, CPU, user…), filtering, sending signals, the tree view and the environment-variable screen are also available.
5. Real-World Scenarios
Find "who took my GPU"
nvitopSort by memory or utilization to see processes, owners and command lines per device — no more cross-checking nvidia-smi across machines.
Cluster inspection & alerts
In monitor mode, temperature/power/utilization refresh live with history graphs, making abnormal tasks (prolonged high temperature, utilization jitter) obvious; over-threshold values are highlighted.
Quickly dispose of abnormal processes
Signal the process directly in the UI instead of opening another terminal to kill — handy on shared GPUs for fast resource release.
6. Advanced: Python API & Companion Tools
nvitop also ships an easy Python API for custom monitoring scripts:
from nvitop import Device
devices = Device.all() # or Device.cuda.all() for CUDA ordering
for device in devices:
print(device)
print(f' - Fan speed: {device.fan_speed()}%')
print(f' - Temperature: {device.temperature()}C')
print(f' - GPU utilization: {device.gpu_utilization()}%')
print(f' - Memory: {device.memory_used_human()} / {device.memory_total_human()}')
print(f' - Processes: {len(device.processes())}')take_snapshots() returns all device and process snapshots in one call — handy for inspection scripts or alert integration.
The package also ships nvisel, an interactive CUDA_VISIBLE_DEVICES selector for multi-GPU environments.