Skip to content

gpu_monitor

diapason.telemetry.gpu_monitor

GPU monitoring via pynvml — background poller for GPU metrics.

GpuHardwareSpec dataclass

Peak theoretical capabilities for a known GPU model.

GpuMonitor

Background GPU poller using pynvml.

Usage::

mon = GpuMonitor(poll_interval_ms=50)
with mon.sample() as result:
    # ... run inference ...
    pass
print(result.energy_joules)
mon.close()

available() staticmethod

Return True if pynvml is importable and can be initialized.

close()

Shut down pynvml if it was initialized.

sample()

Context manager that polls GPUs during the block, then populates the sample.

If pynvml is unavailable or no devices are found, yields an empty :class:GpuSample without starting a background thread.

GpuSample dataclass

Aggregated GPU metrics over an inference bracket.

GpuSnapshot dataclass

A single point-in-time reading from one GPU device.

lookup_gpu_spec(name)

Return the :class:GpuHardwareSpec for name, or None if unknown.

Matches are case-insensitive substring lookups against the keys in :data:GPU_SPECS.