elips/docs
Chapter XV · GPU

Backends, device probe, selection

GpuDeviceManager probes whatever was compiled in. BackendSelector picks the best device that matches policy.

Probe order (docs/internals/gpu-engine.md): Metal (Apple), CUDA, HIP. Each probe init+inspect+shutdowns the backend inside a try/catch. Devices are then sorted by total device memory descending.

Backend maturity

  • Metal — implemented (Beta, M4-validated), default ON on Apple; distance + top-k kernels
  • CUDA — experimental
  • HIP / ROCm — experimental
  • CPU — always available; the fallback path

Select a device from Python

python
import elips

for acc in elips.accelerators():
    print(acc.name, acc.backend, acc.memory_bytes, acc.unified_memory)

# device=: "cpu" | "auto" | "metal" | "cuda:N" | "hip:N"  (NOT gpu=True)
client = elips.Client(dimension=128, device="metal", fallback=True)
print(client.native.gpu_info())
  • device='auto' — best probed device, else CPU
  • device='cpu' — never touches the GPU
  • device='cuda:0'/'hip:0'/'metal' — a named backend; raises BackendUnavailableError if absent unless fallback=True
N CPU querieslatency-boundQueryBatcherwindow_us · max_batchGpuBackend kernelcos · l2 · dottop-k resultsmergedwhy this wins1 launch ≫ N launches · one HBM trip · saturated SMsbackendsCUDA · HIP / ROCm · Metal — selected by BackendSelector
Probe → sort → select → initialize. Falls back when fallback=True.