mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-08 18:01:20 -05:00
ARCHITECTURE.md establishes that visuals are a property of any question, not a separate category. Three supported formats let the layout engine do the work: DOT for graph topology, matplotlib for curves and Gantt charts, hand SVG for custom layouts. render_visuals.py is the single entry point that dispatches by visual.kind, runs the appropriate tool, and normalizes the rendered SVG to the book's font stack. It is idempotent and supports --dry-run. Three exemplars cover the three formats: - cloud-2846 (DOT): Tree AllReduce on 8 ranks — auto-laid-out topology - cloud-2847 (matplotlib): Queueing hockey-stick curve with SLO line - cloud-2848 (matplotlib): Pipeline-bubble Gantt for GPipe schedule All three are status:draft pending math review and promotion in a later batch. Existing cloud-visual-001 remains unchanged as the canonical hand-SVG exemplar.
51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
// Tree AllReduce on 8 ranks: hierarchical reduce-up + broadcast-down.
|
|
// Leaves R0..R7 connect to parents (P0..P3) at 100 GB/s; parents to
|
|
// root (Root) at 200 GB/s. Visual demonstrates the O(log N) phase
|
|
// count vs. Ring AllReduce's O(N).
|
|
digraph TreeAllReduce {
|
|
rankdir=BT;
|
|
node [shape=box, style="rounded,filled", fontname="Helvetica", fontsize=11,
|
|
fillcolor="#cfe2f3", color="#4a90c4"];
|
|
edge [fontname="Helvetica", fontsize=9, color="#555"];
|
|
|
|
// Leaves (rank 0 — bottom)
|
|
R0 [label="Rank 0\n100 MB"];
|
|
R1 [label="Rank 1\n100 MB"];
|
|
R2 [label="Rank 2\n100 MB"];
|
|
R3 [label="Rank 3\n100 MB"];
|
|
R4 [label="Rank 4\n100 MB"];
|
|
R5 [label="Rank 5\n100 MB"];
|
|
R6 [label="Rank 6\n100 MB"];
|
|
R7 [label="Rank 7\n100 MB"];
|
|
|
|
// Mid-tier aggregation
|
|
P0 [label="P0", fillcolor="#d4edda", color="#3d9e5a"];
|
|
P1 [label="P1", fillcolor="#d4edda", color="#3d9e5a"];
|
|
P2 [label="P2", fillcolor="#d4edda", color="#3d9e5a"];
|
|
P3 [label="P3", fillcolor="#d4edda", color="#3d9e5a"];
|
|
|
|
// Root
|
|
Root [label="Root\n(reduced 800 MB)",
|
|
fillcolor="#fdebd0", color="#c87b2a", fontsize=11];
|
|
|
|
// Reduce-up phase: leaves -> parents at 100 GB/s
|
|
R0 -> P0 [label="100 GB/s"];
|
|
R1 -> P0;
|
|
R2 -> P1 [label="100 GB/s"];
|
|
R3 -> P1;
|
|
R4 -> P2 [label="100 GB/s"];
|
|
R5 -> P2;
|
|
R6 -> P3 [label="100 GB/s"];
|
|
R7 -> P3;
|
|
|
|
// Reduce-up phase: parents -> root at 200 GB/s
|
|
P0 -> Root [label="200 GB/s", color="#3d9e5a"];
|
|
P1 -> Root [color="#3d9e5a"];
|
|
P2 -> Root [color="#3d9e5a"];
|
|
P3 -> Root [color="#3d9e5a"];
|
|
|
|
// Caption-like ranks
|
|
{ rank=source; Root; }
|
|
{ rank=sink; R0; R1; R2; R3; R4; R5; R6; R7; }
|
|
}
|