nvitop - Interactive NVIDIA GPU Process Viewer
nvitop is an interactive NVIDIA GPU device and process monitoring tool written in Python. It provides a colorful and informative interface that continuously updates the status of GPUs and processes, offering more details and interactivity than the default `nvidia-smi`. Beyond its CLI, it exposes a comprehensive Python API for custom monitoring and integrates with tools like Grafana via `nvitop-exporter`. The current version is 1.6.2, with a regular release cadence addressing new `nvidia-ml-py` versions, features, and bug fixes.
Warnings
- breaking Python 3.7 support was officially dropped in nvitop v1.5.0. Users on Python 3.7 or older must upgrade their Python environment to at least 3.8 to use nvitop v1.5.0 or newer.
- deprecated The `nvitop.callbacks` module was officially deprecated in v1.5.0 and is now unmaintained. Users relying on these callbacks should migrate to alternative integration methods or the core API.
- gotcha The recommended way to install `nvidia-ml-py` with `nvitop` changed in v1.5.3. Instead of using per-version install extras like `nvitop[nvml-11.450.129]`, users should now use `nvitop[cudaXX]` where `XX` is the major CUDA version (e.g., `nvitop[cuda11]`).
- gotcha nvitop relies on the NVIDIA Management Library (NVML), which is part of the NVIDIA display driver or CUDA Toolkit. Without a properly installed and functional NVIDIA driver, nvitop will not be able to detect GPUs or collect metrics.
- gotcha On Windows, the TUI (Terminal User Interface) features of nvitop require the `windows-curses` package. Inconsistent behavior may occur on different terminal emulators, such as missing mouse support, even with the package installed.
Install
-
pip install nvitop -
pip install 'nvitop[cudaXX]' # Replace XX with your CUDA major version (e.g., cuda11, cuda12)
Imports
- Device
from nvitop import Device
- HostProcess
from nvitop.process import HostProcess
- take_snapshots
from nvitop import take_snapshots
- select_devices
from nvitop import select_devices
Quickstart
import os
from nvitop import Device, take_snapshots
# It's recommended to set CUDA_DEVICE_ORDER for consistent device indexing
os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
print("--- Device Overview ---")
devices = Device.all()
if not devices:
print("No NVIDIA GPUs found or NVML not initialized.")
else:
for device in devices:
print(f"Device {device.index}: {device.name()}")
print(f" - Fan speed: {device.fan_speed() if device.fan_speed() is not None else 'N/A'}%")
print(f" - Temperature: {device.temperature()}C")
print(f" - GPU Utilization: {device.gpu_utilization()}% (SM), {device.memory_utilization()}% (Memory)")
print(f" - Total Memory: {device.total_memory_human()}")
print("\n--- Running GPU Processes ---")
snapshots = take_snapshots()
if not snapshots.gpu_processes:
print("No GPU processes found.")
else:
for gpu_process in snapshots.gpu_processes:
print(f"PID: {gpu_process.pid}, Name: {gpu_process.name()}, GPU: {gpu_process.device.index}, Mem: {gpu_process.gpu_memory_human()}")