Skip to content

Commit

Permalink
update ddp
Browse files Browse the repository at this point in the history
  • Loading branch information
uniartisan committed Dec 20, 2024
1 parent 396ce2c commit ee8935e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions src/lightning/fabric/strategies/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,7 @@ def _create_stream_context(self, device_ids=None):

torch_lib = getattr(torch, self.root_device.type)
# Check if the device type supports streams and has the necessary attributes.
if (
hasattr(torch_lib, "Stream")
and hasattr(torch_lib, "stream")
and device_ids is not None
):
# ctx = torch.cuda.stream(torch.cuda.Stream()) if device_ids is not None else nullcontext()
if hasattr(torch_lib, "Stream") and hasattr(torch_lib, "stream") and device_ids is not None:
stream = torch_lib.Stream()
ctx = torch_lib.stream(stream)
else:
Expand Down
6 changes: 1 addition & 5 deletions src/lightning/pytorch/strategies/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,7 @@ def _create_stream_context(self, device_ids=None):

torch_lib = getattr(torch, self.root_device.type)
# Check if the device type supports streams and has the necessary attributes.
if (
hasattr(torch_lib, "Stream")
and hasattr(torch_lib, "stream")
and device_ids is not None
):
if hasattr(torch_lib, "Stream") and hasattr(torch_lib, "stream") and device_ids is not None:
# ctx = torch.cuda.stream(torch.cuda.Stream()) if device_ids is not None else nullcontext()
stream = torch_lib.Stream()
ctx = torch_lib.stream(stream)
Expand Down

0 comments on commit ee8935e

Please sign in to comment.