Skip to content

Commit db33d8f

Browse files
committed
fix merge
Signed-off-by: Bill Nell <bnell@redhat.com>
1 parent e635a37 commit db33d8f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

tests/kernels/moe/parallel_utils.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import dataclasses
66
import importlib
77
import os
8-
import socket
98
import traceback
10-
from contextlib import closing
119
from typing import Callable, Optional
1210

1311
import torch
@@ -16,6 +14,8 @@
1614
spawn) # pyright: ignore[reportPrivateImportUsage]
1715
from typing_extensions import Concatenate, ParamSpec
1816

17+
from vllm.utils import get_open_port
18+
1919
has_deep_ep = importlib.util.find_spec("deep_ep") is not None
2020
if 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-
9285
def 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,

0 commit comments

Comments
 (0)