code example
Parallel-ForThe plan is extend the translation system to many of the parallel programming models.
int main(int argc, char *argv[]) {
int n = ...;
Grid1 *g = new Grid1(0, n+1);
DistArray x(g), y(g);
... // fill x, y
Grid1IteratorSub it(1, n, g);
float e = 0;
// do computation
ForEach(int i, it,
x(i) += ( y(i+1) + y(i-1) )*.5;
e += sqr( y(i) ); )
... // output x, e
return 0;
}
|
[
start]
[
references]
[
download]
[
install]