Log inStart free
LESSON 11.09 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Collective operations

Five collectives move gradient chunks between GPUs, one step at a time.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 11.09 · COLLECTIVE BAY4 GPUS · 4 CHUNKS EACH · 2.5 MS PER CHUNK
01
Stage 1 of 6 · The gradients
Each GPU holds its own gradient vector of 4 chunks. Training needs the sum on every GPU.
Explain it simply

You see one column per GPU. Each GPU trained on different data, so each one holds a different gradient vector. The vector splits into 4 chunks, one per GPU. One whole vector takes 10 milliseconds on one link, so one chunk takes 2.5.

4 GPU columns. GPU 0 holds 1, 4, 4, 3. GPU 1 holds 9, 1, 1, 8. GPU 2 holds 7, 7, 6, 2. GPU 3 holds 5, 4, 5, 7.

input gradient chunksum or received chunkempty slottime
GPU 0GPU 1GPU 2GPU 31443911877625457startthe gradients1 GB per GPU ÷ 100 GB/s = 10 ms per vector · 1 chunk = 1/4 vector = 2.5 msGPU 0GPU 1GPU 2GPU 31443911877625457startthe gradients1 GB per GPU ÷ 100 GB/s = 10 ms per vector · 1 chunk = 1/4 vector = 2.5 ms
Toy: 2–4 GPUs · 1 GB per vector · 100 GB/s links
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
xg=[ xg[0],…,xg[N−1] ]\sy{x}{grad}{x_g} = [\,x_g[0], \dots, x_g[N-1]\,]
x0=[1,4,4,3],  x1=[9,1,1,8],  x2=[7,7,6,2],  x3=[5,4,5,7]x_{0} = [1, 4, 4, 3],\;x_{1} = [9, 1, 1, 8],\;x_{2} = [7, 7, 6, 2],\;x_{3} = [5, 4, 5, 7]

Each GPU g holds a vector of N chunks.

Common mix-ups

MYTHAllReduce must send every whole vector to every GPU.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With 4 GPUs, if every GPU sends its whole vector to every other GPU, is AllReduce faster or slower?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.