Unit 10 of 12 · about 5 hours · derive, measure

Stragglers, weak and strong scaling, parallel efficiency and hierarchical DP

More workers can reduce both statistical and hardware efficiency. Scaling numbers without fixed work and denominators are marketing.

You'll be able to

  • Derive weak versus strong scaling efficiency and parallel efficiency from fixed-work timings.
  • Diagnose a straggler to input, launch, kernel, collective or imbalance causes using rank timelines.
  • Explain hierarchical data parallelism across fast intra-node and slow inter-node links plus the ring-latency limit.

Covers

Slow data ranks and compute stragglersWeak scaling, strong scaling and parallel efficiencyHierarchical data parallelism within and across nodes
1

Read

In this order, only the parts listed

0 of 4 done

  1. Data-parallel scaling limitsUltra-Scale Playbook - Data Parallelism

    Past the DP optimizations: ring-latency bound past hundreds of GPUs with flat memory per GPU and dropping throughput; Our journey up to now: the dp-first then accumulation recipe

  2. Stragglers as sync-point timeoutsPyTorch DDP Tutorial, Design Note and Communication Hooks

    Skewed Processing Speeds: constructor, forward and backward as sync points in the same order, workload balance as user duty, large timeout for stragglers (page read 2026-10-14)

  3. Single-node collective benchmarkingCS336 Assignment 2 (Spring 2026) - Section 5 Distributed Data Parallel Training

    Section 5.1 Single-Node Distributed Communication in PyTorch (pp. 30 to 32) with 5.1.1 Best Practices (p. 32): all-reduce over 1MB to 1GB across 2, 4 or 6 ranks, 5 warmup iters, synchronize even with async_op=False, aggregate with dist.all_gather_object; problem distributed_communication_single_node (5pt)

  4. Per-phase timers with syncDistributed Training Guide - Chapter 2 DDP

    Lines 127 and 140 to 159: the timers dict over data, forward, backward and update phases; class LocalTimer (lines 283 to 309) synchronizes the device before and after each region

2

Focus on

  • Strong scaling fixes the global batch and divides it; weak scaling fixes the per-rank shard and grows the global batch. Strong efficiency is ; weak compares the 1-rank step against the p-rank step at fixed per-rank work.
  • Attribute first: per-rank data, forward, backward and update timers separate input starvation from launch, kernel, collective and imbalance causes. Timeouts name the reporter; the slowest rank's last phase names the culprit.
  • Hierarchical DP uses the two-level all-reduce from Hierarchical collectives and compressed communication with accuracy controls: reduce-scatter inside each node, all-reduce each shard across nodes, all-gather inside the node. Past hundreds of GPUs ring latency bounds flat DP; the Playbook runs are their H100 and EFA cluster's results, not targets.
  • CPU gloo timings prove logic and efficiency arithmetic only. No interconnect claim leaves this unit without NCCL hardware.
Common mistakes · 3
  • Changing the global batch between the 1-rank and p-rank runs, then calling the ratio strong scaling.
  • Blaming the rank that raised the timeout. Collectives report at the waiter; diagnose from the slowest rank's timers.
  • Quoting Playbook, paper, or vendor speedups as targets. They are other clusters' measurements under other batches.
3

Try it yourself

Closed-book, before checking anything

Run the fixed 8-row oracle job on 1 rank and on 2 CPU ranks with torchrun; compute strong efficiency from the two step times, labeled with hardware, PyTorch 2.14.1, gloo and world size; then inject a 200 ms sleep into rank 1's data phase and show which timer moves.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Strong versus weak setup and efficiency formula?Answer

    Strong: fixed global batch with efficiency . Weak: fixed per-rank work with a p-times global batch, efficiency against the 1-rank step.

  2. 2.Only rank 3's data timer is high. First suspect?Answer

    That rank's input path: loader, prefetch, storage or shared-drive contention. Not the collective.

  3. 3.Why does Playbook DP throughput drop past hundreds of GPUs?Answer

    Ring-latency bound coordination plus overhead; per-GPU memory stays flat.

  4. 4.Hierarchical DP in one sentence?Answer

    Reduce-scatter within each node, all-reduce each GPU's shard across nodes, then all-gather within the node, so only a 1/g share of the node's reduced gradient crosses the slow links per GPU, where g is GPUs per node.

5

Practice

  • CS336 Assignment 2: distributed_communication_single_node

    Section 5.1 with 5.1.1: benchmark all-reduce over 1MB, 10MB, 100MB and 1GB across 2, 4 or 6 ranks; warmup, synchronize, aggregate; plots or tables plus 2 to 3 sentences

    Use gloo on CPU for debug and NCCL on GPUs for bandwidth. CPU numbers are not interconnect evidence.

You're done when

You compute both efficiencies from fixed-work runs and localize an injected slow rank to the right timer without notes.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 7 more in the section
  • CS336 Assignment 2 (Spring 2026) - Section 5 Distributed Data Parallel TrainingStanford University · primary

    Complete naive_ddp, naive_ddp_benchmarking, minimal_ddp_flat_benchmarking, ddp_overlap_individual_parameters and its benchmarking problem with your own implementation. tests/test_ddp.py runs on CPU with Gloo; keep the benchmark method and written derivations even when multiple GPUs are unavailable. This year's handout has no bucketed problem: build buckets from Picotron.

  • Distributed Training Guide - Chapter 2 DDPLambda Labs · support

    Apply Chapter 2 to a tiny causal-LM loop: torchrun, rank-aware logs, DistributedSampler, rank-zero side effects and the ZeRO memory subsection, plus the gradient-accumulation and effective-batch related topics. Its README says optimizer.step() synchronizes gradients; DDP averages them during backward, so correct that line in your notes.

  • Ultra-Scale Playbook - Data ParallelismHugging Face · required

    Read Data Parallelism through Revisiting global batch size and Our journey up to now (overlap, bucketing, accumulation and the global batch equation). Derive replicated-state memory, gradient communication and batch constraints for your tiny model before measuring it; ZeRO belongs to DT-4.

  • PyTorch DDP Tutorial, Design Note and Communication HooksPyTorch · support

    Use the tutorial for setup, DistributedSampler, no_sync, unused parameters and teardown, the design note at https://docs.pytorch.org/docs/2.14/notes/ddp.html for buckets and gradient-ready order, and https://docs.pytorch.org/docs/2.14/ddp_comm_hooks.html for communication hooks. Consult them after the from-scratch path so wrappers do not replace the mechanism model.

Also in this section

  • Picotron - Data ParallelismHugging Face · required

    Read data_parallel/bucket.py and the DataParallelBucket path beside train.py, and rebuild bucketed overlap with an equality test against one process. Read DataParallelNaive as a trap: its register_post_accumulate_grad_hook hook receives the parameter, so it averages parameters and leaves gradients local; show the unequal gradients on two CPU ranks.

  • Picotron Tutorial - Steps 5 and 6 and Part 3 VideoHugging Face · support

    Follow step5_data_parallel_naive and step6_data_parallel_bucket with the Part 3 video. Step 5 carries the same parameter-hook trap as Picotron; use step 6 for the equivalence gate.

  • PyTorch Distributed: Experiences on Accelerating Data Parallel TrainingLi et al. (VLDB 2020) · support

    Read the design sections on gradient bucketing, overlap with backward, no_sync and unused-parameter detection. Use them to explain why buckets follow reverse registration order.

  • Deep Learning at Scale - Chapter 7 Data ParallelismSuneeta Mall (O'Reilly) · support

    Read Data Partitioning, Sampling Strategies, DDP and the data-pipeline sections, and use the small DDP exercises as extra practice. Its FSDP and ZeRO material predates FSDP2.

  • TensorTonic - Synchronize Data-Parallel GradientsTensorTonic · support

    Solve Synchronize Data-Parallel Gradients before the CS336 DDP tests.

  • AI Systems Performance Engineering - Chapter 4 Overlap and DDP StrategiesChris Fregly (O'Reilly) · support

    Read Overlapping Communication and Computation, Achieving Maximal Overlap in Practice and Distributed Data Parallel Strategies in Chapter 4, and the Chapter 13 streams section on overlapping communication. With two or more GPUs, compare code/ch04/ddp_no_overlap.py and ddp_overlap.py; they refuse one-rank runs.

  • PyTorch SyncBatchNorm APIPyTorch · reference

    Use convert_sync_batchnorm to convert BatchNorm layers before wrapping with DDP, and read the training-only sync plus single-GPU-per-process limits.