Fix vLLM DP mode: one process per node instead of per GPU#152
Fix vLLM DP mode: one process per node instead of per GPU#152alec-flowers wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughvLLM backend now spawns one process per node for DP+EP (vLLM spawns per-GPU DP engines inside each node process). Changes
Sequence Diagram(s)sequenceDiagram
participant Orchestrator
participant NodeProcess as "Node Process\n(vLLM master)"
participant vLLM as "vLLM DP Engines\n(spawned per-GPU)"
participant GPU
Orchestrator->>NodeProcess: start process (includes kv_events_port, nixl_port, --data-parallel-size-local, --data-parallel-start-rank)
NodeProcess->>vLLM: invoke vLLM runtime (internal spawn)
vLLM->>GPU: spawn DP engine cores per GPU
GPU-->>vLLM: report readiness/events via kv_events_port/nixl_port
vLLM-->>NodeProcess: aggregate status
NodeProcess-->>Orchestrator: process ready
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/srtctl/backends/vllm.py (1)
174-181:⚠️ Potential issue | 🟡 MinorStale docstring — still says "each GPU runs its own process".
This contradicts the new per-node model. The docstring in
endpoints_to_processeswas correctly updated (line 195–197), but this one was missed.Proposed fix
def _is_dp_mode(self, mode: WorkerMode) -> bool: """Check if this mode uses Data Parallel + Expert Parallel pattern. - DP+EP mode is detected when data-parallel-size is set in the mode's config. - In this mode, each GPU runs its own process (rather than TP across GPUs). + DP+EP mode is detected when data-parallel-size is set in the mode's config. + In this mode, vLLM spawns per-GPU DP engine cores internally within each + per-node process (rather than TP across GPUs). """
🤖 Fix all issues with AI agents
In `@src/srtctl/backends/vllm.py`:
- Line 322: The current assignment to dp_rpc_port pops "data-parallel-rpc-port"
and then uses or to fall back to popping "data_parallel_rpc_port", which can
leave the second key in config and produce duplicate CLI flags; change the logic
in the same block in _config_to_cli_args (where dp_rpc_port is set) to
explicitly pop both keys separately (e.g., first pop "data-parallel-rpc-port"
with a default None, then pop "data_parallel_rpc_port" with a default None and
use the first non-None value) so that both variants are removed from config and
only a single --data-parallel-rpc-port flag is emitted.
🧹 Nitpick comments (1)
tests/test_configs.py (1)
1002-1013: Fragile value assertions —"0"and"8"match unintended positions incmd0.
assert "0" in cmd0passes trivially because"10.0.0.1"is not"0", but e.g."0"could appear as part of other flag values. More critically, if--data-parallel-start-rankever changes from"0"to another value, this assertion wouldn't catch it precisely.The non-leader test on lines 1026–1027 uses the better index-based pattern. Consider doing the same here for
--data-parallel-size-localand--data-parallel-start-rank.Proposed fix for precise assertions
assert "--data-parallel-size-local" in cmd0 - assert "8" in cmd0 # 8 GPUs per node - assert "--data-parallel-start-rank" in cmd0 - assert "0" in cmd0 # start_rank = 0 * 8 = 0 + idx_local = cmd0.index("--data-parallel-size-local") + assert cmd0[idx_local + 1] == "8" # 8 GPUs per node + idx_start = cmd0.index("--data-parallel-start-rank") + assert cmd0[idx_start + 1] == "0" # start_rank = 0 * 8 = 0
vLLM handles spawning per-GPU DP engine cores internally, so srtslurm should launch one container per node with all GPUs visible. The previous per-GPU approach caused NVSHMEM IPC failures (DeepEP low-latency backend requires shared memory between GPU processes on the same node). - endpoints_to_processes(): Create one Process per node with all GPUs instead of one Process per GPU - build_worker_command(): Replace --data-parallel-rank with --data-parallel-size-local and --data-parallel-start-rank flags - dynamo.vllm does not support --headless, DP coordination handles it - Update DP mode tests to match new per-node behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2323e84 to
041a499
Compare
srtctl apply already pre-stages the recipe config to {output_dir}/{job_id}/config.yaml
at submit time. The sbatch template was overwriting this with a copy from the CI checkout
path, which could be stale if another pipeline overwrote the checkout before SLURM ran.
- Guard config copy so it doesn't overwrite pre-staged file
- Read config from stable output dir copy instead of CI checkout path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
endpoints_to_processes(): creates one Process per node with all GPUs instead of one Process per GPUbuild_worker_command(): replaces--data-parallel-rankwith--data-parallel-size-localand--data-parallel-start-rank, adds--headlessfor non-leader nodesTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests
Documentation
Chores