Skip to content

Commit 18fa74c

Browse files
committed
Remove unnecessary dist.barrier()
1 parent 7187e3f commit 18fa74c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

intermediate_source/ddp_tutorial.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ and elasticity support, please refer to `TorchElastic <https://pytorch.org/elast
209209
loss_fn(outputs, labels).backward()
210210
optimizer.step()
211211
212-
# Use a barrier() to make sure that all processes have finished reading the
213-
# checkpoint
214-
dist.barrier()
212+
# Not necessary to use a dist.barrier() to guard the file deletion below
213+
# as the AllReduce ops in the backward pass of DDP already served as
214+
# a synchronization.
215215
216216
if rank == 0:
217217
os.remove(CHECKPOINT_PATH)

0 commit comments

Comments
 (0)