nvitop - Interactive NVIDIA GPU Process Viewer

1.6.2 · active · verified Wed Apr 15

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

Install

Imports

Quickstart

This quickstart script demonstrates how to get an overview of your NVIDIA GPUs and list the processes currently utilizing them using nvitop's Python API. It fetches device details like temperature, utilization, and memory, then lists active GPU processes with their respective memory usage.

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()}")

view raw JSON →