3-Data-Parallel-Problems Flashcards

(19 cards)

1
Q

What is vector addition in mathematical terms?

A

c = a + b where c_i = a_i + b_i for i = 1 to n

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

What is the serial implementation of vector addition?

A

for(i=0; i<n; i++) c[i] = a[i] + b[i];

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

How does OpenMP parallelize vector addition?

A

Add #pragma omp parallel for before the loop

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

What is the fork-join construct in OpenMP?

A

Main thread spawns worker threads (fork), threads execute loop in parallel, then join back to main thread

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

What are the limitations of #pragma omp parallel for?

A

Requires known loop trip count at start, constant start/end/stride, no break statements, no while/do-while loops

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

What is a data parallel problem?

A

Problems where the same operation is applied to multiple data elements independently

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

What is an embarrassingly parallel problem?

A

A data parallel problem that is straightforward to parallelize with minimal overhead

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

What is the Mandelbrot set used for benchmarking?

A

Computational intensity and visualization - each pixel calculated independently

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

What is the problem with parallelizing the outer loop in Mandelbrot?

A

Shared variable i gets updated by multiple threads, causing skipped pixels and distorted images

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

What are the solutions for the Mandelbrot parallelization problem?

A

1) Declare i inside the loop (private to each thread), 2) Use OpenMP’s private(i) clause

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

What is the collapse clause in OpenMP?

A

Combines nested loops into a single loop for better load balancing: #pragma omp parallel for collapse(2)

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

What is non-determinism in parallel programs?

A

Results that differ between program runs due to thread scheduling and interleaving

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

What causes non-determinism in the incorrect Mandelbrot implementation?

A

Thread scheduler determines order of i increments, causing different pixel calculation orders

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

Why might non-determinism sometimes be acceptable?

A

Some algorithms tolerate small non-deterministic errors (e.g. in science/engineering) if results are still valid

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

What is the trade-off with enforcing determinism?

A

Additional synchronization overhead may reduce performance

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

What are the three main types of loop dependencies?

A

Flow dependencies (read after write), anti-dependencies (write after read), output dependencies (write after write)

17
Q

What is the solution for flow dependencies in loops?

A

Use temporary arrays or change algorithm to remove dependency

18
Q

What is red-black Gauss-Seidel?

A

Modified Gauss-Seidel where even elements are updated first, then odd elements, removing dependencies within each phase

19
Q

What is the key insight of red-black Gauss-Seidel?

A

Dependencies only exist between even and odd elements, not within the same parity group