CMPT 471/771: Computer Networks��AI Datacenters
Instructor: Mohamed Hefeeda
1
School of Computing Science �Simon Fraser University
Outline
2
Datacenter Fabrics and AI Workloads
3
AI Service: High Level Abstraction
4
Dog
Dog
Dog
Cat
AI Service: High Level Abstraction
5
Trained Model
?
Cat
AI Model Training: Basics
6
Dog
Dog
Dog
Dog
Loop until convergence: // Gradient descent �
�// Implemented using backpropagation
Overly Simplified!
Computing the Gradient: Forward then Backward
7
Inside a Transformer Block
8
Next-token output
Block N
⋮
Block 2
Block 1
Embedding
Tokens in
One block
Attention
+
MLP
in
TP: split each weight matrix across GPUs
PP: one stage
Training Cost: Compute
C ≈ 6 × N × D FLOPs
Think: ≈ 400 TFLOP/s per GPU; how long on 16,384 GPUs?
≈ 5.8×106 s ≈ 67 days
9
Per parameter, per token
Forward
2
Backward
4
= 6
× N parameters
× D tokens
Training Cost: Memory
M ≈ 16 × N bytes
Think: 80 GB per GPU; how many GPUs?
≈ 81 GPUs, before activations
10
Bytes per parameter
Optimizer
12 B
Grad 2 B
Weights 2 B
= 16 B
Activations: extra
AI Model Training: Challenges
11
117 million
1.5 billion
175 billion
1+ trillion
AI Model Training: Challenges
12
AI Model Training: Challenges
13
AI Model Training: Solutions
14
Pipeline Parallelism (PP)
15
Tensor Parallelism (TP)
16
[Figure: Megatron-LM, via Narayanan et al. SC’21]
Data Parallelism
17
Data Parallelism
18
Forward
Forward
Batch 1
Batch 2
Backward
Backward
Update Parameters
Update Parameters
Sync grads
All Reduce
All Reduce
DP transfers full gradient each step (massive amounts of data)
Sharding the Model State: ZeRO and FSDP
19
Plain DP: each GPU holds all 16 B/param
GPU 0
GPU 1
GPU 2
GPU 3
ZeRO-3: each GPU holds ¼ (1/n)
GPU 0
GPU 1
GPU 2
GPU 3
W weights · G gradients · O optimizer
AllGather / ReduceScatter: Protocol Support, Part D
All-Reduce: Logical View
20
G1
G4
G3
G = f(G1, G2, G3, G4)
t0
t1
G
G
G
G2
G
f: sum (or average)
Algorithms: Protocol Support, Part D
AI Training: Key Characteristics
21
AI Training: Key Characteristics
22
Tail at Scale: Slowest Worker Sets the Pace
P(slow step) = 1 − (1 − p)n
Think: 16,384 GPUs?
Almost every step waits for a straggler
23
P(slow step), %
workers n (log scale)
1
10
100
1,000
10,000
0
50
100
63%
≈ 100%
p = 1%
p = 0.1%
Conventional vs. AI Datacenters: Fabrics
24
Cloud Datacenter
Independent VMs
Shared, oversubscribed
Independent flows
AI Datacenter
One giant synchronized job
10k–100k GPUs in lock-step
Synchronized bursts
AI Datacenters: Summary of Requirements
25
Bandwidth
Massive amount of data needs to be transferred at each training step� (for about a million of steps)
Latency
Synchronous: All GPUs must wait for the slowest one before proceeding to the next step.
(microsecond tail latency adds up over a million steps)
Incast
Many-to-one bursts (AllToAll, colliding flows) overflow shallow switch buffers (causing losses or pauses that stall the entire job).
🡺 AI clusters need a different fabric design AND network stack (covered later).
26
AI Datacenters: Hardware and Power
When power becomes a physical limiting factor
The Accelerator Node: GPU, HBM, NVLink
27
One GPU server
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
HBM
GPU
NIC
NVLink / NVSwitch: 900 GB/s per GPU
8 × 400 Gb/s to back-end fabric
CPU
CPU
Front-end NICs
→ storage, control
NIC–GPU links: PCIe switches (not shown)
GPU Server: Why So Much Power?
28
Host CPU
GPU1
GPU2
GPU3
GPUn
NVSwitch Fabric (900 GB/s)
NIC1
NIC2
NIC3
NICn
Scale-Up Domains: From 8 GPUs to a Rack
29
8 GPUs
(server)
72 GPUs, one NVLink
domain (NVL72 rack)
9×
Scale-out fabric (NICs, RDMA)
joins many domains
AI Datacenters: Scale & Money
30
>$1T
Global data-center capex
forecast for 2026
$500B
Project Stargate (OpenAI, SoftBank, Oracle, MGX): 10 GW goal
AI vs Traditional Datacenters: Rack Power Density
31
kW/rack
0
40
80
120
2010
2015
2020
2024
2027
Air-cooling limit
Traditional
AI
Power Swings of Synchronized Training
32
time
datacenter power (illustrative)
compute
communicate
Thousands of GPUs in lock-step:
the whole building pulses
Demo: Why Air Cooling Runs Out
33
Preset 3: 130 kW AI rack on air
Liquid Cooling: Two Main Types
34
D2C Liquid Cooling Systems: Overview
35
Facility�Chilled Water
CDU�Heat Exchanger
AI Rack (rear view)
Supply
Return
Node 1�Cold Plates
Node 2�Cold Plates
Node 3�Cold Plates
Cold in
Warm out
Liquid Cooling
36
Cold plate (mounted on GPU or CPU)
Server tray with coolant hoses
Cold coolant in → absorbs chip heat → warm coolant out to rack manifold
D2C: Complex Management of Liquid
37
Pumps, valves, sensors, heat exchangers: liquid adds plumbing to operate
Immersion Cooling: Single Phase
38
Immersion Cooling: Two-Phase
39
Sealed Immersion Tank (cross-section)
Vapor zone
Liquid bath
Fluid level
Water-cooled condenser coils
Server 1
Server 2
Server 3
① Boil
② Rise
③ Condense on coils
④ Drip
Passive cycle: boil → rise → condense → drip (repeats continuously)
Demo: Cold Plates and Immersion
40
Tab 2, preset 1: GB200 NVL72-class rack
Liquid Cooling: Environmental Implications
41
AI's Footprint: Energy
42
World datacenter electricity (TWh)
415
2024
485
2025
950
2030
(projected)
AI's Footprint: Water
43
US datacenter water, 2023 (billion L)
66
direct
(on site)
800
indirect
(electricity)
AI's Footprint: Carbon
44
The 4Ms (Patterson et al.)
Model
efficient architectures
Machine
ML accelerators
Mechanization
efficient datacenters
Map
cleanest location
Datacenter Fabric Support for AI
When the network becomes the bottleneck
45
AI Training: Impact on Datacenter Fabric
46
Spine 1
Spine 2
Leaf A
Leaf B
G0
G1
G2
G3
ECMP hashes BOTH elephant flows onto the Spine-1 uplink
idle
Flow 1 + Flow 2 collide
AI Training: Impact on Datacenter Fabric
47
Rail-optimized Fabric
48
Rail 0
Rail 1
G0
G1
G0
G1
G0
G1
Rail-optimized Fabric: Advantages
49
Server NIC — shared uplink
1 × 400 Gbps uplink
≈ 50 Gbps per GPU (shared)
Rail — dedicated planes
400 Gbps per GPU
= 3.2 Tbps per server · all rails active
Physical isolation
Each rail is its own plane →�no cross-GPU contention
Bandwidth
Instead of 50 Gbps shared → �400 Gbps dedicated per GPU
Determinism
Fewer hops → low latency jitter,�fewer stragglers
GPUDirect RDMA
GPU i ↔ GPU i across nodes,�bypassing host CPU / PCIe
Server GPUs
Three Networks in an AI Cluster
50
Front-end network
Storage
CPU
FE NIC
GPU
NIC
GPU
NIC
GPU
NIC
GPU
NIC
NVLink (scale-up)
CPU
FE NIC
GPU
NIC
GPU
NIC
GPU
NIC
GPU
NIC
NVLink (scale-up)
Back-end fabric (rail / Clos, RDMA)
4 of 8 GPUs per server shown
Recap: Parallelism Models
51
Data-parallel
G0
G1
G2
AllReduce
Replica per GPU group →�AllReduce of gradients�(once per step)
Large volume
Tensor / model-parallel
G0
G1
G2
AllReduce
Split one layer across GPUs →�AllReduce in every layer,�every step
Most BW, low latency
Pipeline-parallel
G0
G1
G2
activations →
Stages across GPUs →�point-to-point activations�between neighbors
Light BW
Parallelism: Details
52
Bandwidth Hierarchy and Parallelism Placement
53
Spine (lowest BW)
Rail (~100s Gbps)
Intra-node (~Tbps)
Is Rail Fabric Good for General Traffic?
54
Rail Cabling
55
Rail in Practice & Scale-Out
56
Scalable Unit (SU)
32 rail-aligned nodes
Same rail = 1 hop
Spine only for cross-rail
Other Parallelisms: CP and MoE
57
AllToAll Traffic of Mixture-of-Experts
58
GPU 0
tokens
experts
0–1
GPU 1
tokens
experts
2–3
GPU 2
tokens
experts
4–5
GPU 3
tokens
experts
6–7
dispatch tokens (AllToAll)
results return the same way
(combine: second AllToAll)
MoE: Impact on Fabric Design
59
Spine
Rail 0
Rail 1
Rail 2
Rail 3
NVLink
Server A (4 of 8 GPUs)
G0
G1
G2
G3
NVLink
Server B (4 of 8 GPUs)
G0
G1
G2
G3
Token on A.G0; its experts on B.G2 and B.G3
Direct: two copies cross the spine
DeepSeek-V3: one copy on rail 0, then NVLink
Case Study: Training Llama 3.1 405B
60
Llama 3.1 405B: Parallelism
61
Llama 3.1 405B: Fabric and Protocols
62
More AI Fabrics: Torus
63
Google TPU Clusters: Torus Topology
64
2D Torus: A Ring in Every Row and Column
65
0,3
1,3
2,3
3,3
0,2
1,2
2,2
3,2
0,1
1,1
2,1
3,1
0,0
1,0
2,0
3,0
Wraparound links (red): rings
Step 1: reduce in all rows
Step 2: then in all columns
3D Torus: Stacking 2D Tori
66
X
Y
Z
Z links (green)
Z wraparound (red)
One chip: 6 links
In-layer wraparound links not drawn
Recall: Electrical vs Optical Switching
67
In1
In2
In3
MEMS Mirror
Out1
Out2
Out3
No electrical conversion — optical circuit
Google TPU v4: A Rack Is a 4 × 4 × 4 Cube
68
Cube: front face, 4 deep; copper inside
+X
−X
X OCS (mirrors)
+X and −X ends meet in one OCS
6 faces × 16 = 96 fibers per cube
OCS: Closing Rings and Joining Cubes
69
OCS (MEMS mirrors)
Cube A
Cube B
Cube D (spare)
1. Mirrors join A's two ends: ring of 4
2. Re-pointed: ring of 8 over A, B (4 × 4 × 8 slice)
3. B fails: same mirrors now use spare D
One line of each cube shown; every line is joined the same way
TPU v4 Pod: Overall Architecture
70
Eight of the 64 racks of one pod
Figures: Jouppi et al., TPU v4, ISCA 2023 (Figs. 1 and 3)
Torus vs Leaf-Spine: The Numbers
71
4,096 chips | 3D torus (k × k × k, k = 16) | Clos / fat-tree (1:1, 3 tiers) |
Links per chip | 6 (±X, ±Y, ±Z) | 1 NIC port |
Longest path | 3k/2 = 24 links | 6 links (5 switches) |
Bisection (links cut) | 2k² = 512 | N/2 = 2,048 |
Bisection vs 1:1 Clos | 4/k: 100% at 4³, 25% at 16³ | 100% |
Switches (Google estimate) | 48 OCSes, no packet switches | 568 InfiniBand switches |
→ Torus: cheap and fast for rings (AllReduce); bisection shrinks as it grows
→ Clos: full bisection for any-to-any (AllToAll, MoE); pays in switches
→ Twisted torus (OCS re-wiring): up to 1.63× AllToAll throughput
Torus vs Rail
72
| Torus | Rail |
Topology | Direct-connect 3D torus | Switched folded-Clos |
Switches | None in cubes; 48 OCSes between cubes | Packet switches (leaf + spine) |
Per-node NIC | None for chip links (ICI); hosts use DCN NICs | One NIC per GPU |
Reconfigurable | Yes (by controlling the OCS) | Fixed (flexibility via spine + ECMP) |
AllReduce | Per-dimension physical rings | Ring along a rail (logical) |
Cost/power | Low (no big switch tier) | Higher (8 NICs and switch ports per server) |
Other AI Cluster Designs
73
Design | Idea | Examples |
Multi-plane fat-tree | Each GPU–NIC pair on its own plane; 2 tiers reach > 10K GPUs | DeepSeek (8 planes), Alibaba HPN (2) |
Rack-scale scale-up | 72 GPUs on NVLink switches; Clos between racks | NVIDIA GB200 NVL72 |
Torus without OCS | 16 chips in a 2D torus; rings join 4 servers → 64 | AWS Trainium2 UltraServer |
Dragonfly | Switch groups; a link between every pair of groups | Frontier (HPE Slingshot) |
Research | Optical topology set per job; rail-only (no spine) | TopoOpt (2023), Rail-only (2024) |
Common thread: shape the topology to the collective traffic
Summary
74
Readings
75