6 - Gather & Scatter Pattern Flashcards

1
Q

Name 2 applications of a gather & scatter pattern

A

Matrix operation (transpose) only on non-zero elements in a sparse matrix

Given a mask, perform image processing operation only on foreground pixels

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

Discuss data movement in data reorganisation

A

Data movement is the major bottleneck of parallel applications, sometimes more important than parallel computation

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

What should you do for data reorganisation in data-intensive applications?

A

Reorganise data first then perform computation

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

What does reorganisation not always imply

A

Direct data reduction

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

What do gather and scatter patterns arise from?

A

A combination of random read and write with the map pattern

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

What is the input in Gather?

A

A collection of read locations (addresses or array indices)/source array

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

What does Gather do?

A

Reads data from a source array at given locations into the output

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

Name some applications of the Gather pattern?

A

Sparse matrix operations, ray tracing, volume rendering, proximity queries, collision detection

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

What is Shift?

A

A special case of gather

Moves data to the left or right in memory

Data accesses are offset by a fixed distance

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

What does Shift require?

A

Out of bounds data.

There are different variants based on how boundary conditions are handled

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

Discuss the Stencil pattern using Shift

A

For each offset in stencil, generate a new input vector by shifting the input by the offset

Good for 1d stenciles

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

What is the input in Scatter?

A

Collection of write locations (addresses or array indices)/source array

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

What does Scatter do?

A

Writes data into output indicated by the given location, similar to gather which used the locations for reading

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

What happens when Parallel writes to the same location?

A

Collisions

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

What are Collisions/Conflicts?

A

Where two or more values are being written to the same location n the output collection.

Result is undefined, needs rules to be resolved

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

Name 4 strategies to solve conflicts in scatter

A

Atomic scatter

Permutation scatter

Merge scatter

Priority scatter

17
Q

What happens in the Atomic Scatter?

A

Only one value is written (non-deterministic)

Useful with boolean variables

18
Q

What happens in the Permutation Scatter?

A

Collisions are not allowed

Output is a permutation of the input

Check for collisions in advance: turn scatter into gather

FFT scrambling, matrix/image transpose, unpacking

19
Q

What happens in the Merge Scatter?

A

Associative and commutative operators as merge elements

Commutative properties are required since scatters to a particular location could occur in any order

20
Q

What happens in the Priority Scatter?

A

Input elements are assigned a priority based on their position

21
Q

What is the complexity of Gather & Scatter?

A

Same as the parallel Map pattern

Work = O(n)
Span = O(1)
22
Q

What is the performance of Gather & Scatter affected by?

A

Random nature of memory accesses

Gather: performance lower due to random reads

Scatter: performance lower due to random writes and potential write conflicts

23
Q

What is the Pack Pattern used for?

A

Used to eliminate unused elements from a collection. Retained elements are moved so they are contiguous in memory

24
Q

What happens in the Pack Pattern?

A

Assign boolean keys to all elements in the collection; false/0 if an element needs to be filtered out

Perform the exclusive scan on keys, result is an array with output indices

25
Q

What is a Histogram?

A

An estimator of data distribution. Uses bins (value intervals) to count number of values falling into that interval

26
Q

How do Atomic functions resolve the conflict?

A

By serialising accesses to a variable