Skip to content

Operator task guide

How to use NCCL_DEBUG=INFO and Flight Recorder to debug watchdog timeouts

Running with NCCL_DEBUG=INFO and TORCH_NCCL_TRACE_BUFFER_SIZE=2000 forces NCCL to print its selected network interface, IB/RoCE HCA, P2P paths, and in-flight collectives right before a watchdog timeout fires. Use NCCL_DEBUG=TRACE only for targeted reproductions because TRACE log volume is high.

Never raise NCCL timeout variables (such as TORCH_NCCL_ASYNC_ERROR_HANDLING or timeout minutes) as a fix without first checking whether a silent rank died from Python, host cgroup OOM, or an NVIDIA Xid. Longer timeouts only make dead clusters sit idle longer.

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

Step-by-step method

  1. 1

    Enable NCCL_DEBUG=INFO and PyTorch Flight Recorder

    Export NCCL debug flags and Flight Recorder ring-buffer settings before launching torchrun or srun so the next hang writes collective history to durable storage.

    export NCCL_DEBUG=INFO
    export NCCL_DEBUG_SUBSYS=INIT,ENV,NET,COLL
    export TORCH_NCCL_TRACE_BUFFER_SIZE=2000
    export TORCH_NCCL_DUMP_ON_TIMEOUT=1
    export TORCH_NCCL_DEBUG_INFO_TEMP_FILE=/shared/nccl_trace_rank_
  2. 2

    Inspect the earliest INFO and WARN lines across all ranks

    Search across rank logs for the selected transport (NET/IB, Socket, or P2P), then look immediately before the watchdog abort for any earlier Python traceback or errno.

    rg -n 'NCCL INFO NET|NCCL WARN|NCCL ERROR|Watchdog caught|Traceback' rank-*.log | head -n 60
  3. 3

    Verify host kernel and scheduler events for silent peers

    If rank 0 printed Watchdog caught collective operation timeout but another rank left no timeout line, inspect host dmesg and Slurm sacct for the missing peer PID.

    dmesg -T | grep -iE 'Out of memory|Killed process|NVRM: Xid'
    sacct -j <jobid> --format=JobID,NodeList,State,ExitCode,MaxRSS
  4. 4

    Adjust timeout environment variables only after ruling out dead peers

    Legitimate long checkpoint saves or first-step torch.compile runs can exceed the 10-minute PyTorch default. Increase init_process_group(timeout=...) or set TORCH_NCCL_HEARTBEAT_TIMEOUT_SEC only when every rank is measurably alive and making progress.

NCCL_DEBUG and watchdog signals

Signals, meanings and actions for how to use nccl_debug=info and flight recorder to debug watchdog timeouts.
SignalWhat it meansNext action
NCCL INFO NET/Socket chosen instead of NET/IBInfiniBand RDMA plugin missing or blocked.Check ibstat, container RDMA mounts, and NCCL_IB_DISABLE.
Watchdog caught collective operation timeout on ranks 0..N-1At least one peer rank failed to enqueue or died.Inspect the silent rank traceback, cgroup MaxRSS, and host Xids.
Flight recorder shows mismatched OpType or SeqNumConditional code branch diverged across ranks.Fix divergent control flow or uneven batch steps across DDP/FSDP.
Timeout clears when checkpoint save or compile finishes earlierLegitimate slow step exceeded default watchdog threshold.Raise process group timeout and overlap or optimize checkpoint I/O.

Evidence checklist

  • NCCL_DEBUG=INFO startup lines showing selected NIC, IB HCAs, and P2P
  • Flight recorder trace dumps from all participating ranks
  • First Watchdog caught collective operation timeout SeqNum and OpType
  • Per-rank stderr logs including any silent-exit rank
  • Host dmesg OOM and Xid lines from the failure timestamp

Common mistakes

Debugging only rank 0 logs

Rank 0 frequently survives to print the watchdog timeout while rank 7 or rank 19 died silently minutes earlier.

Leaving NCCL_DEBUG=TRACE enabled in production

TRACE logs every collective call and can saturate shared filesystems or slow step time.

Bumping NCCL timeout to 60 minutes to hide hangs

Deadlocks stay deadlocked; longer timeouts just burn 6x more idle GPU-hours before alerting.

Frequently asked questions

What is the difference between NCCL_DEBUG=INFO and NCCL_DEBUG=TRACE?

NCCL_DEBUG=INFO logs initialization, topology, selected network interfaces, and warnings/errors with minimal runtime overhead. NCCL_DEBUG=TRACE adds verbose per-collective trace lines and should be limited to short reproducer runs.

What is the default NCCL watchdog timeout in PyTorch?

PyTorch torch.distributed defaults to 10 minutes (600 seconds) for NCCL collectives unless overridden via timeout=timedelta(...) in init_process_group.

How do I save NCCL_DEBUG output to per-rank files?

Set NCCL_DEBUG_FILE=/path/to/logs/nccl_%h_%p.log so each host and PID writes its own clean log without interleaving stdout.

Where does TORCH_NCCL_TRACE_BUFFER_SIZE write flight recorder dumps?

When TORCH_NCCL_DUMP_ON_TIMEOUT=1 is set alongside TORCH_NCCL_TRACE_BUFFER_SIZE=2000, PyTorch writes collective ring buffers to the file prefix configured by TORCH_NCCL_DEBUG_INFO_TEMP_FILE.

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