Dependence Analysis
The parallel for system creates an intermediate data dependence analysis in order to generate parallel source code for different programming models.
A simplified translation of the following example parallel-for loop is given below.
Grid1 *g = new Grid1(0, n+1);
Grid1IteratorSub it(1, n, g);
DistArray x(g), y(g);
float e = 0;
ForEach(int i, it,
x(i) += ( y(i+1) + y(i-1) )*.5;
e += sqr( y(i) ); )
|
dependence analysis:
1 begin:
1 iter: ` load [#,#] store [#,#]' `x' `class `DistArray1''
1 iter: ` load [#-1,#+1]' `y' class `DistArray1''
1 reduce: `add' `e' `float'
1 load: `it' `class `Grid1IteratorSub''
1 wend:
|