code: def __init__(self, ranks, rank_in_group):
      self.stream1 = torch.cuda.Stream()
      self.stream2 = torch.cuda.Stream()
      self.stream3 = torch.cuda.Stream()
      self.group_size = len(ranks)
      self.ranks = ranks
      self.rank_in_group = rank_in_group
      self.wrap_around_left_rank_in_group = (
          rank_in_group + self.group_size - 1
      ) % self.group_size
      self.wrap_around_right_rank_in_group = (
          rank_in_group + 1
      ) % self.group_size
      self.left_rank = (
          ranks[rank_in_group - 1] if rank_in_group > 0 else -1
      )
      self.left_zero = True if rank_in_group == 0 else False
      self.right_rank = (
          ranks[rank_in_group + 1]
          if rank_in_group < self.group_size - 1
          else -1
      )
      self.right_zero = (
          True if rank_in_group == self.group_size - 1 else False
      )
  
imports: import torch
  import torch.distributed
  from torch import nn
  import nccl_p2p_cuda
  import peer_memory_cuda
label_desc: Use image node_id 1 to create a new HaloExchanger object from inherited base classes: object with example: obj = HaloExchanger(ranks, rank_in_group)