3 - Map & Stencil Pattern Flashcards

1
Q

What are parallel patterns?

A

Commonly recurring strategies to deal with problems, general, not dependent on particular platform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the semantics of a parallel pattern?

A

How they work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Map pattern?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe dependencies in the Map pattern

A

There are no dependencies in the map pattern so each element can be processed spearately

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 2 complexity measures for patterns?

A

Work = total number of operations and Span = total number of sequential steps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are embarrassingly parallel problems?

A

Problems solved by the map pattern. Straightforward to implement due to lack of dependency between tasks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name some applications of the Map pattern

A

Vector arithmetic, and brightness/contrast adjustment in image processing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 2 types of map pattern?

A

Unary = 1 input and 1 output, and N-array = n input and 1 output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Sequence of Maps and Maps of Sequences?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the benefits of maps of sequences?

A

Adds arithmetic intensity and reduces the memory requirements and bandwidth

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Give an example of a Map of Sequences

A

C = A * B + B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What do you do if the number of elements in a map pattern is greater than the number of processors?

A

Partition the input data into smaller parts, with each partition being then processed in a serial sequences

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What do you do if the number of elements in a map pattern is greater than the amount of available device memory?

A

Partition into smaller parts, and take additional variables into account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Stencil pattern?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In the Stencil pattern what does the output depend on?

A

A neighbourhood of inputs specified using a set of fixed offsets relative to the output position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Name some applications of the Stencil pattern

A

Common in image and signal processing and PDE solvers over regular grids

17
Q

Describe the result of a 1D averaging filter implemented using the Stencil filter

A

The result is an average of values at the central position and immediate neighbours to the left and right

18
Q

How do you optimise the Stencil pattern?

A

Flexible stencil provided externally by the host as an input argument

Use temporary storage (local memory/cache) to store the neighbourhood which is much faster to access than normal memory

Boundary handling by keeping the main loop without boundary checks