|
Data Dependence in Parallel Loops
- Two statements or loops have data access conflict when they refer to the same location
- It is resolved by completing the first access before initiating the second one
Forall Loop
- Each statement computes rhs for all index values before store
forall i = 2 to 10 do
x[i] = x[i-1] + x[i+1]
endall
- If it were a sequential loop
flow dependence from x[i] to x[i-1]
anti dependence from x[i+1] to x[i]
- Semantics of forall loop
- Fetch all old values before writing therefore, no flow dependence
- Two anti dependence from S to S with distances (-1, 1)
Dopar Loop
- Each iteration starts with copies of variables with the values available before the loop
- Value computed in one iteration can not be fetched in another iteration
- If there is conflict between two stores, language model does not resolve. It is likely to be a programmer error
|