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


REAL u(0:nx,0:ny), unew(0:nx,0:ny), f(0:nx,0:ny)
!HPF$ DISTRIBUTE u(BLOCK,*)
!HPF$ ALIGN (:,:) WITH u(:,:) :: unew, f
dx = 1.0/nx; dy = 1.0/ny; err = tol * 1e6
FORALL ( i=0:nx, j=0:ny )
  • f(i,j) = -2*(dx*i)**2+2*dx*i-2*(dy*j)**2+2*dy*j
END FORALL
u = 0.0; unew = 0.0
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
END DO



© 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