Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Jun 28, 2021
1 parent 83e9bcb commit 16f94e5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pytorch_lightning/plugins/training_type/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,17 @@ def post_dispatch(self) -> None:
self.cluster_environment.teardown()

def barrier(self, *args, **kwargs):
if torch_distrib.is_initialized():
if self.global_rank == 0:
import time
print("sleeping to test barrier")
time.sleep(10)
if not torch_distrib.is_initialized():
return

if self.global_rank == 0:
import time
print("sleeping to test barrier")
time.sleep(10)
if _TORCH_GREATER_EQUAL_1_8:
torch_distrib.barrier(device_ids=self.determine_ddp_device_ids())
else:
torch_distrib.barrier()

def broadcast(self, obj: object, src: int = 0) -> object:
return self.dist.broadcast(obj)
Expand Down

0 comments on commit 16f94e5

Please sign in to comment.