Skip to content

Commit 1bcb2bf

Browse files
authored
Update all hf examples to have dist.barrier (#1139)
Without having `dist.barrier()`, all of the HF examples wind up hanging since we're destroying the pg before all comms have completed in these small examples, leading to a hang. This PR adds `dist.barrier()` just before `dist.destroy_process_group()` to fix this.
1 parent b8e01c2 commit 1bcb2bf

18 files changed

+18
-0
lines changed

examples/huggingface/pippy_bert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def run(args):
7373
else:
7474
out = schedule.step()
7575

76+
dist.barrier()
7677
dist.destroy_process_group()
7778
print(f"Rank {args.rank} completes")
7879

examples/huggingface/pippy_blenderbot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_camemBert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_convBert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def run(args):
7575
else:
7676
out = schedule.step()
7777

78+
dist.barrier()
7879
dist.destroy_process_group()
7980
print(f"Rank {args.rank} completes")
8081

examples/huggingface/pippy_deberta.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def run(args):
7373
else:
7474
out = schedule.step()
7575

76+
dist.barrier()
7677
dist.barrier()
7778
dist.destroy_process_group()
7879
print(f"Rank {args.rank} completes")

examples/huggingface/pippy_debertaV2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def run(args):
7878
else:
7979
out = schedule.step()
8080

81+
dist.barrier()
8182
dist.destroy_process_group()
8283
print(f"Rank {args.rank} completes")
8384

examples/huggingface/pippy_electra.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_fnet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_gpt2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def run(args):
7777
else:
7878
out = schedule.step()
7979

80+
dist.barrier()
8081
dist.destroy_process_group()
8182
print(f"Rank {args.rank} completes")
8283

examples/huggingface/pippy_gptNeo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def run(args):
7272
else:
7373
out = schedule.step()
7474

75+
dist.barrier()
7576
dist.destroy_process_group()
7677
print(f"Rank {args.rank} completes")
7778

examples/huggingface/pippy_layoutLM.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def run(args):
7373
else:
7474
out = schedule.step()
7575

76+
dist.barrier()
7677
dist.destroy_process_group()
7778
print(f"Rank {args.rank} completes")
7879

examples/huggingface/pippy_mbart.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_megatronBert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_mobileBert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def run(args):
7070
else:
7171
out = schedule.step()
7272

73+
dist.barrier()
7374
dist.destroy_process_group()
7475
print(f"Rank {args.rank} completes")
7576

examples/huggingface/pippy_opt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_trOCR.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

examples/huggingface/pippy_unet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def run(args):
6565
else:
6666
out = schedule.step()
6767

68+
dist.barrier()
6869
dist.destroy_process_group()
6970
print(f"Rank {args.rank} completes")
7071

examples/huggingface/pippy_xlnet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(args):
7171
else:
7272
out = schedule.step()
7373

74+
dist.barrier()
7475
dist.destroy_process_group()
7576
print(f"Rank {args.rank} completes")
7677

0 commit comments

Comments
 (0)