mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: Original: D81957844 and D81957923 Also, https://github.com/pytorch/pytorch/pull/162142 is patched in as well #buildall Test Plan: sandcastle and oss ci Rollback Plan: Reviewed By: H-Huang Pull Request resolved: https://github.com/pytorch/pytorch/pull/162594 Approved by: https://github.com/H-Huang, https://github.com/dcci
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
from datetime import timedelta
|
|
from typing import Optional
|
|
|
|
# Import from centralized fallback module - no ImportError handling needed
|
|
from torch.distributed._distributed_c10d import (
|
|
_DEFAULT_PG_NCCL_TIMEOUT,
|
|
_DEFAULT_PG_TIMEOUT,
|
|
)
|
|
|
|
|
|
__all__ = ["default_pg_timeout", "default_pg_nccl_timeout"]
|
|
|
|
# Default process group wide timeout, if applicable.
|
|
# This only applies to the non-nccl backends
|
|
# To make an attempt at backwards compatibility with THD, we use an
|
|
# extraordinarily high default timeout, given that THD did not have timeouts.
|
|
default_pg_timeout: timedelta = _DEFAULT_PG_TIMEOUT
|
|
# Separate timeout for PGNCCL mainly because it's always been that way in the C++ layer, but until recently
|
|
# there was one default that applied across all backends in the python layer.
|
|
# Later, we could consider merging them back together at the c++ layer if we can align on a same value.
|
|
# (only if TORCH_NCCL_BLOCKING_WAIT or TORCH_NCCL_ASYNC_ERROR_HANDLING is set to 1).
|
|
|
|
default_pg_nccl_timeout: Optional[timedelta] = _DEFAULT_PG_NCCL_TIMEOUT
|