Lesson 29← back to roadmap
GpuDeviceManager probes whatever was compiled in. GpuSelector picks the best device that matches policy.
Probe order (docs/internals/gpu-engine.md): Metal (Apple), CUDA, HIP, SYCL, Vulkan. Each probe init+inspect+shutdowns the backend inside a try/catch. Devices are then sorted by CAGRA support, then by total device memory descending.
- GpuPolicy::CpuOnly — selector returns nullopt; never touches GPU
- GpuPolicy::PreferGpu — uses best probed device or falls back to CPU
- GpuPolicy::RequireGpu — returns nullopt (fatal) if no enabled backend matches