gpu_stats
Live GPU utilization and memory readings, universal across vendors.
Sources, best-first per vendor: NVIDIA reads NVML in-process via nvidia-ml-py
(the API behind nvitop/nvtop; exact PCI identity, no subprocess per poll) with a
nvidia-smi fallback; every other vendor (AMD, Intel, Apple) comes from the
aitop monitors (rocm-smi/amd-smi, intel_gpu_top); the amdgpu sysfs counters
(gpu_busy_percent + mem_info_vram_*) backfill AMD hosts without ROCm
tooling, and i915/xe cards without a readable counter report load/memory 0 —
listed, and honest about what the kernel provides.
get_gpus(dri_node=...) keys the readings to the render node the pipeline
captures/encodes on (PCI match when the source knows its address, else a
vendor-unique match), so the monitored GPU is always the one doing the work.
Objects expose .load as a 0..1 fraction and .memoryTotal /
.memoryUsed in MiB, the units the stats collectors serialize.
attributelogger= logging.getLogger('gpu_stats')