Expand description
Multi-rank gradient averaging for Tier-2 training.
Each process/rank:
- writes local gradients into a shared
sync_dir - rank 0 averages them and writes the result
- every rank loads the averaged gradients before
optimizer.step
This is slower than GPU collectives, but it is a working Python-free multi-process path without pulling in MPI/NCCL.
Structs§
- File
Grad Sync Config - Settings for averaging gradients across processes through files in a shared directory (a prototype for multi-process data parallelism).
Functions§
- average_
grads_ file_ sync - Average
gradsacross ranks and overwrite them in place. - average_
host_ grads - Average host-side parameter vectors (unit-testable without GPU).
- shard_
indices - Select sample indices owned by
rankin a world ofworld_size.