Skip to content
Latchkey

gpustat: Compact GPU Status for Logs

gpustat is a small Python tool that prints a compact, colorized one-line-per-GPU summary of utilization, memory, temperature, and the processes using each GPU.

gpustat is nvidia-smi distilled to one readable line per GPU, which makes it ideal for CI logs and quick human scans on shared boxes.

What it does

gpustat wraps NVML (via nvidia-smi/pynvml) to print each GPU on one line: index, name, temperature, utilization, and used/total memory, optionally with the users and commands of the processes running on it.

Common usage

Terminal
pip install gpustat
gpustat
# show per-process command and user
gpustat -cpu
# watch mode, refresh every 2s
gpustat -i 2

Options

FlagWhat it does
-cShow the command name of each GPU process
-pShow the PID of each process
-uShow the username of each process
-i [sec]Watch mode, refreshing periodically
--jsonMachine-readable JSON output

In CI

Print gpustat --json at the start of a job for a compact, parseable record of GPU state and who is using it. Because it relies on NVML, it fails the same way nvidia-smi does when the driver is missing, so it doubles as a driver check.

Common errors in CI

"Error on querying NVIDIA devices. Use --debug flag for details" or an NVMLError_LibraryNotFound means the NVIDIA driver/NVML is missing or the container has no GPU. "gpustat: command not found" means it is not pip-installed in the active environment. On systems with only some fields available, utilization or power may show as unavailable.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →