advanced27 min studyLesson 228 in Engineering

Collective algorithms meet physical placement

Relate rank communication, NIC locality, and fabric cuts instead of interpreting one bandwidth number as a topology map.

On this page

What you’ll understand

  • Count per-rank ring all-reduce traffic under a declared algorithm.
  • Distinguish algorithm bandwidth and normalized bus bandwidth.
  • Explain how rank, accelerator, NIC, and rack placement affect shared cuts.

An AI collective is a communication schedule superimposed on a physical system. Logical neighbors may share an accelerator interconnect, cross a local PCIe path, or traverse several fabric stages. The same tensor size and rank count can therefore produce different bottlenecks under different placements. Begin with the operation's semantics and selected algorithm, then map every important exchange onto the resources it actually uses.

The collective name does not fix the route

All-reduce combines values from all ranks and makes the result available to each participating rank. A ring implementation typically separates reduce-scatter and all-gather phases, while tree or hierarchical algorithms arrange different exchanges. Libraries can change algorithm, protocol, channel count, and chunking with message size and topology. A hand calculation for one ring is a stated model, not a claim that a particular library always follows that exact schedule for every size.

For a conventional evenly partitioned ring with n ranks and S bytes of input per rank, each phase sends n−1 chunks of S/n bytes per rank. Summing the two phases gives 2(n−1)S/n sent bytes per rank, with matching received traffic. Do not add send and receive indiscriminately when comparing with a one-direction link rate. Startup latency, pipelining, reduction compute, and protocol overhead are additional to this payload accounting.

Dsend,rank=2n−1nS,n≥2D_{\rm send,rank}=2\frac{n-1}{n}S,\qquad n\geq2
S and D are bytes for a conventional two-phase ring all-reduce with evenly split data. The expression counts sent payload per rank, not aggregate wire bytes or a universal collective implementation.↔ Scroll wide equations horizontally.

Placement decides which resources those bytes share

Map ranks to GPUs, GPUs to NICs, and NICs to switches. A remote NIC path can cross a local interconnect or NUMA boundary before packets reach the network. Multiple ranks may share one port, while different ports can share an upstream cut. Hierarchical reduction may keep some exchanges within a node before transferring inter-node results, changing external traffic without changing the all-reduce's mathematical output. Verify library topology discovery and actual routes rather than assuming rank numbering matches physical proximity.

Placement tradeoffs depend on the workload. Tensor-parallel exchanges may be frequent and latency sensitive; data-parallel gradient transfers can be larger and overlap compute; expert routing can create all-to-all skew. A placement favorable to one operation may overload a shared cut for another. Evaluate a realistic iteration schedule with concurrent storage and communication when those overlap in production. A clean isolated bulk test is useful evidence about one path, not a guarantee about synchronized job completion.

Balg=St,Bbus=Balg 2n−1nB_{\rm alg}=\frac{S}{t},\qquad B_{\rm bus}=B_{\rm alg}\,2\frac{n-1}{n}
These are common all-reduce benchmark conventions with S in bytes and t in seconds, giving bytes/s. The bus value is a normalized communication metric, not a direct measurement of every physical NIC's wire traffic.↔ Scroll wide equations horizontally.

Measure a schedule, not just a port

Sweep message sizes, rank counts, and placements while retaining correctness checks and recording the actual library settings. Small transfers expose startup and scheduling overhead; large transfers reveal throughput constraints. Compare per-rank completion spread, link utilization, and the slowest iteration, not only an average bandwidth column. A degraded link may affect all ranks through synchronization even when most links remain idle. Repeat under representative background traffic and report both normal and degraded placement behavior.

The Roofline lab is a separate resource-bound exercise, not a collective simulator. Reset and set both I=4 FLOP/byte and B=80 GB/s, predicting 320 GFLOP/s under its fixed 1,000 GFLOP/s compute ceiling; Play traces that roof only. Its bytes are the selected memory-boundary bytes of a hypothetical kernel, not ring payload or NIC traffic. Explain why substituting normalized collective bus bandwidth for memory bandwidth would change the accounting boundary and invalidate that calculation unless a new model justified it.

An eight-rank ring payload budget

Assume an ideal evenly partitioned ring all-reduce across eight ranks, each with 256 MiB of input. Each rank has an independent 50 decimal GB/s bottleneck for sent payload, with no overlap penalty or overhead.

  1. The sent-payload factor is 2×7/8=1.75. Each rank therefore sends 1.75×256=448 MiB across its own modeled bottleneck.

  2. Convert 448 MiB to 469,762,048 bytes. Divide by 50×10⁹bytes/s to get 0.00939524096 seconds, approximately 9.40 ms as a payload-time lower bound.

  3. The hypothetical algorithm bandwidth at that bound is 50/1.75≈28.57 GB/s and normalized bus bandwidth is 50 GB/s. Shared NICs, actual physical cuts, protocol overhead, and the selected implementation can lower achieved performance.

The result

A ring byte budget explains a normalization factor, but it does not prove that every rank owns an independent full-rate network path.

Explore the model

Interactive lab

Interactive lab · roofline

Keep the byte boundary explicit

Reset and set I=4 FLOP/byte, B=80 GB/s; predict 320 GFLOP/s under the fixed 1,000 GFLOP/s compute roof, then Play or Step. This hypothetical memory-boundary Roofline is not a collective, NIC, or fabric model.

Keep the byte boundary explicitSynthetic roofline ceiling min(1000, B·I), in GFLOP/s, with B in decimal GB/s and I in FLOP/byte. Playback traces the roof without changing the selected kernel. This upper-bound model is not a measured throughput prediction, hardware comparison or price model. Current readings: Attainable ceiling: 640 GFLOP/s; Ridge intensity: 12.5 FLOP/byte; Ceiling regime: Memory-bound ceiling. All parameters are adjustable with the labeled controls below.Hypothetical roofline upper bound: 640 GFLOP per second at operational intensity 8 FLOP per byte and bandwidth 80 gigabytes per second.0.1110641101001000Operational intensity · FLOP/byte · log scaleCeiling · GFLOP/s · log scalePeak: 1000
Attainable ceiling / kernelBandwidth roof / traceCompute ceiling
Attainable ceiling
640 GFLOP/s
Ridge intensity
12.5 FLOP/byte
Ceiling regime
Memory-bound ceiling
t = 0 s

Synthetic roofline ceiling min(1000, B·I), in GFLOP/s, with B in decimal GB/s and I in FLOP/byte. Playback traces the roof without changing the selected kernel. This upper-bound model is not a measured throughput prediction, hardware comparison or price model. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA resource bound is meaningful only when its work and byte boundary match the quantity being measured.

Check your understanding

Why can the same all-reduce tensor size run differently after moving ranks?

Try it yourself

A four-rank conventional ring all-reduce has 128 MiB input per rank and completes in 20 ms. Compute algorithm bandwidth and normalized bus bandwidth in GiB/s. Explain why neither is automatically one NIC's measured traffic rate.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

128 MiB equals 0.125 GiB and the four-rank factor is 1.5.

Compare with the solution

Algorithm bandwidth is 0.125/0.02=6.25 GiB/s. Normalized bus bandwidth is 6.25×1.5=9.375 GiB/s. They are benchmark conventions derived from input size and duration. Multiple ranks can share a NIC, traffic can stay within a node, and actual wire bytes include overhead or different algorithm behavior; direct interface measurements need their own accounting.

Take it with you

  • Collective semantics, chosen algorithms, and physical routes are different layers.
  • Rank placement changes which cuts and local paths carry traffic.
  • Algorithm and normalized bus bandwidth require explicit conventions.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.