Running kernel replay profilers on a live multi-node NCCL job
Multi-pass kernel replay slows one rank or kernel dramatically, causing collective watchdogs to fire and producing invalid timing data.
Operator task guide
Unbounded profiling on multi-node HPC jobs distorts kernel timing, generates gigabytes of trace files that exhaust shared filesystems, and hides the actual bottleneck behind synchronization noise. Capture bounded 2-to-5-step timeline traces across selected ranks first, and escalate to hardware counter profilers only after isolating a single kernel or node.
When reading distributed GPU traces, long ncclKernel or rcclKernel spans rarely mean the network itself is slow. Compare step-entry timestamps across ranks first: one slow data loader, host swap spike, or thermally throttled GPU delays all peer ranks inside the collective barrier.
Reviewed . Reference guidance is not a diagnosis of your workload.
Always limit system timeline tracing to a handful of steady-state iterations after warmup, and direct trace files to fast scratch storage rather than quota-limited home directories. On multi-node runs, capture rank 0 plus one peer node first unless hunting an asymmetric straggler.
# NVIDIA Nsight Systems bounded capture:
nsys profile --trace=cuda,nvtx,osrt --capture-range=cudaProfilerApi --stop-on-exit=true -o "$SCRATCH/trace_%q{SLURM_PROCID}" python3 train.py
# AMD ROCm bounded trace (rocprofv3):
rocprofv3 --hip-trace --kernel-trace -d "$SCRATCH/rocprof_%q{SLURM_PROCID}" -- python3 train.pyWhen diagnosing Python overhead, DataLoader stalls, or memory allocations inside PyTorch, wrap only a small schedule window (wait, warmup, active) so trace export completes quickly and stays readable in Chrome/Perfetto trace viewers.
python3 -c "
import torch
sched = torch.profiler.schedule(wait=2, warmup=2, active=3, repeat=1)
print('Configured bounded profile schedule:', sched)
"Inspect the GPU stream timeline before changing model parallelism or network flags. Empty gaps across all GPUs between iterations indicate DataLoader, CPU preprocessing, or checkpoint I/O bottlenecks. Frequent short gaps inside a step point to CPU-GPU synchronization calls such as .item() or blocking copies.
grep -n -E '.item(|.cpu(|synchronize(|to(["'"'"']cpu' train.py model.pyDo not run heavy hardware-counter replay tools such as NVIDIA Nsight Compute (ncu) across a full distributed training job, as multi-pass kernel replay slows execution by orders of magnitude and triggers watchdog timeouts. Reproduce the slow kernel in a single-GPU script first.
ncu --target-processes all --kernel-name regex:flash_fwd --launch-skip 5 --launch-count 2 -o "$SCRATCH/kernel_metrics" python3 repro_single_gpu.py| Signal | What it means | Next action |
|---|---|---|
| Wide collective kernel duration on most ranks, narrow on one rank | Straggler skew: the rank with the short collective bar arrived late and forced healthy peers to wait. | Compare compute, CPU DataLoader, power, and clock telemetry on the late-arriving rank against peers. |
| Uniform collective duration across all ranks with low bus bandwidth | True communication bottleneck, small uncoalesced messages, or missing fabric plugin. | Verify NCCL/RCCL transport plugin, message bucketing, and collective overlap settings. |
| Periodic GPU idle gaps between steps with no active collective | Host CPU preprocessing, DataLoader worker starvation, or synchronous disk/storage I/O. | Profile host CPU workers, increase pinned memory/prefetching, and verify scratch read throughput. |
| Frequent tiny host-to-device sync stalls inside step loop | Unintended blocking device synchronization (logging .item(), dynamic tensor checks, or unpinned H2D copies). | Remove per-step scalar host syncs and use non_blocking=True with pinned host buffers. |
Multi-pass kernel replay slows one rank or kernel dramatically, causing collective watchdogs to fire and producing invalid timing data.
NCCL kernels include time spent waiting for the slowest rank to enter the collective. Always align rank start times before tuning network parameters.
Large multi-rank traces can fill shared home quotas in seconds and crash unrelated jobs or checkpoint writes.
Analyze trace idle bubbles, sync stalls, and collective wait overhead locally in your browser.
Isolate slow compute ranks and thermal or link throttling without a crash.
Follow the full Slurm triage order across CUDA, ROCm, and host memory.
Inspect safe collective communication environment knobs once skew is ruled out.
A collective kernel starts on a rank as soon as that rank enters the call, but cannot finish until the slowest rank arrives. Check whether one rank has a much shorter NCCL bar accompanied by longer compute or CPU stall time beforehand.
Capture 2 to 5 active steady-state steps after warmup. That is enough to expose step-level compute, communication, and DataLoader patterns while keeping trace files small and timing overhead minimal.
Use timeline tracing first to find which kernel or collective dominates wall time. Only run kernel-level counter profiling after isolating that specific kernel in a single-GPU reproducer.
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.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.
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 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