GrPPI
0.3.1
Generic and Reusable Parallel Pattern Interface
|
The stencil pattern applies a transformation to every element in one or multiple data sets, generating a new data set as an output. The transformation also takes as an input a neighborhood of the transformed data item.
The interface to the stencil pattern is provided by function grppi::stencil()
. As all functions in GrPPI, this function takes as its first argument an execution policy.
There are several variants:
The key elements in a stencil are: a StencilTransformer operation and a Neighbourhood operation.
A Neighbourhood operation is any C++ callable entity that takes one or more iterators to data items and generates a neighbourhood. Depending on the number of iterators taking it may be a UnaryNeighbourhood or a MultiNeighbourhood.
Consequently, a UnaryNeighbourhood is any operation op
that given an iterator value it
and an output neighbourhood type N
makes valid the following:
A MultiNeighbourhood is any operation op
that given n iterator values it1
, it2
, ... , itN
and an output neighbourhood type N
makes valid the following:
The StencilTransformer is any C++ callable entity that takes one iterator to a data item and the result of a Neighbourhood operation and performs a transformation.
Thus, a StencilTransfomer is any operation op
that, given an iterator value it
and the result of a Neighbourhood operation n
, makes valid the following:
An unary stencil takes a data set and transforms each element in the data set by applying a transformation to each data item using the data item and its neighbourhood.
The only interface currently offered for this pattern is based in iterators (following the C++ standard library conventions):
An n-ary stencil takes multiple data sets and transforms each element in the data set by applying a transformation to each data item form the first data set and the neighbourhood obtained from all data sets.
The only interface currently offered for this pattern is based in iterators: