RingAllReduce
darkforest-core
module: cluster
since v0.1.0-alpha
Signature
rust
pub struct RingAllReduce { ring: TcpRing, chunk_size: usize }
Overview
Bandwidth-optimal ring all-reduce algorithm splitting tensors into 2*(N-1) ring transfers.
Invariants & Design Principles
- Invariant: Data transferred per node equals 2 * (N - 1) / N * tensor_size, independent of world size.
- Invariant: Lock-free chunk buffer exchange.
Usage Example
rust
let mut allreduce = RingAllReduce::new(ring, 1024 * 1024);
allreduce.all_reduce_sum(&mut gradient_tensor)?;