File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 55import dataclasses
66import importlib
77import os
8- import socket
98import traceback
10- from contextlib import closing
119from typing import Callable , Optional
1210
1311import torch
1614 spawn ) # pyright: ignore[reportPrivateImportUsage]
1715from typing_extensions import Concatenate , ParamSpec
1816
17+ from vllm .utils import get_open_port
18+
1919has_deep_ep = importlib .util .find_spec ("deep_ep" ) is not None
2020if has_deep_ep :
2121 from vllm .model_executor .layers .fused_moe .deepep_ht_prepare_finalize import ( # noqa: E501
@@ -82,13 +82,6 @@ def _worker_parallel_launch(
8282 torch .distributed .destroy_process_group ()
8383
8484
85- def find_free_port ():
86- with closing (socket .socket (socket .AF_INET , socket .SOCK_STREAM )) as s :
87- s .bind (('' , 0 ))
88- s .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
89- return s .getsockname ()[1 ]
90-
91-
9285def parallel_launch (
9386 world_size : int ,
9487 worker : Callable [Concatenate [ProcessGroupInfo , P ], None ],
@@ -102,7 +95,7 @@ def parallel_launch(
10295 world_size ,
10396 world_size ,
10497 0 ,
105- f"tcp://{ os .getenv ('LOCALHOST' , 'localhost' )} :{ find_free_port ()} " ,
98+ f"tcp://{ os .getenv ('LOCALHOST' , 'localhost' )} :{ get_open_port ()} " ,
10699 worker ,
107100 ) + args ,
108101 nprocs = world_size ,
You can’t perform that action at this time.
0 commit comments