Skip to main content

Module gpu_detector

Module gpu_detector 

Source
Expand description

GPU inventory detection

Platform-specific GPU detection:

  • Linux: Scans /sys/bus/pci/devices for display controllers (VGA and 3D controllers). Identifies vendor (NVIDIA, AMD, Intel) by PCI vendor ID, reads VRAM from PCI BAR regions, and optionally uses nvidia-smi for NVIDIA-specific model and memory information.
  • macOS: Uses system_profiler SPDisplaysDataType -json to detect Apple Silicon GPUs and unified memory via sysctl -n hw.memsize.
  • Other: Returns an empty GPU list.

No external dependencies required – pure sysfs/system_profiler scanning with optional subprocess calls for enrichment.

Structs§

GpuInfo
Detected GPU information

Functions§

detect_gpus
Scan the system for GPU devices via sysfs PCI enumeration (Linux only)