9 - Algorithms 2 (Histogram) Flashcards

1
Q

What is a histogram?

A

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

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

Name 2 applications of a Histogram

A

Histogram equalisation (contrast) and object detection

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

What do atomic operations deal with?

A

Race conditions.

But serialise the access to global memory and are slow

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

What is the extreme case in histogram distribution?

A

If all input values are the same ones, one bin will be updated by all threads

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

What is Histogram addition?

A

A combination of two histograms (their sum)

Associative and commutative operation

Variant of reduction

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

What is histogram privatisation?

A

Creating partial private histograms (stored in local memory) which are then combined into a single one

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

What are the two versions of histogram privatisation?

A

Local histogram per work group and local histogram per work item

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

What does local histogram per work group require?

A

Atomics, but on local memory so is much faster

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

What is local histogram per work item?

A

Assigning a local histogram for each work item/thread, then reducing to a single local histogram (i.e using local atomics)

Each work item processes a number of K elements serially and there is no need for synchronisation

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

What is the performance of local histogram per work group?

A

N atomic operations on local memory

B*WG atomic operations on global memory

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

What is the performance of local histogram per work item?

A

N/K atomic operations on local memory

B*WG/K atomic operations on global memory

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

What are limitations of histogram privatisation algorithms?

A

Size of local memory is a limiting factor - defines max number of bins

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

What is the procedure for a histogram sort-search algorithm?

A

Calculate bin indices for each element

Sort

Search for start of segments corresponding to each index - results in a cumulative histogram

Subtract the neighbouring values to receive a normal histogram

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

What are the characteristics of a sort and search histogram procedure?

A

Not effective for small problems. Good for large B and N

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

How does the input data distribution affect the performance of a parallel histogram implementation based on atomics?

A

If all values are the same then only one bin will be updated by all threads, lots of conflicts and serial operations

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