A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 03:30 UTC
[Refactor] Remove duplicate `find_free_port` (#20333)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Wentao Ye committed
Jul 1, 2025 at 22:03 UTC
7058d7dd5d47185c738ad541c564e70b315690fc
2 files changed
+2
-11
tests/kernels/moe/utils.py
+2
-2
@@ -14,7 +14,7 @@ from torch.multiprocessing import (
14
spawn) # pyright: ignore[reportPrivateImportUsage]
15
from typing_extensions import Concatenate, ParamSpec
16
17
-from vllm.model_executor.layers.fused_moe.utils import find_free_port
17
+from vllm.utils import get_open_port
18
19
has_deep_ep = importlib.util.find_spec("deep_ep") is not None
20
if has_deep_ep:
@@ -95,7 +95,7 @@ def parallel_launch(
95
world_size,
96
world_size,
97
0,
98
- f"tcp://{os.getenv('LOCALHOST', 'localhost')}:{find_free_port()}",
98
+ f"tcp://{os.getenv('LOCALHOST', 'localhost')}:{get_open_port()}",
99
worker,
100
) + args,
101
nprocs=world_size,
vllm/model_executor/layers/fused_moe/utils.py
-9
@@ -1,7 +1,5 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-import socket
4
-from contextlib import closing
3
from math import prod
4
from typing import Optional
5
@@ -98,10 +96,3 @@ def _fp8_perm(m: torch.Tensor, idx: torch.Tensor) -> torch.Tensor:
96
return m.view(dtype=torch.uint8)[idx, ...].view(dtype=m.dtype)
97
else:
98
return m[idx, ...]
101
-
102
-
103
-def find_free_port():
104
- with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
105
- s.bind(('', 0))
106
- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
107
- return s.getsockname()[1]