Basic HTML version of Foils prepared 3 May 98

Foil 7 Example: Red-black iteration

From HPJava and HPspmd Motivation and Status Alliance 98 NCSA Illinois -- April 27-29 98. by Bryan Carpenter, Geoffrey Fox, Xinying Li, Yuhong wen, Guansong Zhang


Procs p = new Procs2(NP, NP) ;
on(p) {
Range x = new BlockRange(N, p.dim(0), 1) ; // ghost width 1
Range y = new BlockRange(N, p.dim(1), 1) ; // ...
float [[,]] u = new float [[x, y]] ;
for(int parity = 0 ; parity < 2 ; parity++) {
Adlib.writeHalo(u, widths) ;
overall(i = x | 1 : N - 2)
overall(j = y | 1 + (x.idx(i) + parity) % 2 : N - 2 : 2)
u [i, j] = 0.25 * (u [i - 1, j] + u [i + 1, j] + u [i, j - 1] + u [i, j + 1]) ;
}
}



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998