Gang
-
class fairseq2.gang.Gang(rank, size, device)[source]
Bases: ABC
Represents a set of processes that work collectively.
- Parameters:
rank (int) – The rank of this process in the gang.
size (int) – The number of processes that are part of the gang.
device (device) – The associated device.
-
abstract all_gather(output_tensor, input_tensor)[source]
Gather tensors from all ranks and put them in a single tensor.
- Parameters:
-
-
abstract all_reduce(tensor, op)[source]
Reduce the tensor across all ranks.
- Parameters:
-
-
abstract as_process_group()[source]
Return this gang as a process group.
- Return type:
ProcessGroup
-
abstract barrier()[source]
Synchronize all ranks.