1 of 75

CMPT 471/771: Computer Networks��AI Datacenters

Instructor: Mohamed Hefeeda

1

School of Computing Science �Simon Fraser University

2 of 75

Outline

  • AI Workload
    • Training and parallelism; synchronized communication; vs. conventional datacenters
  • AI Hardware
    • GPU servers (HBM, NVLink); scale-up domains (rack scale)
  • Power and Cooling
    • Rack power density; liquid cooling (recall air cooling); energy, water, carbon
  • AI Fabrics
    • Rail-optimized fabrics (recall Clos); MoE traffic; Llama 3 case study; torus with optical switches

2

3 of 75

Datacenter Fabrics and AI Workloads

  • So far, we presented
    • General datacenter fabrics: folded Clos / leaf-spine
    • Load balancing: ECMP, spraying, flowlets
    • Power and air cooling of the building; PUE
  • Next, we closely inspect AI workloads:
    • Model training (especially LLMs)
    • Model inference (next module)
  • And the requirements of these workloads on
    • Hardware, power and fabrics (this module)
    • Network protocols (next module)

3

4 of 75

AI Service: High Level Abstraction

  • We first train a machine-learning model
    • Train = show the machine numerous labeled examples
    • Model learns weights W that map input to label

​

​

4

Dog

Dog

Dog

Cat

5 of 75

AI Service: High Level Abstraction

​

  • Then we deploy the trained model for inference
    • One forward pass per request; weights fixed

​

5

Trained Model

?

Cat

6 of 75

AI Model Training: Basics

​

6

Dog

Dog

Dog

 

Dog

 

Loop until convergence: // Gradient descent �

    • Compute Gradient

​

    • Update Weights

�// Implemented using backpropagation

 

 

 

 

Overly Simplified!

7 of 75

Computing the Gradient: Forward then Backward

  • We can't get dL/dW in one shot because the neural network is deep; L is a composition of functions
  • 🡺 Chain rule computes dL/dW layer-by-layer from the loss backward
    • 🡺 hence the name backpropagation
  • Forward pass:
    • run a data batch through layers 🡺 compute predictions 🡺 compute loss
    • cache activations (needed for backward pass) 🡺 one reason training needs lots of memory
  • Backward pass:
    • apply the chain rule from the loss back through the layers
    • 🡺 produces dL/dW for every weight
  • Then update the weights

7

8 of 75

Inside a Transformer Block

  • LLM = stack of identical blocks
    • Llama 3.1 405B: 126 blocks
  • Each block: two parts
    • Attention: tokens share information
    • MLP: same network for every token
  • Weights = large matrices
    • Compute = matrix multiplications
  • Networking view
    • Split each matrix across GPUs → TP
    • Split stack into stages → PP

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

9 of 75

Training Cost: Compute

C ≈ 6 × N × D FLOPs

    • N: parameters; D: training tokens
  • Why 6: FLOPs per parameter per token
    • Forward ≈ 2 (one multiply, one add)
    • Backward ≈ 4 (about twice forward)
  • Example: Llama 3.1 405B
    • 6 × 405×109 × 15.6×1012 ≈ 3.8×1025

Think: ≈ 400 TFLOP/s per GPU; how long on 16,384 GPUs?

≈ 5.8×106 s ≈ 67 days

  • Use: size cluster and time before training

9

Per parameter, per token

Forward

2

Backward

4

= 6

× N parameters

× D tokens

10 of 75

Training Cost: Memory

  • Mixed precision + Adam:
    • Weights 2 B + gradients 2 B (16-bit)
    • Optimizer 12 B: FP32 copy, momentum, variance

M ≈ 16 × N bytes

  • Example: Llama 3.1 405B
    • 405×109 × 16 B ≈ 6.5 TB of model state

Think: 80 GB per GPU; how many GPUs?

≈ 81 GPUs, before activations

  • Use: model state must be split across GPUs
    • Parallelism and ZeRO / FSDP (next slides)

10

Bytes per parameter

Optimizer

12 B

Grad 2 B

Weights 2 B

= 16 B

Activations: extra

11 of 75

AI Model Training: Challenges

  • Model complexity and size are rapidly increasing
    • Complex layers, e.g., Transformers
    • Deep models with many layers
    • 🡺 numerous parameters → huge memory, compute → many GPUs

​

11

117 million

1.5 billion

175 billion

1+ trillion

12 of 75

AI Model Training: Challenges

  • Training datasets are growing even faster
    • Massive amounts: trillions of tokens
    • Various modalities (text, audio, image, code, …)
    • Different languages (English, Chinese, Spanish, …)
    • 🡺 requires more GPUs to finish in reasonable time

12

13 of 75

AI Model Training: Challenges

  • Training requires distributing the huge model and massive datasets across numerous GPUs
    • Ex: Llama 3.1 405B: 16,384 GPUs, ≈ 31M GPU-hours
    • Largest clusters in 2025: 100,000+ GPUs
  • Challenge: distributed training must ensure same semantics as if we were training on a single machine

13

 

 

14 of 75

AI Model Training: Solutions

  • Pipeline Parallelism (PP)
    • Divide model layers into stages
  • Tensor Parallelism (TP)
    • Divide each layer (tensors) of the model into smaller units
  • Data Parallelism (DP)
    • Divide datasets across model replicas
  • Combinations of all are used with large models
    • Along with newer methods (e.g., Context Parallelism for large documents)

​

14

15 of 75

Pipeline Parallelism (PP)

  • PP: divides layers into stages and deploys them on different nodes
    • 🡺 spreads a deep model across many nodes
    • Only point-to-point activations are transferred between neighboring stages 🡺 small amount of data and latency-tolerant

​

15

16 of 75

Tensor Parallelism (TP)

​

  • TP requires intensive communications and short latency

​

​

16

[Figure: Megatron-LM, via Narayanan et al. SC’21]

  • Recent models have complex layers
    • e.g., Transformer with multi-head attention
  • TP splits individual layers across GPUs
    • Each computes part of the processing
  • TP allows one layer to exceed single-GPU memory

17 of 75

Data Parallelism

  • Model is replicated on nodes (each may have multiple GPUs)
    • Datasets are partitioned among model replicas

​

17

18 of 75

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)

19 of 75

Sharding the Model State: ZeRO and FSDP

  • Plain DP: full copy per GPU
    • Weights, gradients, optimizer state
  • ZeRO: shard state across GPUs
    • Stage 1: optimizer state
    • Stage 2: + gradients
    • Stage 3: + weights (memory ÷ n)
  • PyTorch FSDP ≈ ZeRO stage 3
  • Cost: more communication
    • AllGather weights before a layer
    • ReduceScatter gradients after it

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

20 of 75

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

21 of 75

AI Training: Key Characteristics

  • No worker starts step t+1 until all finish the gradient sync of step t
    • 🡺 hard barrier every step
    • 🡺 Slowest GPU + sync time dictate the progress of the whole process
    • 🡺 tail (not average) latency/throughput are critical

​

  • Network is flooded by huge amounts of data simultaneously
    • 🡺 congestion and packet losses
    • 🡺 must adjust fabric design to handle this traffic

​

  • 🡺 AI training is bulk-synchronous
    • unlike traditional datacenter traffic

​

21

22 of 75

AI Training: Key Characteristics

  • Compute per step is fixed, whereas network cost grows with model size AND cluster size
    • 🡺 Exchanged data volume is huge

​

  • Example: 100B model 🡺200 GB of gradients (fp16) synced every single step
    • At 400 Gb/s: ≈ 4 s just to send it once; ≈ 8 s for ring AllReduce

​

    • 🡺 AI training is communication-bound: Adding GPUs may not help once fabric is saturated

22

23 of 75

Tail at Scale: Slowest Worker Sets the Pace

  • Each step ends at barrier
    • Step time = slowest worker

P(slow step) = 1 − (1 − p)n

    • p: one worker slow; n: workers
  • Example: p = 1%
    • n = 100: 63% of steps slow
    • n = 1,000: 99.996% of steps slow

Think: 16,384 GPUs?

Almost every step waits for a straggler

  • Use: design for the tail, not the mean

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%

24 of 75

Conventional vs. AI Datacenters: Fabrics

  • Conventional cloud datacenter
    • Many independent jobs / VMs sharing the fabric
    • Independent flows; already mostly east-west
    • Statistical multiplexing allows link oversubscription, reducing cost
  • AI datacenter (GPU cluster)
    • One job spans thousands of GPUs, tightly synchronized
    • Few huge, synchronized bursts (GPU to GPU)
    • 🡺 compete for network bandwidth 🡺 (expensive) GPUs may sit idle 🡺 network becomes the bottleneck

​

  • Let us look more closely at AI datacenters

24

Cloud Datacenter

​

Independent VMs

Shared, oversubscribed

Independent flows

AI Datacenter

​

One giant synchronized job

10k–100k GPUs in lock-step

Synchronized bursts

25 of 75

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 of 75

26

​

​

​

AI Datacenters: Hardware and Power

When power becomes a physical limiting factor

​

27 of 75

The Accelerator Node: GPU, HBM, NVLink

  • GPU server (DGX H100)
    • 8 GPUs, 80 GB HBM each
  • NVLink/NVSwitch: 8 GPUs
    • 900 GB/s per GPU ≈ 7× PCIe Gen5
  • One 400 Gb/s NIC per GPU
    • Back-end fabric (Part C)
  • CPUs + front-end NICs
    • Storage, data loading, control
  • Memory wall
    • Memory speed lags compute

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)

28 of 75

GPU Server: Why So Much Power?

  • Single Server contains:
    • 4 to 8 GPUs (each 700–1000+ W)
    • CPUs (up to 500 W each), NICs, …
  • Historically, GPUs communicated through PCIe bus 🡺 limiting bandwidth to 64-128 GB/s
  • Recent interconnects (NVLink / NVSwitch):
    • Intra-node fabric for GPU-to-GPU communication
    • Bypasses the PCIe bus completely
    • Provides massive bandwidth (e.g., 900 GB/s)
    • 🡺 Allows all GPUs within the server to operate as a single massive accelerator

28

Host CPU

GPU1

GPU2

GPU3

GPUn

NVSwitch Fabric (900 GB/s)

NIC1

NIC2

NIC3

NICn

29 of 75

Scale-Up Domains: From 8 GPUs to a Rack

  • Scale-up: GPUs joined by NVLink
    • Load/store into each other's memory
    • Highest bandwidth; short copper reach
  • Scale-out: NICs + back-end fabric
    • Packets (RDMA); thousands of GPUs
  • Rack scale: NVIDIA GB200 NVL72
    • 72 GPUs in one NVLink domain
    • ≈ 120 kW per rack, liquid cooled
  • Open standards
    • UALink (up); Ultra Ethernet (out)

29

8 GPUs

(server)

72 GPUs, one NVLink

domain (NVL72 rack)

9×

Scale-out fabric (NICs, RDMA)

joins many domains

30 of 75

AI Datacenters: Scale & Money

  • AI infrastructure spending: hundreds of billions per year
    • 2025 capex: Amazon ≈ $128B (net), Alphabet $91B, Meta $72B
  • 🡺 Networking decisions in these datacenters shape one of the largest infrastructure build-outs in history.

30

>$1T

Global data-center capex

forecast for 2026

$500B

Project Stargate (OpenAI, SoftBank, Oracle, MGX): 10 GW goal

31 of 75

AI vs Traditional Datacenters: Rack Power Density

  • CPU racks: ≈ 10–30 kW (hyperscale)
    • Enterprise average ≈ 8 kW
  • AI racks: 50–200 kW
    • NVL72 ≈ 120 kW; GB300 ≈ 136–140 kW
    • Next: 1 MW racks on 800 V DC
  • ≈ 40 kW: practical limit of air cooling:
    • CRAC units and server fans can no longer remove heat fast enough without increasing PUE significantly
    • 🡺 Liquid cooling becomes essential

​

  • Power has become a limiting factor
    • 🡺 Gigawatt-scale data centers

​

​

​

31

kW/rack

0

40

80

120

2010

2015

2020

2024

2027

Air-cooling limit

Traditional

AI

32 of 75

Power Swings of Synchronized Training

  • All GPUs compute, then all wait
    • Power rises and falls together
    • Repeats every training step
  • Llama 3: swings of tens of MW
    • Stress on grid and power equipment
  • Remedies
    • Keep GPUs busy in idle phases
    • Energy storage, power capping
    • Coordinate with utility

32

time

datacenter power (illustrative)

compute

communicate

Thousands of GPUs in lock-step:

the whole building pulses

33 of 75

Demo: Why Air Cooling Runs Out

  • Tab 1 "Air": 8 → 130 kW
  • Airflow ∝ power / ΔT
    • 8 kW: one floor tile
    • 130 kW: ≈ 11 tiles (21,100 CFM)
  • Fan power ∝ airflow3
    • ×4,300 vs. 8 kW rack
  • Densest air-cooled AI rack: 40.8 kW
  • → AI racks need liquid

33

Preset 3: 130 kW AI rack on air

34 of 75

Liquid Cooling: Two Main Types

  • Direct to Chip (D2C): Most common
    • Metal plates on chips (GPUs, CPUs) 🡪 liquid cools them
    • Example: NVIDIA's GB200 clusters

​

  • Immersion Cooling: Emerging
    • Servers immersed in dielectric liquid
    • Single phase (liquid stays liquid) and two phase (liquid 🡨🡪 vapor)

34

35 of 75

D2C Liquid Cooling Systems: Overview

  • Micro-channel metal cold plates:
    • Mounted on high-heat components (GPUs, CPUs, NVSwitches)
    • Absorb heat 🡺 warm fluid returns through the manifold to the CDU
  • Rack Manifold:
    • Vertical pipe assembly on the rack rear with supply and return headers
    • Splits coolant to each node via quick-disconnect hoses and balances flow

​

​

​

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

  • D2C sends ≈ 72–80% of heat into liquid (GB200 NVL72)
    • Residual heat from memory, NICs, and VRMs still requires supplemental air cooling

​

36 of 75

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

37 of 75

D2C: Complex Management of Liquid

37

Pumps, valves, sensors, heat exchangers: liquid adds plumbing to operate

38 of 75

Immersion Cooling: Single Phase

  • Server nodes are entirely submerged in non-conductive dielectric fluid
  • Single-Phase Immersion:
    • Fluid remains liquid
    • Fluid absorbs heat from hardware
    • Fluid is pumped to heat exchanger

38

39 of 75

Immersion Cooling: Two-Phase

  • The passive cooling cycle:
    • ① GPU heat boils dielectric fluid at the chip surface
    • ② Vapor bubbles rise into the upper vapor zone
    • ③ Vapor condenses on water-cooled coils at tank lid
    • ④ Condensed liquid drips back into the bath — cycle repeats

​

  • Achieves near 100% heat capture
    • Completely eliminates server chassis fans
  • But requires horizontal tanks

​

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)

40 of 75

Demo: Cold Plates and Immersion

  • Tab 2 "Cold plates", 130 kW
    • 104 kW (80%, derived) to liquid
    • 156 L/min; 26 kW still to air
  • Water: ≈ 3,500× heat/volume
  • Tab 3: two-phase immersion
    • Bath stays at 49 °C (boiling)
    • 100 kW boils 43 L/min; no fans
  • Tab 4: heat left for air

40

Tab 2, preset 1: GB200 NVL72-class rack

41 of 75

Liquid Cooling: Environmental Implications

  • Direct to chip (water or water–glycol)
    • Closed loop in rack; heat leaves via facility water
    • Water use depends on heat rejection
    • Cooling towers evaporate water; dry coolers do not
  • Immersion (dielectric fluids)
    • Single-phase: hydrocarbon oils, low toxicity
    • Two-phase: fluorinated fluids, low boiling point
  • Two-phase fluids are PFAS ("forever chemicals")
    • 3M stopped making them (end of 2025)
    • → Industry shifts to D2C and single-phase

41

42 of 75

AI's Footprint: Energy

  • Recall: 415 TWh in 2024
    • ≈ 1.5% of world electricity
    • ≈ 950 TWh, ≈ 3% by 2030
  • New with AI: fast and local
    • 2025: +17%; AI-focused +50%
    • US + China: ≈ 80% of growth
    • US: 4.4% (2023) → 6.7–12% (2028)
  • One AI datacenter ≈ 100,000 homes
    • Local grids become the limit

42

World datacenter electricity (TWh)

415

2024

485

2025

950

2030

(projected)

43 of 75

AI's Footprint: Water

  • WUE = site water (L) / IT energy (kWh)
    • US average ≈ 0.36 L/kWh; AWS ≈ 0.12 (2025)
  • Direct: evaporative cooling on site
    • US datacenters 2023: 66 billion L
  • Indirect: power plants
    • ≈ 800 billion L in 2023 (12× direct)
  • Trends
    • Closed liquid loops, dry coolers
    • Microsoft: zero water for cooling

43

US datacenter water, 2023 (billion L)

66

direct

(on site)

800

indirect

(electricity)

44 of 75

AI's Footprint: Carbon

  • Operational: energy × grid carbon
    • Llama 3.1 405B: 8,930 t CO2e
  • Embodied: making chips and servers
    • One 8-GPU board: ≈ 2.3 t CO2e
  • Reduce with the "4Ms"
    • Model, Machine, Mechanization, Map
    • Up to 100× less energy, 1000× less CO2e
  • Schedule in time and place
    • Run flexible jobs when power is clean

44

The 4Ms (Patterson et al.)

Model

efficient architectures

Machine

ML accelerators

Mechanization

efficient datacenters

Map

cleanest location

45 of 75

​

​

​

Datacenter Fabric Support for AI

When the network becomes the bottleneck

45

46 of 75

AI Training: Impact on Datacenter Fabric

  • AllReduce = few, huge, synchronized elephant flows
    • Not statistically independent
  • 🡺 ECMP may cause elephant flows to collide 🡺 wasting BW and slowing down the whole training process

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

47 of 75

AI Training: Impact on Datacenter Fabric

  • Two complementary solutions:
    • Customize the fabric topology to suit the AI traffic: Rail-optimized and Torus fabrics

​

    • Packet spraying, flowlets (recall Datacenter Design)
  • Also: separate networks for separate traffic
  • This part: rail, MoE, Llama 3, torus

47

48 of 75

Rail-optimized Fabric

  • One NIC per GPU (e.g., 8 GPUs per server 🡪 8 NICs)
    • Instead of one NIC per server
  • Connect GPU i of every server to rail switch i
    • Instead of all connecting to the same leaf switch
    • 🡺 Same-rank GPUs are one switch hop away on their rail
  • Synchronous operations (e.g., All-Reduce)�map logically so that GPU i only communicates �with other GPU i across the cluster
  • Spine layer carries cross-rail and cross-pod traffic
  • 🡺Topology made aware of the AllReduce pattern
  • 🡺 reduce the load that must traverse the expensive upper tiers

​

​

48

Rail 0

Rail 1

G0

G1

G0

G1

G0

G1

49 of 75

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

50 of 75

Three Networks in an AI Cluster

  • Scale-up: NVLink in server or rack
    • ≈ TB/s per GPU; tensor parallelism
  • Back-end (scale-out): GPU to GPU
    • 1 NIC per GPU, 400 Gb/s; RDMA
    • Rail / Clos fabric; DP, PP, CP traffic
  • Front-end: CPU NICs
    • Storage, data loading, checkpoints
    • Ordinary datacenter network
  • Each network matched to its traffic

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

51 of 75

Recap: Parallelism Models

  • Different parallelisms → different traffic patterns
  • Large jobs mix all three

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

52 of 75

Parallelism: Details

  • DP: full model replica per GPU (group) → AllReduce of the FULL gradient every step
    • large volume once per step; overlaps with compute
  • TP: one layer split across GPUs → AllReduce of activations in every layer
    • most bandwidth, latency-sensitive: kept on NVLink
  • PP: consecutive layers as stages → point-to-point activations between neighbors only
    • least bandwidth

​

  • 3D parallelism: large jobs combine DP × TP × PP
    • Fabric must serve all three at once

52

53 of 75

Bandwidth Hierarchy and Parallelism Placement

  • TP: inside the node (NVLink)
  • DP: allocated on nodes on the rail
  • PP: on nodes that may cross the spine
  • Heaviest traffic on fastest tier
    • Hierarchical AllReduce: next module
  • Demo video: 4D parallelism

53

Spine (lowest BW)

Rail (~100s Gbps)

Intra-node (~Tbps)

54 of 75

Is Rail Fabric Good for General Traffic?

  • No. why?
  • Rail assumes rank-aligned traffic
  • Thus, general any-to-any traffic (GPU i → GPU j, where j≠i ) must cross rail→spine→rail more often
  • 🡺 leading to more contention since spine may be oversubscribed

​

  • Operators usually run a separate storage/management fabric alongside the rails
    • Two networks, each matched to its traffic

54

55 of 75

Rail Cabling

  • Rail wiring connects GPU i of every server to rail switch i
  • 🡺 8 links per server go to 8 different switches �🡺 Large cabling/optics cost and operational complexity
    • Additional costs for AI clusters
  • Cross-rail traffic: spine or NVLink hop first
  • Trade-off: tuned for AllReduce, not general

55

56 of 75

Rail in Practice & Scale-Out

  • NVIDIA DGX SuperPOD: rail-optimized full fat-tree
    • 32 nodes form a 'scalable unit'; same rail = one hop
    • Cross-rail traffic goes through the spine
  • NVIDIA Spectrum-X: Ethernet built for AI
    • Adaptive routing + lossless + congestion control
  • Meta: rail-optimized DSF fabric (2025)

56

Scalable Unit (SU)

32 rail-aligned nodes

Same rail = 1 hop

Spine only for cross-rail

57 of 75

Other Parallelisms: CP and MoE

  • Context parallelism (CP):
    • Splits large sequence (context) across GPUs to reduce the required memory on each GPU
  • Mixture of Experts (MoEs):
    • Each MoE layer has many expert MLPs
    • MoE parallelism distributes experts across GPUs
    • Route each token to a few experts (dense models use all weights for every token)
    • 🡺 active parameters per token << total parameters (more efficient, faster training)

​

57

58 of 75

AllToAll Traffic of Mixture-of-Experts

  • Router: each token → few experts
    • e.g., 8 of 256 experts (DeepSeek-V3)
  • Experts on other GPUs → AllToAll
    • Each GPU sends a chunk to every GPU
    • Twice per layer: dispatch, combine
  • Not rank-aligned
    • Crosses rails and spine
  • Uneven: popular experts → hot spots
    • Keep experts in scale-up domain

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)

59 of 75

MoE: Impact on Fabric Design

  • AllToAll needs bisection bandwidth
    • Every GPU pair exchanges tokens
    • Oversubscribed or torus fabrics slow it
  • Keep experts in scale-up domain
    • NVLink 160 vs IB 50 GB/s per GPU
    • NVL72: 64-GPU expert group in one rack
  • Limit, rail-align scale-out traffic
    • Token → at most 4 nodes
    • One copy per node, on its rail
    • Then NVLink inside the node

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

60 of 75

Case Study: Training Llama 3.1 405B

  • Meta published the details of training Llama 3.1
  • Model: 405B-parameter DENSE Transformer; 128K-token context window
  • Data: 15.6 trillion tokens (multilingual text, code, reasoning)
  • Hardware: up to 16,384 H100 (80 GB HBM3, 700 W) GPUs
    • 8 GPUs/server with NVLink interconnecting them

​

60

61 of 75

Llama 3.1 405B: Parallelism

  • 4D parallelism ordered by bandwidth and latency need: TP > CP > PP > DP
  • TP = 8 → exactly the 8-GPU NVLink domain
  • CP = 16 for 128K-context phase (DP = 8 then)
  • PP = 16 spans 16 servers
  • DP = 128 (FSDP) across remaining GPUs

61

62 of 75

Llama 3.1 405B: Fabric and Protocols

  • Three-tier folded Clos; 400 Gbps per GPU
    • Full bisection in 3,072-GPU pod; 1:7 above it
    • 16 GPUs (2 servers) per top-of-rack switch
  • Separate storage/management network for checkpoints and dataset loading
    • Isolation and better performance
  • Enhanced ECMP (E-ECMP) for load balancing
    • Library opens 16 flows per GPU pair; E-ECMP hashes them
  • Used RoCE v2
    • Why Meta did not use DCQCN: Protocol Support, Part D

​

62

63 of 75

More AI Fabrics: Torus

  • Rail: a switched Clos tuned for AI
    • Switched: packet switches between GPUs (rail, Clos)
  • The other big family is direct-connect (torus/mesh)
    • Google TPU AI Cluster
    • Each chip wired to its neighbors; no switches inside
  • Next: torus, then optical circuit switches (recall)

63

64 of 75

Google TPU Clusters: Torus Topology

  • Tensor Processing Units (TPUs)
    • Specifically designed for AI/ML workloads
    • TPUs are deployed in Torus topologies rather than Fat-Trees
    • Each TPU is wired directly to its nearest neighbors in a grid; the ends wrap around�Routing logic is integrated directly into the TPU, eliminating discrete NICs
  • Ideal for predictable, synchronous collectives
    • Ring per dimension; AllReduce maps onto rings
  • Any-to-any traffic: more hops, less bisection

​

​

64

65 of 75

2D Torus: A Ring in Every Row and Column

  • Start: 4 × 4 grid (mesh)
    • Each chip links to N, S, E, W
  • Add wraparound links → torus
    • Every row and column is a ring
    • Farthest chip: 3 → 2 hops per dimension
  • AllReduce runs on the rings
    • Step 1: all rows at once
    • Step 2: all columns at once
  • Chips forward packets: no switches

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

66 of 75

3D Torus: Stacking 2D Tori

  • Stack 4 layers of 4 × 4
  • Link each chip to chips above, below
    • Plus wraparound: top ↔ bottom
  • 6 links per chip: ±X, ±Y, ±Z
  • 4 × 4 × 4 = 64 chips
    • One TPU v4 rack ("cube")
  • k × k × k torus
    • Farthest chip: 3k/2 hops
    • 16 × 16 × 16 = 4,096 chips: 24 hops

66

X

Y

Z

Z links (green)

Z wraparound (red)

One chip: 6 links

In-layer wraparound links not drawn

67 of 75

Recall: Electrical vs Optical Switching

  • Electrical packet switch (EPS)
    • Converts optical → electrical → optical at every hop
    • 🡺 higher power, latency, and cost
    • Uses packet switching
  • Optical Circuit Switches (OCS):
    • Uses micro-electromechanical systems (MEMS) mirrors to direct laser light from one fiber to another
    • Data remains in the optical domain; no conversion
    • 🡺 Less power and latency per hop: no conversion, no buffering
    • Circuit switching: mirrors hold a fiber-to-fiber path until software changes it 🡺 suits slowly changing traffic (between blocks, long AI jobs)
    • Cannot switch per-packet 🡺 complements electrical switching for various traffic

67

In1

In2

In3

MEMS Mirror

Out1

Out2

Out3

No electrical conversion — optical circuit

68 of 75

Google TPU v4: A Rack Is a 4 × 4 × 4 Cube

  • Building block: 4 × 4 × 4 cube
    • 64 TPU v4 chips, 16 hosts, one rack
    • Copper 3D mesh inside, no switches
  • Cube faces leave the rack as fibers
    • 6 faces × 16 = 96 links per cube
    • Each to an optical circuit switch
  • OCS joins + and − faces
    • Closes wraparound → 3D torus
    • Or chains cubes → larger torus

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

69 of 75

OCS: Closing Rings and Joining Cubes

  • Cube line: 4 chips on copper
  • OCS joins its ends → ring
  • Re-point mirrors → span cubes
    • Any 4i × 4j × 4k slice per job
  • Failed cube? Swap in a spare
    • No re-cabling
  • Mirrors move in ms; set per job

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

70 of 75

TPU v4 Pod: Overall Architecture

  • 64 cubes × 64 chips = 4,096 chips
    • 96 fibers per cube: 6,144 in all
  • 48 OCSes, 136 × 136 ports each
    • 16 per dimension; + and − ends meet
  • Copper inside racks, light between
  • OCSes + optics: < 5% of cost, < 3% of power

70

Eight of the 64 racks of one pod

Figures: Jouppi et al., TPU v4, ISCA 2023 (Figs. 1 and 3)

71 of 75

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

72 of 75

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)

73 of 75

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

74 of 75

Summary

  • AI workload: forward, backward, gradient sync
    • Barrier every step: tail latency sets the pace
    • DP, TP, PP, CP, MoE: each has its own traffic
  • AI hardware and power
    • 8-GPU NVLink servers → rack-scale domains
    • 100+ kW racks → liquid cooling; energy, water, carbon
  • AI fabrics: three networks
    • Rail-optimized Clos; torus + OCS (TPU)
    • Each traffic on matching tier (Llama 3)
    • MoE AllToAll needs bisection bandwidth

74

75 of 75

Readings

  • [VJR] Machine Learning Systems, Vol. II
    • ch. 2 compute; ch. 3 fabrics
    • §6.3–6.6 parallelism; §15.6 energy
  • [BHR] The Datacenter as a Computer, 4th ed.
  • Llama 3 paper: §3.3 (infrastructure)
  • Optional papers

75