Browse Source

refactor(mge/distributed): skip barrier when running with single node

GitOrigin-RevId: 6cd5a2e1e2
release-1.2
Megvii Engine Team 4 years ago
parent
commit
b9c37112a2
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      imperative/python/megengine/distributed/group.py

+ 3
- 0
imperative/python/megengine/distributed/group.py View File

@@ -173,5 +173,8 @@ def new_group(proc_ranks: List[int]) -> Group:


def group_barrier(group: Optional[Group] = WORLD) -> None: def group_barrier(group: Optional[Group] = WORLD) -> None:
"""Block until all ranks in the group reach this barrier.""" """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) assert isinstance(group, Group)
_sd.client.group_barrier(group.key, group.size) _sd.client.group_barrier(group.key, group.size)

Loading…
Cancel
Save