Home Knowledge Base Parallel Stencil Computation

Parallel Stencil Computation is the numerical method where each grid point is updated based on a fixed pattern of neighboring values (the stencil) — ubiquitous in computational fluid dynamics, weather simulation, image processing, and PDE solvers — and one of the most important parallel computing patterns because the regular, local data access pattern enables highly efficient parallelization through domain decomposition with halo exchange, achieving near-linear scaling to millions of cores when communication is properly overlapped with computation.

Stencil Pattern

A 2D 5-point stencil:

new[i][j] = w0*old[i][j] + w1*old[i-1][j] + w2*old[i+1][j]
                          + w3*old[i][j-1] + w4*old[i][j+1]

Each point depends only on its immediate neighbors. Applied to every point in a 2D/3D grid for each timestep. Examples: Jacobi iteration, Gauss-Seidel (with dependency ordering), heat equation, wave equation, weather prediction.

Domain Decomposition

The grid is divided into subdomains, one per processor. Each processor updates its local subdomain independently — except at subdomain boundaries, where stencil calculations need values from adjacent processors' domains.

Halo Exchange (Ghost Cells)

Optimization Techniques

GPU Stencil Implementation

Load a tile of the grid (plus halo) into shared memory. Each thread computes one grid point using shared memory reads (fast, no bank conflicts for stencil patterns). Thread blocks process tiles; the grid is tiled across the entire GPU grid of blocks.

Parallel Stencil Computation is the poster child of structured parallel computing — combining regular data access, predictable communication, and natural domain decomposition into a pattern that scales to the largest supercomputers on Earth, underpinning the simulations that predict weather, design aircraft, and model physical phenomena.

parallel stencil computationhalo exchangeghost cellstencil optimizationstructured grid parallel

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.