5 - Scan Pattern Flashcards

1
Q

What is a Cumulative Sum operations?

A

Add all elements and keep all the partial results, output is of the same size as the input

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

What are the two types of Scan?

A

Span efficient (Hillis-Steele) and work efficient (Blelloch)

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

What does the Scan pattern do?

A

Computes all partial reductions of a collection; every element of the output is a reduction of all the elements of the input up to the position of that output element

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

What does the Combiner function take as input?

A

The output of the previous loop iteration as well as the new input value

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

What is the complexity of a serial Scan?

A
Work = O(n)
Span = O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Discuss the requirements of the Scan operation

A

Exactly the same as the reduction pattern: function needs to be associative

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

What happens if the combiner function is non-associative?

A

The Scan cannot be parallelised and it is then called a general fold pattern

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

What are two categories of Scan?

A

Inclusive and exclusive

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

What is an Inclusive Scan?

A

Includes the current element in partial reduction

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

What is an Exclusive Scan?

A

Excludes the current element in partial reduction

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

What is the process of Span-Efficient Inclusive Scan?

A

Form a reduction tree for every output element, then merge the redundant elements of all those trees

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

What is the complexity of parallel Span-Efficient Scan (Hillis Steele)?

A
Work = O(n.log n) = worse than setial version 
Span = O(log n) = span efficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the Span-Efficient scan perform badly on and why?

A

Large arrays, due to its work-inefficiency

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

What is the process of Work-Efficient Scan?

A

Since the combiner function is associative we can reorder operations to reduce span.

Two-phase reordering performing an up-sweep and a down-steep

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

What is up-sweeping?

A

Reducing on input/computing the reduction

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

What is down-sweeping?

A

Produces the intermediate results/values

17
Q

How do you traverse in a work efficient scan?

A

Up-sweep = leaves to roots

Down-sweep = root to leaves

18
Q

What is the complexity of Work Efficient Scan?

A

Requires 2 more steps than HS scan

Requires roughly 3 times more operations than serial scan

Span = O(log n) = less efficient than HS

Work = O(n) = less efficient than serial

19
Q

Which Scan should you use when you have more work than processors?

A

Work Efficient

20
Q

Which Scan should you use when you have more processors than work?

A

Span Efficient

21
Q

Which Scan should you use with 512 elements and 512 processors?

A

Hillis/Steele

22
Q

Which Scan should you use with 1M elements and 512 processors?

23
Q

Which Scan should you use with 128k elements and 1 processor?

24
Q

How do you deal with large arrays?

A

The presented algorithms only work for a single block/work group

Use a two stage procedure to accomodate large arrays

25
What is the Pack Pattern?
Assign boolean keys to all elements in collection, false if an element needs to be filtered out Perform exclusive scan on keys, result is an array with output indices