xnn.common.distributed#
Process-group helpers shared by training and benchmarking.
xnn’s multi-GPU / multi-node support is native torch.distributed driven
purely by the environment: a launcher such as torchrun (or Slurm plus
torchrun) exports RANK / LOCAL_RANK / WORLD_SIZE into every process
it spawns, and the code paths here switch on those variables. A plain
python / xnn invocation sees WORLD_SIZE unset and runs the
unchanged single-process pipeline. No framework wrapper is involved; these are
the handful of primitives the Trainer and the
Benchmark share so they cannot drift apart.
Functions
|
Concatenate a flat tensor from every rank, in rank order. |
|
Sum a list of scalars over all ranks (identity outside a distributed run). |
|
Synchronize all ranks (a no-op outside a distributed run). |
|
Tear down the process group if |
|
Join the launcher's process group, if there is one. |
Whether this process was spawned by a distributed launcher. |
|
|
Whether this process is rank 0 (the one that prints and writes). |
|
Merge a small picklable dict over all ranks (identity outside a distributed run). |
|
This process's global rank (0 when not launched distributed). |
The dataset indices this rank scores: every |
|
Number of processes in the distributed launch (1 when not launched). |