class_docstr: Represents a set of processes that work collectively.
class_docstr_tok: ["Represents","a","set","of","processes","that","work","collectively","."]
docstr: :param rank:
      The rank of this process in the gang.
  :param size:
      The number of processes that are part of the gang.
  :param device:
      The associated device.
docstr_tok: [":","param","rank",":","The","rank","of","this","process","in","the","gang",".",":","param","size",":","The","number","of","processes","that","are","part","of","the","gang",".",":","param","device",":","The","associated","device","."]
code: def __init__(self, rank: int, size: int, device: Device) -> None:
      """
      :param rank:
          The rank of this process in the gang.
      :param size:
          The number of processes that are part of the gang.
      :param device:
          The associated device.
      """
      self.rank = rank
      self.size = size
  
      self.device = device
  
imports: import logging
  import os
  from abc import ABC, abstractmethod
  from datetime import timedelta
  from enum import Enum
  from typing import Optional, final
  import torch
  import torch.distributed
  from torch import Tensor
  from torch.distributed import ProcessGroup, ReduceOp
  from fairseq2.typing import CPU, Device, finaloverride
label_desc: Use image node_id 1 to create a new Gang object from inherited base classes: ABC with example: obj = Gang(rank, size, device)