Skip to content

Operator task guide

How to configure vLLM tensor parallelism and fix multi-node NCCL errors

Tensor parallelism (--tensor-parallel-size) shards model layers and attention heads across GPUs on every forward pass, so all TP workers synchronize over NVLink, PCIe P2P, or InfiniBand on every token. Keep TP within a single NVLink node whenever possible and use pipeline or data parallelism across nodes.

Most vLLM TP startup crashes and mid-serving hangs trace back to three things: attention head count not divisible by TP size, undersized container /dev/shm (64 MB Docker default), or broken PCIe/IOMMU P2P transport requiring NCCL_P2P_DISABLE=1 diagnostics.

Reviewed . Reference guidance is not a diagnosis of your workload.

Step-by-step method

  1. 1

    Verify attention head divisibility and NVLink topology

    Ensure the model num_attention_heads is cleanly divisible by --tensor-parallel-size, and inspect NVLink vs PCIe topology so you know whether P2P transfers cross a slow host bridge.

    nvidia-smi topo -m
    python3 -c "from transformers import AutoConfig; c=AutoConfig.from_pretrained('YOUR_MODEL'); print('heads:', c.num_attention_heads, 'kv_heads:', getattr(c, 'num_key_value_heads', None))"
  2. 2

    Verify container /dev/shm and IPC configuration

    vLLM shm_broadcast and NCCL intra-node rings allocate POSIX shared memory under /dev/shm. Containers running with the default 64 MB /dev/shm hang or fail at startup with acquire_read TimeoutError or NCCL shm errors.

    df -h /dev/shm
    # Launch Docker with sufficient shared memory or host IPC
    docker run --gpus all --shm-size=16g ...
  3. 3

    Capture NCCL_DEBUG=INFO and isolate P2P vs network transport faults

    Run a failing multi-GPU launch with NCCL_DEBUG=INFO and VLLM_LOGGING_LEVEL=DEBUG. On PCIe servers with ACS enabled or broken peer-to-peer DMA, test NCCL_P2P_DISABLE=1 as a controlled diagnostic to verify if P2P mapping caused the hang.

    NCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=INIT,P2P,NET VLLM_LOGGING_LEVEL=DEBUG \
      vllm serve YOUR_MODEL --tensor-parallel-size 4
  4. 4

    Verify multi-node Ray and network interface bindings

    When spanning nodes, pin VLLM_HOST_IP, NCCL_SOCKET_IFNAME, and GLOO_SOCKET_IFNAME to the high-speed data-plane NIC rather than container bridge interfaces, and confirm all nodes share identical model weights and vLLM versions.

    export VLLM_HOST_IP=$(hostname -I | awk '{print $1}')
    export NCCL_SOCKET_IFNAME=eth0
    export GLOO_SOCKET_IFNAME=eth0

vLLM tensor-parallel and NCCL error signals

Signals, meanings and actions for how to configure vllm tensor parallelism and fix multi-node nccl errors.
SignalWhat it meansNext action
shm_broadcast.py acquire_read TimeoutError or /dev/shm NCCL WARNShared memory exhausted or worker stalled mid-step.Increase container --shm-size (16g+ or host /dev/shm) and check worker PIDs.
Hang during NCCL all-reduce on PCIe-only servers; clears with NCCL_P2P_DISABLE=1PCIe P2P blocked by ACS/IOMMU root-complex routing.Disable PCIe ACS in BIOS/OS where permitted, or keep NCCL_P2P_DISABLE=1 as fallback.
ValueError: Total number of attention heads must be divisible by TP sizeChosen --tensor-parallel-size is incompatible with model head geometry.Pick a divisor of num_attention_heads (and num_key_value_heads when required) or use PP.
Multi-node hang during Ray worker initMismatched NIC binding or missing Ray placement bundle.Pin VLLM_HOST_IP and NCCL_SOCKET_IFNAME, and inspect ray status.

Evidence checklist

  • nvidia-smi topo -m output showing NVLink vs PCIe P2P paths
  • df -h /dev/shm inside the serving container
  • NCCL_DEBUG=INFO output up to the first WARN or timeout
  • VLLM_HOST_IP, NCCL_SOCKET_IFNAME, and Ray cluster node list
  • Exact --tensor-parallel-size and --pipeline-parallel-size flags

Common mistakes

Spanning TP=8 or TP=16 across slow Ethernet links

Tensor parallelism runs two all-reduces per transformer layer. Span nodes with pipeline parallelism (PP) or data-parallel replicas instead.

Leaving --shm-size at Docker 64 MB default

Every tensor-parallel vLLM pod needs gigabytes of /dev/shm for shared-memory rings and NCCL.

Keeping NCCL_P2P_DISABLE=1 blindly on NVLink nodes

Disabling P2P destroys NVLink bandwidth. Only use it as a diagnostic or workaround on broken PCIe topologies.

Frequently asked questions

How should I choose between tensor parallelism and pipeline parallelism in vLLM?

Use tensor parallelism across GPUs connected by NVLink inside a single node to minimize per-token latency. Use pipeline parallelism or replicated instances across nodes when a model exceeds one node memory footprint.

Why does vLLM hang with NCCL errors on 2 or 4 GPUs without NVLink?

Consumer or PCIe-connected GPUs behind IOMMU or PCIe ACS switches frequently stall on direct P2P DMA. Testing NCCL_P2P_DISABLE=1 isolates whether PCIe P2P caused the hang.

How much /dev/shm does vLLM tensor parallelism need in Docker or Kubernetes?

Set at least 4 to 16 GB via --shm-size in Docker or an emptyDir with medium: Memory in Kubernetes, avoiding the 64 MB default.

Can TP=3 work in vLLM?

Only if the model attention head count and KV head count are divisible by 3 and vocabulary sharding aligns. Most open LLMs use power-of-two head counts requiring TP 1, 2, 4, or 8.

Live diagnosis, no signup

Upload your GPU log. Find what happened first.

Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

Try Denpex for 30 days. FREE.

No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.

Start your free 30-day Team evaluation

Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.

Apply the method to your incident

Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.

Diagnose your incident