Expand description
GPU inventory detection
Platform-specific GPU detection:
- Linux: Scans
/sys/bus/pci/devicesfor display controllers (VGA and 3D controllers). Identifies vendor (NVIDIA, AMD, Intel) by PCI vendor ID, reads VRAM from PCI BAR regions, and optionally usesnvidia-smifor NVIDIA-specific model and memory information. - macOS: Uses
system_profiler SPDisplaysDataType -jsonto detect Apple Silicon GPUs and unified memory viasysctl -n hw.memsize. - Windows: Layers NVML (via
nvml-wrapper, loadsnvml.dllat runtime) on top of WMIWin32_VideoControllerenumeration (via thewmicrate). AMD VRAM is corrected by readingHardwareInformation.qwMemorySizefrom the display-class registry subtree (HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-...}\<xxxx>) because WMI’sAdapterRAMis au32capped at 4 GiB. NVML data is preferred when both surface the same card. - Other: Returns an empty GPU list.
Linux/macOS require no external crates – pure sysfs/system_profiler scanning with
optional subprocess calls. Windows pulls in nvml-wrapper, wmi, and windows-registry
(all gated to target_os = "windows" in the crate manifest).
Structs§
- GpuInfo
- Detected GPU information
Functions§
- detect_
gpus - Scan the system for GPU devices via sysfs PCI enumeration (Linux only)