The Partial Sum Problem

A weight matrix is sharded along its contraction (inner) dimension across 4 GPUs, so each GPU computes a partial sum contributing to every element of the output. Which collective operation is required to produce the correct final output on all GPUs?

A

All-gather

B

All-reduce

C

All-to-all

D

Broadcast