Skip to content

Commit cc99baf

Browse files
authored
[Misc] Make timeout passable in init_distributed_environment (#24522)
Signed-off-by: jberkhahn <[email protected]>
1 parent dcb28a3 commit cc99baf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

vllm/distributed/parallel_state.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from collections import namedtuple
3030
from contextlib import contextmanager, nullcontext
3131
from dataclasses import dataclass
32+
from datetime import timedelta
3233
from multiprocessing import shared_memory
3334
from typing import Any, Callable, Optional, Union
3435
from unittest.mock import patch
@@ -978,13 +979,12 @@ def set_custom_all_reduce(enable: bool):
978979
_ENABLE_CUSTOM_ALL_REDUCE = enable
979980

980981

981-
def init_distributed_environment(
982-
world_size: int = -1,
983-
rank: int = -1,
984-
distributed_init_method: str = "env://",
985-
local_rank: int = -1,
986-
backend: str = "nccl",
987-
):
982+
def init_distributed_environment(world_size: int = -1,
983+
rank: int = -1,
984+
distributed_init_method: str = "env://",
985+
local_rank: int = -1,
986+
backend: str = "nccl",
987+
timeout: Optional[timedelta] = None):
988988
logger.debug(
989989
"world_size=%d rank=%d local_rank=%d "
990990
"distributed_init_method=%s backend=%s", world_size, rank, local_rank,
@@ -1020,7 +1020,8 @@ def init_distributed_environment(
10201020
backend=backend,
10211021
init_method=distributed_init_method,
10221022
world_size=world_size,
1023-
rank=rank)
1023+
rank=rank,
1024+
timeout=timeout)
10241025
# set the local rank
10251026
# local_rank is not available in torch ProcessGroup,
10261027
# see https://github.com/pytorch/pytorch/issues/122816

0 commit comments

Comments
 (0)