Skip to content

Commit a7094e3

Browse files
teng-liPenghuiCheng
authored andcommitted
flaky test fix trial (pytorch#11391)
Summary: Add a barrier() to wait for all PG created before destroy Pull Request resolved: pytorch#11391 Differential Revision: D9727383 Pulled By: teng-li fbshipit-source-id: 689d62c978e642b68f4949dcf29982e34869ada4
1 parent d08b733 commit a7094e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/test_distributed.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def test_destroy_group(self):
241241
else:
242242
group = [0, 1]
243243
group_id = dist.new_group(group)
244+
self._barrier()
244245
dist.destroy_process_group(group_id)
245246

246247
# Test get rank and size of group
@@ -260,6 +261,7 @@ def test_get_rank_size_group(self):
260261
# Test destroy full groups
261262
def test_destroy_full_group(self):
262263
_, group_id, _ = self._init_full_group_test()
264+
self._barrier()
263265
dist.destroy_process_group(group_id)
264266

265267
# Test get rank and size of full group
@@ -1272,6 +1274,7 @@ def _run(self, rank):
12721274
# self.id() == e.g. '__main__.TestDistributed.test_get_rank'
12731275
# We're retreiving a corresponding test and executing it.
12741276
getattr(self, self.id().split(".")[2])()
1277+
self._barrier()
12751278
dist.destroy_process_group()
12761279
sys.exit(0)
12771280

0 commit comments

Comments
 (0)