[BugFix] Reject invalid data-parallel RPC ports (#51469)
Signed-off-by: aoshen02 <aoshen@inferact.ai> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
@@ -380,6 +380,21 @@ def test_async_scheduling_with_pipeline_parallelism_is_allowed():
|
||||
assert cfg.scheduler_config.async_scheduling is True
|
||||
|
||||
|
||||
def test_data_parallel_rpc_port_has_fixed_default():
|
||||
assert ParallelConfig().data_parallel_rpc_port == 29550
|
||||
|
||||
|
||||
@pytest.mark.parametrize("port", [1, 29550, 65535])
|
||||
def test_data_parallel_rpc_port_accepts_valid_ports(port: int):
|
||||
assert ParallelConfig(data_parallel_rpc_port=port).data_parallel_rpc_port == port
|
||||
|
||||
|
||||
@pytest.mark.parametrize("port", [-1, 0, 65536])
|
||||
def test_data_parallel_rpc_port_rejects_invalid_ports(port: int):
|
||||
with pytest.raises(ValidationError):
|
||||
ParallelConfig(data_parallel_rpc_port=port)
|
||||
|
||||
|
||||
def test_reconfigure_for_independent_dp_rank_on_multinode_dense_model():
|
||||
parallel_config = ParallelConfig(
|
||||
tensor_parallel_size=8,
|
||||
|
||||
@@ -140,8 +140,8 @@ class ParallelConfig:
|
||||
"""Local rank of the data parallel group, set only in SPMD mode."""
|
||||
data_parallel_master_ip: str = "127.0.0.1"
|
||||
"""IP of the data parallel master."""
|
||||
data_parallel_rpc_port: int = 29550
|
||||
"""Port for data parallel messaging."""
|
||||
data_parallel_rpc_port: int = Field(default=29550, ge=1, le=65535)
|
||||
"""Fixed port for data parallel messaging, shared by all nodes."""
|
||||
data_parallel_master_port: int = 29500
|
||||
"""Port of the data parallel master."""
|
||||
data_parallel_backend: DataParallelBackend = "mp"
|
||||
|
||||
@@ -1100,7 +1100,8 @@ class EngineArgs:
|
||||
"--data-parallel-rpc-port",
|
||||
"-dpp",
|
||||
type=int,
|
||||
help="Port for data parallel RPC communication.",
|
||||
help="Fixed port for data parallel RPC communication. All nodes "
|
||||
"must use the same port.",
|
||||
)
|
||||
parallel_group.add_argument(
|
||||
"--data-parallel-backend",
|
||||
|
||||
@@ -1165,11 +1165,11 @@ def launch_core_engines(
|
||||
if parallel_config.enable_elastic_ep:
|
||||
handshake_local_only = False
|
||||
|
||||
# Preserve "port=0 means auto-pick" for the handshake address, which
|
||||
# is consumed by engines spawned in this process and so cannot defer
|
||||
# port resolution to bind time.
|
||||
rpc_port = parallel_config.data_parallel_rpc_port or get_open_port()
|
||||
handshake_address = get_engine_client_zmq_addr(handshake_local_only, host, rpc_port)
|
||||
handshake_address = get_engine_client_zmq_addr(
|
||||
handshake_local_only,
|
||||
host,
|
||||
parallel_config.data_parallel_rpc_port,
|
||||
)
|
||||
|
||||
if local_engines_only and dp_rank > 0:
|
||||
assert not handshake_local_only
|
||||
|
||||
Reference in New Issue
Block a user