Gang
- class fairseq2.gang.Gang[source]
Bases:
ABC
Represents a set of processes that work collectively.
- abstract all_gather(output_tensor, input_tensor)[source]
Gather tensors from all processes and put them in
output_tensor
.
- abstract all_gather_to_list(output_tensors, input_tensor)[source]
Gather tensors from all processes and put them in
output_tensors
.
- abstract all_reduce(tensor, op)[source]
Reduce
tensor
across all processes.- Parameters:
tensor (Tensor) – The input and output tensor of the operation.
op (ReduceOperation) – The element-wise reduce operation.
- abstract broadcast(tensor, source_rank=0)[source]
Broadcast
tensor
fromsource_rank
to all processes.
- abstract broadcast_objects(objects, source_rank=0)[source]
Broadcast picklable
objects
fromsource_rank
to all processes.