Expand description
--gpus flag parsing + single-host cluster envelope synthesis (loopback,
one host, N ranks). Used when --gpus is set on a cluster-aware command
and no cluster: block is configured in YAML.
--gpus flag parsing + single-host cluster envelope synthesis.
The --gpus flag has uniform semantics (“use these GPUs”) but the
mechanism depends on the command kind:
-
Cluster-aware commands (
cluster: true): N >= 2 GPUs trigger synthesis of a single-host cluster envelope (master=127.0.0.1, lo transport, one host with N ranks) and spawn-per-rank via the existing launcher (seecrate::cluster::prepare_cluster_env). The library inside each spawned process reads the envelope fromFLODL_INTERNAL_CLUSTER_JSONand uses the same code path as multi-host. N = 1 is degenerate — no synthesis, just runs single-process on that device. -
Non-cluster commands (
test,clippy, etc.):--gpussetsCUDA_VISIBLE_DEVICESon the single child process. No envelope, no spawning. Tests internally manage their own multi-rank coordination (typically via the threadedNcclRankCommpattern in unit tests).
Caller (main.rs) decides which mechanism applies based on whether the
resolved command’s cluster: chain enables dispatch.
Enums§
- Gpus
Spec - Parsed
--gpusargument value.
Functions§
- apply_
cuda_ ⚠visible_ devices - Set
CUDA_VISIBLE_DEVICESto restrict the spawned process to the given physical CUDA device indices. - count_
visible_ gpus_ via_ nvidia_ smi - Count visible CUDA devices via
nvidia-smi -L. - synthesize_
local_ cluster - Build a
ClusterConfigfor single-host loopback from a list of physical CUDA device indices.