Derive and plot all-reduce cost
CPU · your Macnotebook90 minrequiredGoal · A notebook that models ring and tree all-reduce time for a range of tensor sizes and link types and identifies the latency/bandwidth crossover.
- 1Write time_ring(bytes, n, bw_GBps, latency_us) = 2*(n-1)*latency + 2*(n-1)/n * bytes / bw.
- 2Write time_tree(bytes, n, bw, latency) using 2*log2(n) steps and bytes/bw per step as an approximation.
- 3Parameterise three links with NVLink (300 GB/s, 10 us), PCIe 4 x16 (25 GB/s, 20 us), and 100 GbE (12 GB/s, 50 us).
- 4Sweep tensor size from 1 KB to 1 GB on a log axis for n in {2, 4, 8} and plot time per link.
- 5Compute the per-decode-step collective bytes for Llama-3-70B TP=4 at batch 1 (2 * 80 layers * d_model * 2 bytes) and mark that point on the plot.
- 6Write a paragraph on which regime decode sits in and what that means for TP over Ethernet.
- Deliverable
- allreduce_cost.ipynb with the plot and the marked decode-step point.
- Check
- For a 1 GB tensor ring beats tree on every link; for 16 KB tensors tree beats ring at n=8; decode-step collectives on 100 GbE are latency-bound (more than 80 percent of time is latency).