Skip to content

Operator task guide

How to profile distributed HPC GPU jobs and triage trace bottlenecks

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.

Step-by-step method

  1. 1

    Bound trace capture windows and rank output paths

    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.py
  2. 2

    Use scheduled PyTorch profiler windows for framework-level timelines

    When 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)
    "
  3. 3

    Separate input starvation and host syncs from collective wait skew

    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.py
  4. 4

    Escalate to single-GPU counter profiling only on isolated kernels

    Do 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

Profiler trace bottleneck signatures

Signals, meanings and actions for how to profile distributed hpc gpu jobs and triage trace bottlenecks.
SignalWhat it meansNext action
Wide collective kernel duration on most ranks, narrow on one rankStraggler 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 bandwidthTrue 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 collectiveHost 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 loopUnintended 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.

Evidence checklist

  • Bounded trace file covering 2 to 5 steady-state training or inference steps
  • Rank-to-node mapping for each captured rank trace
  • Baseline step time and throughput (tokens/sec or samples/sec) without profiling active
  • PyTorch, CUDA/ROCm, and NCCL/RCCL library versions
  • Storage destination capacity ($SCRATCH vs $HOME) and DataLoader worker count

Common mistakes

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.

Blaming NCCL when a long collective bar is actually wait skew

NCCL kernels include time spent waiting for the slowest rank to enter the collective. Always align rank start times before tuning network parameters.

Writing un-bounded traces for all ranks into $HOME

Large multi-rank traces can fill shared home quotas in seconds and crash unrelated jobs or checkpoint writes.

Frequently asked questions

Why does my NCCL AllReduce kernel look huge in Nsight Systems or Perfetto?

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.

How many steps should I profile on a large GPU cluster?

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.

When should I switch from Nsight Systems or rocprofv3 to Nsight Compute (ncu)?

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.

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