Skip to main content

Module device

Module device 

Source
Expand description

Device — selector for the training backend (apr pretrain).

Contract binding: contracts/entrenar/gpu-training-backend-v1.yaml §device_dispatch.

The string grammar accepted by resolve_device is fixed by INV-GPUTRAIN-001 / §device_dispatch.requested_device.grammar:

^(cpu|cuda(:[0-9]|:1[0-5])?|auto)$
  • cpu — force the CPU (trueno SIMD) training path.
  • cuda — alias for cuda:0.
  • cuda:N (0..=15)— explicit CUDA device index.
  • autocuda:0 if cuda_training_available(), else cpu.

The auto resolution is NOT a silent fallback: callers are obliged by GATE-GPUTRAIN-002 to print the resolved Device before starting training so the operator sees which backend was actually selected.

Explicit cuda / cuda:N on a host without a usable CUDA runtime MUST return DeviceError::CudaNotAvailable. FALSIFY-GPUTRAIN-002 binds this invariant.

Enums§

Device
Training backend selection.
DeviceError
Failure modes for resolve_device.

Functions§

resolve_device
Resolve a CLI --device string into a concrete Device.