Snakepit.Hardware.Detector (Snakepit v0.8.7)

View Source

Unified hardware detection module.

Aggregates CPU, CUDA, MPS, and ROCm detection into a single hardware info structure. Results are cached in ETS for performance.

Summary

Functions

Returns hardware capability flags.

Clears the hardware detection cache.

Detects all hardware information.

Types

accelerator()

@type accelerator() :: :cpu | :cuda | :mps | :rocm

capabilities()

@type capabilities() :: %{
  cuda: boolean(),
  mps: boolean(),
  rocm: boolean(),
  avx: boolean(),
  avx2: boolean(),
  avx512: boolean(),
  cuda_version: String.t() | nil,
  cudnn_version: String.t() | nil,
  cudnn: boolean()
}

hardware_info()

@type hardware_info() :: %{
  accelerator: accelerator(),
  cpu: Snakepit.Hardware.CPUDetector.cpu_info(),
  cuda: Snakepit.Hardware.CUDADetector.cuda_info() | nil,
  mps: Snakepit.Hardware.MPSDetector.mps_info() | nil,
  rocm: Snakepit.Hardware.ROCmDetector.rocm_info() | nil,
  platform: String.t()
}

Functions

capabilities()

@spec capabilities() :: capabilities()

Returns hardware capability flags.

Returns a map of boolean capability flags for quick feature checks.

clear_cache()

@spec clear_cache() :: :ok

Clears the hardware detection cache.

Forces re-detection on next call to detect/0 or capabilities/0.

detect()

@spec detect() :: hardware_info()

Detects all hardware information.

Returns a map with aggregated hardware info from all detectors. Results are cached for performance.