Skip to main content

Crate gpu_probe

Crate gpu_probe 

Source
Expand description

Cross-platform GPU memory (VRAM) detection with no vendor SDKs.

gpu_probe reports the GPUs visible on the host and how much memory each has, using only facilities the OS or driver already ship:

  • NVIDIA (Linux, Windows): NVML (libnvidia-ml) via nvml-wrapper, loaded at runtime. The CUDA toolkit is not required and nothing links at build time. Behind the default nvidia feature.
  • AMD & Intel (Linux): DRM sysfs under /sys/class/drm. Discrete cards report dedicated VRAM; integrated GPUs report the shared system-memory ceiling (see GpuInfo::total_bytes).
  • Apple/macOS: system_profiler + sysctl (Apple Silicon reports unified memory).

Detection is best-effort: detect returns an empty Vec when no GPU is found or the platform is unsupported — never an error.

for gpu in gpu_probe::detect() {
    println!("{gpu}");
}

Structs§

ComputeCapability
CUDA compute capability, e.g. 8.6 for sm_86.
CudaHost
Host-wide CUDA properties reported by the NVIDIA driver.
CudaVersion
A CUDA version, e.g. 12.9.
GpuInfo
A single detected GPU and its memory.

Enums§

Vendor
GPU hardware vendor.

Functions§

cuda_host
Host-wide CUDA properties, or None when NVML is unavailable — no NVIDIA driver, the nvidia feature disabled, no device, or a driver reporting values that aren’t usable.
detect
Detect all GPUs visible on the host.