For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo struct
DistributedAllReduceSum
struct DistributedAllReduceSum
Registers the mo.distributed.allreduce.sum graph op with the graph compiler.
Implemented traits
Methods
execute
static def execute[Outs: TypeList[Outs.values], Ins: TypeList[Ins.values], Sigs: TypeList[Sigs.values], //, _trace_name: StaticString, group_size: Int = Int(0)](outputs: TensorTuple[*Outs.values], inputs: TensorTuple[*Ins.values], signal_buffers: TensorTuple[*Sigs.values], dev_ctxs_input: DeviceContextArray)
Distributed allreduce operation implementation for sum reduction.
Limitations: - Maximum of 8 GPUs supported (matches MAX_GPUS in comm/sync.mojo) - Tensor element count must be multiple of SIMD width (per allreduce.mojo) - Requires identical tensor shapes within each allreduce group
Parameters:
- Outs (
TypeList[values]): The element types ofoutputs(inferred). - Ins (
TypeList[values]): The element types ofinputs(inferred). - Sigs (
TypeList[values]): The element types ofsignal_buffers(inferred). - _trace_name (
StaticString): Trace name for profiling. - group_size (
Int): Number of devices per independent allreduce group; must evenly divide the total number of devices. Zero (the attribute default) means all devices form one group.
Args:
- outputs (
TensorTuple[*Outs.values]): Output tensors (one per GPU) to store reduced results. - inputs (
TensorTuple[*Ins.values]): Input tensors (one per GPU) containing values to reduce. - signal_buffers (
TensorTuple[*Sigs.values]): Preallocated synchronization buffers for cross-GPU coordination. - dev_ctxs_input (
DeviceContextArray): Device contexts for participating GPUs.