Ring all-reduce

Each of n workers holds a vector, and all-reduce must leave every worker with the elementwise sum. The workers form a ring in which each one sends only to its successor. Each vector is cut into n chunks, and every worker sends one chunk at every step, so every link in the ring is busy all the time.

Scatter-reduce (n−1 steps): each worker passes a chunk to its successor, which adds it to its own copy of that chunk. The chunks travel around the ring picking up one more term per step, and afterwards each worker holds one chunk that is fully summed. All-gather (n−1 more steps): the finished chunks travel around the ring the same way, but now each receiver simply overwrites its copy.

Compare tree all-reduce.

The colored bar under each value shows which workers' data it already includes. Before each step, a pair of arrows in the sender's color shows each chunk about to leave one worker and enter the next.

Who sends which chunk

Cost