N/APosted on - 11/14/2014
I have come across the word ‘stencil’ a lot within the parallel computing community but I still do not know what it is all about. What is stencil and what is the function of using a stencil with a parallel code? How does stencil enhance the performance of a parallel computer code?
What is a Stencil in Parallel Computing Paradigm?
Stencil codes are a category of iterative kernels which update chain elements according to some fixed pattern, called stencil. They are most frequently found in the codes of computer simulations, for example, in computational fluid dynamics regarding to scientific and engineering applications.
The regular structure of the arrays, sets stencil codes besides other modeling methods such as the Finite element method. Most bounded difference codes which act on regular grids can be built as stencil codes. A number of simulation codes may be formulated naturally as stencil codes. Because computing time and memory consumption grow together with many of array elements, stencil codes with parallel built are of significant importance to the research. This is a challenge since the computations are narrowly coupled (because of the cell updates depending on their neighbor cells) and most stencil codes are memory bound as the ratio of memory accesses to calculations is really high. Virtually all today's parallel architectures have been explored for executing stencil codes successfully, at the moment GPGPUs have proven to be most efficient.
The shape of the neighborhood used while updating is conditioned by the application itself. The most common stencils we come across to are the 2D or 3D versions. Bellow are some examples:
9-point 2D Stencil 5-point-2D Stencil 6-point 3D Stencil 25-point 3D Stencil