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 5
5
import dataclasses
6
6
import importlib
7
7
import os
8
- import socket
9
8
import traceback
10
- from contextlib import closing
11
9
from typing import Callable , Optional
12
10
13
11
import torch
16
14
spawn ) # pyright: ignore[reportPrivateImportUsage]
17
15
from typing_extensions import Concatenate , ParamSpec
18
16
17
+ from vllm .utils import get_open_port
18
+
19
19
has_deep_ep = importlib .util .find_spec ("deep_ep" ) is not None
20
20
if has_deep_ep :
21
21
from vllm .model_executor .layers .fused_moe .deepep_ht_prepare_finalize import ( # noqa: E501
@@ -82,13 +82,6 @@ def _worker_parallel_launch(
82
82
torch .distributed .destroy_process_group ()
83
83
84
84
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
-
92
85
def parallel_launch (
93
86
world_size : int ,
94
87
worker : Callable [Concatenate [ProcessGroupInfo , P ], None ],
@@ -102,7 +95,7 @@ def parallel_launch(
102
95
world_size ,
103
96
world_size ,
104
97
0 ,
105
- f"tcp://{ os .getenv ('LOCALHOST' , 'localhost' )} :{ find_free_port ()} " ,
98
+ f"tcp://{ os .getenv ('LOCALHOST' , 'localhost' )} :{ get_open_port ()} " ,
106
99
worker ,
107
100
) + args ,
108
101
nprocs = world_size ,
You can’t perform that action at this time.
0 commit comments