Skip to main content

Module nvidia

Module nvidia 

Source
Expand description

NVIDIA backend — direct NVML calls via nvml-wrapper (runtime-loads the driver’s own libnvidia-ml.so.1 / nvml.dll). No nvidia-smi anywhere: nvidia-smi is itself just a CLI wrapper over this same library.

Per the domain rules in CLAUDE.md:

  • NOT_SUPPORTED (and any other per-metric error) maps to None, never a failure.
  • The .so.1 path is tried first on Linux: driver-only installs don’t ship the unversioned .so symlink (that comes with the CUDA toolkit) — the exact pitfall bottom hit.
  • Throttle mapping is edge-honest: GPU idle is deliberately NOT narrated as throttling (an idle GPU is not slow). Configuration limiters (applications-clocks / display-clock settings) map to the catch-all other so they are surfaced without being mislabeled as a thermal or power slowdown. See [map_throttle].
  • WSL2 is detected once at init: per-process GPU info is N/A at the driver level there, so StaticInfo::process_hint explains the empty process table up front instead of crashing on it (nvtop #432 is the cautionary tale).

Windows (v1.5, docs/design/cross-platform.md §2) — NVML is the device-truth half of the dual-source split; the shared PDH snapshot (wddm::pdh, joined per device by the §2.5 LUID↔PCI match built at init) is the per-process half:

  • nvml.dll loading: modern drivers (≥461.55, ~2020+) install it into C:\Windows\System32, which is on the default LoadLibraryExW search path — plain Nvml::init() is the whole story. We do NOT probe the legacy C:\Program Files\NVIDIA Corporation\NVSMI\ directory; the documented driver floor is R510+ (early 2022). Load failures (no driver, pre-2020 NVSMI-only driver, DRIVER_NOT_LOADED) map to BackendError::Unavailable — normal, backend skipped.
  • WDDM realities: per-metric NOT_SUPPORTEDNone exactly as on Linux; per-process usedGpuMemory is always Unavailable under WDDM (the Windows kernel memory manager owns that accounting, NVML architecturally cannot see it) → None, never 0 — the per-pid GPU Process Memory\Dedicated Usage counters from the shared PDH snapshot fill that column (§2.4), and per-pid engine busy% fills util_pct; process_utilization_stats is deliberately not called on Windows (§2.4); throttle reasons ARE empirically readable under WDDM and keep the same mapping as Linux; device mem_used_bytes prefers PDH’s adapter-level Dedicated Usage (VidMm truth) over NVML’s virtualized driver view (§2.3).
  • Driver model: WDDM is the GeForce default; TCC (WDM) is deprecated Quadro/Tesla-only non-display mode where NVML per-process accounting works — no special path beyond an accurate process_hint. A future model value (MCDM) surfaces as UnexpectedVariant and is handled, never a crash (§2.6).
  • MIG never arises on Windows (NVIDIA ships MIG on Linux only) — the MIG NOT_SUPPORTED-on-device-utilization caveat is a Linux-only concern.

Structs§

NvidiaBackend