support one node communication group

This commit is contained in:
yao_yf 2020-04-21 20:22:01 +08:00
parent 7fbaf2f629
commit 371b3338b6
2 changed files with 3 additions and 3 deletions

View File

@ -334,8 +334,8 @@ def _create_group_helper(group, rank_ids, backend):
if not isinstance(rank_ids, list): if not isinstance(rank_ids, list):
raise TypeError("Rank_ids {} should be list".format(rank_ids)) raise TypeError("Rank_ids {} should be list".format(rank_ids))
rank_size = len(rank_ids) rank_size = len(rank_ids)
if rank_size < 2: if rank_size < 1:
raise ValueError("Rank_ids size {} should be large than 1".format(rank_size)) raise ValueError("Rank_ids size {} should be large than 0".format(rank_size))
if len(rank_ids) - len(list(set(rank_ids))) > 0: if len(rank_ids) - len(list(set(rank_ids))) > 0:
raise ValueError("List rank_ids in Group {} has duplicate data!".format(group)) raise ValueError("List rank_ids in Group {} has duplicate data!".format(group))
hccl.create_group(group, rank_size, rank_ids) hccl.create_group(group, rank_size, rank_ids)

View File

@ -99,7 +99,7 @@ def test_raise_error_funcs():
assert has_raise_error(create_backend, 'nccl') is False assert has_raise_error(create_backend, 'nccl') is False
assert has_raise_error(get_group_size_int, 123) is True assert has_raise_error(get_group_size_int, 123) is True
assert has_raise_error(create_group0, (0,1)) is True assert has_raise_error(create_group0, (0,1)) is True
assert has_raise_error(create_group1, [0]) is True assert has_raise_error(create_group1, [0]) is False
assert has_raise_error(create_group2, [0,0,1]) is True assert has_raise_error(create_group2, [0,0,1]) is True
assert has_raise_error(create_group3, [0,1]) is True assert has_raise_error(create_group3, [0,1]) is True
assert has_raise_error(create_group4, [0,1]) is False assert has_raise_error(create_group4, [0,1]) is False