Basic HTML version of Foils prepared August 7 98

Foil 10 Jacobi Iteration: HPF Program

From DoD HPF Training -- 5. Parallel Programming in HPF DoD Training and Others -- 1995-98. by Chuck Koelbel -- Rice University


1 REAL u(0:nx,0:ny), unew(0:nx,0:ny), f(0:nx,0:ny)
2 !HPF$ DISTRIBUTE u(BLOCK,*)
3 !HPF$ ALIGN (:,:) WITH u(:,:) :: unew, f
4 dx = 1.0/nx; dy = 1.0/ny; err = tol * 1e6
5 FORALL ( i=0:nx, j=0:ny )
  • f(i,j) = -2*(dx*i)**2+2*dx*i-2*(dy*j)**2+2*dy*j
6 END FORALL
7 u = 0.0; unew = 0.0
8 DO WHILE (err > tol)
  • FORALL ( i=1:nx-1, j=1:ny-1 ) &
    • unew(i,j) = (u(i-1,j)+u(i+1,j)+u(i,j-1)+ &
    • u(i,j+1)+f(i,j))/4
  • err = MAXVAL( ABS(unew-u) )
  • u = unew
9 END DO

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 Sun Aug 16 1998