From 371b3338b6cb8789294e0e60a07efc9b06dadc39 Mon Sep 17 00:00:00 2001 From: yao_yf Date: Tue, 21 Apr 2020 20:22:01 +0800 Subject: [PATCH] support one node communication group --- mindspore/communication/_comm_helper.py | 4 ++-- tests/ut/python/communication/test_management_api.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/communication/_comm_helper.py b/mindspore/communication/_comm_helper.py index 099c8cfc2d7..508aa2e7a9a 100644 --- a/mindspore/communication/_comm_helper.py +++ b/mindspore/communication/_comm_helper.py @@ -334,8 +334,8 @@ def _create_group_helper(group, rank_ids, backend): if not isinstance(rank_ids, list): raise TypeError("Rank_ids {} should be list".format(rank_ids)) rank_size = len(rank_ids) - if rank_size < 2: - raise ValueError("Rank_ids size {} should be large than 1".format(rank_size)) + if rank_size < 1: + raise ValueError("Rank_ids size {} should be large than 0".format(rank_size)) if len(rank_ids) - len(list(set(rank_ids))) > 0: raise ValueError("List rank_ids in Group {} has duplicate data!".format(group)) hccl.create_group(group, rank_size, rank_ids) diff --git a/tests/ut/python/communication/test_management_api.py b/tests/ut/python/communication/test_management_api.py index c455c5491b9..d624c5ab592 100644 --- a/tests/ut/python/communication/test_management_api.py +++ b/tests/ut/python/communication/test_management_api.py @@ -99,7 +99,7 @@ def test_raise_error_funcs(): assert has_raise_error(create_backend, 'nccl') is False 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_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_group3, [0,1]) is True assert has_raise_error(create_group4, [0,1]) is False