gpustat

A simple command-line utility for querying and monitoring NVIDIA GPU status

Tool
PyPI
v1.1.1
4,392stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
51/100Fair
Development Activity24
Maintenance24
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture75
Code Quality78
Innovation82
Learning Curve90

gpustat is a lightweight command-line tool that gives you a clear, compact snapshot of your NVIDIA GPUs. Think of it as a friendlier nvidia-smi: with a single command it displays each GPU’s utilization, memory usage, temperature, fan speed, power draw, and the processes running on it, all in colorized one-line-per-GPU output.

Built on NVIDIA’s official NVML bindings, gpustat is popular in machine-learning and HPC environments where quickly checking who is using which GPU matters. It supports a watch mode for live monitoring, JSON output for scripting, and can also be imported as a Python library to query GPU state programmatically.

What You Get

  • A compact, colorized one-line-per-GPU status display covering utilization, memory, temperature, and processes
  • A watch mode (—watch / -i) for continuous live monitoring at a configurable interval
  • JSON output (—json) and a Python API (gpustat.new_query()) for scripting and integration
  • Flags to surface extra detail: process owner, PID, full command, fan speed, encoder/decoder, and power usage
  • Shell completion scripts for bash, zsh, and tcsh

Common Use Cases

  • Checking which GPUs are free before launching a training job on a shared server
  • Live-monitoring GPU utilization and memory during long-running deep-learning runs
  • Scripting GPU health checks and dashboards using JSON output or the Python API

Under The Hood

Architecture - gpustat is organized around a small set of modules: nvml.py wraps NVIDIA’s NVML bindings and normalizes driver differences, core.py builds a GPUStatCollection by querying each device for utilization, memory, temperature, power, and running processes, cli.py handles argument parsing and the colorized rendering, and main.py wires it into an entry point. The library path (gpustat.new_query()) and the CLI share the same core query engine.

Tech Stack - Pure Python (>=3.6), depending on nvidia-ml-py for NVML access, psutil for resolving process owners and command lines, and blessed for terminal color handling. Packaging is defined via setup.py, setup.cfg, and pyproject.toml.

Code Quality - The codebase is small and focused with dedicated test files (test_gpustat.py, util_test.py) exercising the core query and formatting logic. Concerns are cleanly separated between NVML access, the data model, and rendering, and the project has a maintained CHANGELOG.

API Design - The public surface is deliberately minimal: gpustat.new_query() returns a collection with print_formatted() and jsonify() methods, mirroring the CLI’s default and —json output. The CLI offers well-named short and long flags for each optional metric, and the tool ships shell completion, making both the command and the library approachable with almost no boilerplate.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search