docsapi referencedarkforest-cluster-ring-ringallreduce
API Referencecrate: darkforest-clustersince v0.1.0-alpha

RingAllReduce

Bandwidth-optimal ring all-reduce algorithm splitting tensors into 2*(N-1) ring transfers.

RingAllReduce

darkforest-cluster module: ring 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
allreduce.all_reduce_sum(&mut gradient_tensor);

Related Components