Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[train] Update Torch default timeout_s to use Torch's default timeout #45501

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions python/ray/train/torch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ class TorchConfig(BackendConfig):
for environment variable initialization or "tcp" for TCP
initialization. Defaults to "env".
timeout_s: Seconds for process group operations to timeout.
Default value is None, which will use Torch's default timeout.
"""

backend: Optional[str] = None
init_method: str = "env"
timeout_s: int = 1800
timeout_s: Optional[int] = None

@property
def backend_cls(self):
Expand All @@ -67,7 +68,7 @@ def _setup_torch_process_group(
world_rank: int,
world_size: int,
init_method: str,
timeout_s: int = 1800,
timeout_s: Optional[int] = None,
):
"""Connects the distributed PyTorch backend.

Expand Down Expand Up @@ -109,12 +110,14 @@ def _setup_torch_process_group(
import habana_frameworks.torch.core as htcore # noqa: F401
import habana_frameworks.torch.distributed.hccl as hpu_dist # noqa: F401

timeout = timedelta(seconds=timeout_s) if timeout_s is not None else None

dist.init_process_group(
backend=backend,
init_method=init_method,
rank=world_rank,
world_size=world_size,
timeout=timedelta(seconds=timeout_s),
timeout=timeout,
)


Expand Down
Loading