Skip to content

TechnicalBeginner

Parallelism

For: engineers and SREs · architects · team managers · executives and CIOsPrerequisites: Have read lesson 1 of the course.

Three patterns, from the simplest to the most demanding

Section titled “Three patterns, from the simplest to the most demanding”
PatternCommunicationExamples
Trivial parallelism (embarrassingly parallel)none: each task runs alone, results are gathered at the endimage conversion, parameter sweeps, Monte Carlo
Tight coupling (MPI)constant: at each time step, each processor exchanges with its neighborsatmospheric simulation, fluid dynamics, finite elements
Data parallelismper batch: the model is replicated on each GPU and synchronized after each batchLLM training, vision, recommendation

The three patterns differ in the shape of their exchanges:

flowchart TB
  subgraph TRI["Trivial"]
    direction LR
    T1["Task 1"] --> TR["Results<br/>gathered"]
    T2["Task 2"] --> TR
    T3["Task 3"] --> TR
  end
  subgraph MPI["Tight coupling, MPI"]
    direction LR
    M1["P1"] <--> M2["P2"]
    M2 <--> M3["P3"]
    M3 <--> M4["P4"]
  end
  subgraph DAT["Data parallelism"]
    direction LR
    G1["GPU 1<br/>model copy"] <--> SY["Synchronization<br/>after each batch"]
    G2["GPU 2<br/>model copy"] <--> SY
  end
  TRI ~~~ MPI
  MPI ~~~ DAT

The more frequent the communication, the more critical the interconnect becomes and the more a single slow node slows down all the others.

Strong scaling: the problem stays fixed, you add processors and measure the time saved.

Weak scaling: the problem grows along with the number of processors, and you check whether the time stays stable.

Doubling the number of processors rarely halves the time. Part of the work cannot be divided. At large scale, these non-parallel parts and the cost of communications set the limit.

Example: if 5% of the work is sequential, the speedup will never exceed 20, whatever the number of processors.

FieldUses
Weather and climateglobal forecasts several times a day, simulations over several decades
Energy and engineeringaerodynamics, crash tests, reservoirs, nuclear safety
Life sciencesmolecular screening, genomics, medical imaging
Finance and riskvaluation of complex portfolios, regulatory stress tests
Defensecryptography, signal processing, geospatial
Public researchastrophysics, materials, shared national infrastructures

In most of these fields, there is no other way to see the work through to the end.