From b9c37112a22c2e0e3cc64ec08d643f3b5f9db63f Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 11 Dec 2020 14:53:38 +0800 Subject: [PATCH] refactor(mge/distributed): skip barrier when running with single node GitOrigin-RevId: 6cd5a2e1e2447b9b41a9b842e2656121aac36308 --- imperative/python/megengine/distributed/group.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imperative/python/megengine/distributed/group.py b/imperative/python/megengine/distributed/group.py index 0461091bd..aa52d8f49 100644 --- a/imperative/python/megengine/distributed/group.py +++ b/imperative/python/megengine/distributed/group.py @@ -173,5 +173,8 @@ def new_group(proc_ranks: List[int]) -> Group: def group_barrier(group: Optional[Group] = WORLD) -> None: """Block until all ranks in the group reach this barrier.""" + # if running with single node, skip it + if _sd is None: + return assert isinstance(group, Group) _sd.client.group_barrier(group.key, group.size) -- GitLab