def test_destroy_group(self):
     if dist.get_world_size() > 2:
         group = [1, 2]
     else:
         group = [0, 1]
     group_id = dist.new_group(group)
     dist.destroy_process_group(group_id)
 def _run(self, rank):
     self.rank = rank
     try:
         dist.init_process_group(init_method=INIT_METHOD,
                                 backend=BACKEND,
                                 world_size=int(WORLD_SIZE),
                                 rank=self.rank)
     except RuntimeError as e:
         if "recompile" in e.args[0]:
             sys.exit(SKIP_IF_BACKEND_UNAVAILABLE)
             # sys.exit(0)
         raise
     # self.id() == e.g. '__main__.TestDistributed.test_get_rank'
     # We're retreiving a corresponding test and executing it.
     getattr(self, self.id().split(".")[2])()
     dist.destroy_process_group()
     sys.exit(0)
 def test_destroy_full_group(self):
     _, group_id, _ = self._init_full_group_test()
     dist.destroy_process_group(group_id)