3 - Map & Stencil Pattern Flashcards
What are parallel patterns?
Commonly recurring strategies to deal with problems, general, not dependent on particular platform
What are the semantics of a parallel pattern?
How they work
What is the Map pattern?
Map applies an elemental function to every element of data in parallel resulting in a new collection of the same shape as the input.
The result does not depend on the order in which various instances of the function are executed
Describe dependencies in the Map pattern
There are no dependencies in the map pattern so each element can be processed spearately
What are the 2 complexity measures for patterns?
Work = total number of operations and Span = total number of sequential steps
What are embarrassingly parallel problems?
Problems solved by the map pattern. Straightforward to implement due to lack of dependency between tasks
Name some applications of the Map pattern
Vector arithmetic, and brightness/contrast adjustment in image processing
What are the 2 types of map pattern?
Unary = 1 input and 1 output, and N-array = n input and 1 output
What is Sequence of Maps and Maps of Sequences?
Converting several map operations of the same size that occur in sequence into a map of sequences by fusing together the operations to perform them in a single map
What are the benefits of maps of sequences?
Adds arithmetic intensity and reduces the memory requirements and bandwidth
Give an example of a Map of Sequences
C = A * B + B
What do you do if the number of elements in a map pattern is greater than the number of processors?
Partition the input data into smaller parts, with each partition being then processed in a serial sequences
What do you do if the number of elements in a map pattern is greater than the amount of available device memory?
Partition into smaller parts, and take additional variables into account
What is the Stencil pattern?
Stencil is a generalisation of the Map pattern in which an elemental function can access not only a single element in an input collection but also a set of neighbours
In the Stencil pattern what does the output depend on?
A neighbourhood of inputs specified using a set of fixed offsets relative to the output position