5-Loop-Parallelism Flashcards

(14 cards)

1
Q

What is loop parallelism?

A

Parallelizing loops by distributing iterations across multiple threads

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

What are the three types of loop dependencies?

A

Flow dependencies (RAW - read after write), Anti-dependencies (WAR - write after read), Output dependencies (WAW - write after write)

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

How do you identify loop dependencies?

A

Check if variables are read/written in different iterations in conflicting orders

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

What is the solution for flow dependencies?

A

Use temporary arrays to break the read-after-write dependency

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

What happens in the incorrect parallel shift example?

A

for(i=0; i<n-1; i++) a[i] = a[i+1]; - threads overwrite values before others read them

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

What is the correct solution for parallel array shifting?

A

Use a temporary array: copy to temp first, then shift from temp

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

What is the Gauss-Seidel method?

A

Iterative numerical method where each element is updated using neighbors: a[i] = 0.5*(a[i-1] + a[i+1])

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

Why is standard Gauss-Seidel not parallelizable?

A

Each update depends on the previous update in the loop

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

What is red-black Gauss-Seidel?

A

Modified version where even indices are updated first, then odd indices, removing dependencies within each phase

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

How does red-black ordering remove dependencies?

A

Even elements depend on odd neighbors, odd elements depend on even neighbors - separating by parity breaks this cycle

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

What are the two phases in red-black Gauss-Seidel?

A

Phase 1: update all even indices, Phase 2: update all odd indices

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

What is the key insight for parallelizing dependent algorithms?

A

Sometimes a small algorithm change can remove dependencies while preserving correctness

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

What are the limitations of the dependency removal approach?

A

May require more iterations to converge, but each iteration is now parallelizable

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

What is the general strategy for handling loop dependencies?

A

1) Identify dependencies, 2) Try to remove them with algorithm changes, 3) Use synchronization if removal impossible, 4) Consider if parallelization is worth the overhead

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