Learning path

Full curriculum

Full curriculum

Unit content

Domain decomposition and halo exchange

Grid-based simulations can be parallelized by dividing the spatial domain into subdomains owned by different workers.

Most updates use nearby values, so a worker can compute interior points using local data. Near a partition boundary, however, the update may require values owned by a neighboring worker.

Each worker therefore keeps a halo or ghost region containing copies of neighboring boundary values. During one step, a worker can begin exchanging its current boundary data, compute interior points that do not depend on incoming data, then finish boundary points after the halo values arrive:

start boundary exchange
compute interior points
wait for required halo values
compute boundary points

For a 2D grid split into rectangular blocks, useful computation grows roughly with block area while nearest-neighbor communication grows with boundary length. Larger compact blocks therefore tend to have a better computation-to-communication ratio than many tiny or elongated partitions.

Halo exchange need not imply a global barrier when only neighboring dependencies matter. Independent interior computation can overlap communication.

Domain decomposition converts geometric locality into parallel locality: give each worker a region, keep most accesses local, and communicate only the boundary information required by neighboring update rules.