Basic HTML version of Foils prepared August 15 98

Foil 99 Example: Red-black iteration

From Java Grande: Role of Java in Large Scale Computations NPACI Summer Institute on Parallel Computing -- August 21 98. by Geoffrey C. Fox


1 Procs p = new Procs2(NP, NP) ;
2 on(p) {
3 Range x = new BlockRange(N, p.dim(0), 1) ; // ghost width 1
4 Range y = new BlockRange(N, p.dim(1), 1) ; // ...
5 float [[,]] u = new float [[x, y]] ;
6 for(int parity = 0 ; parity < 2 ; parity++) { // red and black
7 Adlib.writeHalo(u, widths) ; // Communicate Ghost Cells
8
9 overall(i = x [1 : N - 2])
10 overall(j = y [1 + (x.idx(i) + parity) % 2 : N - 2 : 2])
11 u [i, j] = 0.25 * (u [i - 1, j] + u [i + 1, j] +
12 u [i, j - 1] + u [i, j + 1]) ;
13 }
14 }

in Table To:


© 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 Sat Nov 28 1998