Skip to main content

GPU Selectors

Control which GPU device is used with the gpu(...) selector syntax.


Prefer vs Force

// Prefer discrete GPU (falls back to any available)
gpu (prefer: discrete) {
result is A @ B;
}

// Force discrete GPU (error if unavailable)
gpu (force: discrete) {
result is A @ B;
}

Full Selector Form

gpu (policy: GPUPolicy.Prefer, mode: GPUMode.Discrete) {
result is A + B;
}

Selector Options

KeyValuesDescription
preferdiscrete, integratedPrefer a device type, fallback to others
forcediscrete, integratedRequire a device type, error if missing
policyGPUPolicy.Prefer, GPUPolicy.ForceExplicit policy enum
mode / targetGPUMode.Discrete, GPUMode.IntegratedExplicit device enum

Without Selector

gpu { } without a selector uses the system default (typically the most powerful available GPU).


Next Steps