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 _init_group_test(self): group = [1, 2] group_id = dist.new_group(group) rank = dist.get_rank() if rank not in group: return ([], None, rank) return (group, group_id, rank)
def test_get_rank_size_group(self): if dist.get_world_size() > 2: group = [1, 2] else: group = [0, 1] group_id = dist.new_group(group) if dist.get_rank() in group: self.assertEqual(dist.get_world_size(group_id), 2) self.assertTrue(dist.get_rank(group_id) in list(range(2))) else: self.assertEqual(dist.get_world_size(group_id), -1) self.assertEqual(dist.get_rank(group_id), -1)
def _init_full_group_test(self): group = [i for i in range(0, dist.get_world_size())] group_id = dist.new_group() rank = dist.get_rank() return (group, group_id, rank)