Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
EKA SUNUCU · AI TRAINING ERROR CENTER

NCCL Timeout and Multi-GPU Training Hangs: DDP, Accelerate, DeepSpeed and FSDP

Diagnose watchdog collective timeouts, rank hangs, barriers, machine_rank, main_process_ip, NCCL networking, DDP, DeepSpeed ZeRO and FSDP issues.

PyTorchTransformersPEFT / TRLLast technical review: 14 August 2026
01

Key facts verified with official documentation

01

Accelerate requires launching the command on all nodes with correct machine_rank values.

02

ZeRO-1 shards optimizer states, ZeRO-2 adds gradients, ZeRO-3 adds parameters; deeper sharding increases communication cost.

03

FSDP FULL_SHARD maps conceptually to ZeRO-3, while SHARD_GRAD_OP maps to ZeRO-2.

02

Timeout is often not the first error

If one rank crashes earlier with CUDA OOM, data-loader exception or shape mismatch, other ranks may wait in a collective until the watchdog times out. Search all rank logs for the earliest exception before the timeout.

03

Single node or multi-node?

On a single node, PCIe/NVLink topology and process mapping dominate. Multi-node adds IP/port, firewall, routing, MTU and interface selection. Reduce the problem to a minimal two-GPU single-node test when possible.

04

Critical Accelerate config fields

`num_machines`, `num_processes`, `machine_rank`, `main_process_ip`, `main_process_port` and `same_network` must agree. Accelerate recommends the rank-0 intranet IP for lower latency. Change machine_rank per node.

Diagnostic / validation commands
accelerate env
accelerate config show 2>/dev/null || true
hostname -I
nvidia-smi topo -m
05

Did every node actually launch the script?

Accelerate explicitly requires launching on every node, not only the master. If one node never starts, others can appear to hang at rendezvous/barrier.

06

Enable NCCL/PyTorch debug signals

PyTorch ProcessGroupNCCL exposes environment variables for watchdog and async error handling. Enable detailed logging during reproduction and identify which collective and rank stalled.

Diagnostic / validation commands
export NCCL_DEBUG=INFO
export TORCH_DISTRIBUTED_DEBUG=DETAIL
export TORCH_NCCL_ASYNC_ERROR_HANDLING=1
07

The wrong network interface may be selected

On multi-NIC hosts, NCCL may pick an unsuitable public, Docker or management interface, causing poor bandwidth or timeouts. Verify routes, interface IPs and node-to-node bandwidth/latency, plus the rendezvous port.

08

Do not mix up DDP, FSDP and ZeRO

DDP keeps a model replica per GPU and all-reduces gradients. FSDP/ZeRO shard more state to save memory but increase communication. If a small model already fits per GPU, ZeRO-3 may reduce throughput unnecessarily.

09

Uneven dataloaders and mismatched step counts

If one rank finishes earlier, others may wait forever in collectives. Verify distributed sampler behavior, drop_last, filtering and exceptions so ranks reach synchronization points consistently.

10

Establish a two-GPU baseline before scaling

Debugging 8 GPUs across multiple nodes directly is hard. Validate single GPU, two-GPU DDP, full single node and only then multi-node. This sharply narrows the configuration search space.

DIAGNOSTIC MATRIX

Diagnosis by hang point

Hang pointFirst suspectCheck
Launch/rendezvousIP/port/rankAccelerate config
First all-reduceNCCL/interface/topologyNCCL debug + topo
After some stepsOne-rank exception/OOMAll rank logs
Epoch endUneven dataloaderSampler/drop_last
Production note

Do not blindly upgrade packages in a working training environment. Record GPU, driver, CUDA/PyTorch runtime, Transformers, Accelerate, PEFT, TRL, bitsandbytes/Diffusers, model revision and dataset fingerprint for every run. Reproduce minimally before changing production training.

FAQ

Frequently asked questions

Is NCCL timeout always a network problem?

No. An earlier OOM or exception on one rank can make others time out in collectives.

Is ZeRO-3 always better than ZeRO-2?

No. It saves more memory but increases communication due to parameter sharding.

OFFICIAL SOURCES

Official technical sources and project issues

CLUSTER

Related AI training guides

EKA SUNUCU · GPU ALTYAPISI

Choose the GPU around the training configuration.

Evaluate model size, precision, context, batch, LoRA/QLoRA or full fine-tuning and multi-GPU needs together instead of choosing by GPU name alone.

GPU Sunucu VPS Destek
Top