Basic HTML version of Foils prepared August 29 98

Foil 45 Jacobi Iteration: MPI Prog. II

From Designing and Building Parallel Programs 3: MPI Message Passing System DoD Modernization Tutorial -- 1995-1998. by Ian Foster, Gina Goff, Ehtesham Hayder, Chuck Koelbel


DO WHILE (err > tol)
  • CALL MPI_SEND(u(1,1),nyblock,MPI_REAL,nbrleft,0,comm2d)
  • CALL MPI_RECV(u(nxlocal,1),nyblock,MPI_REAL,nbrright,0,comm2d)
  • CALL MPI_SEND(u(nxlocal-1,1),nyblock,MPI_REAL, nbrright,1,comm2d)
  • CALL MPI_RECV(u(0,1),nyblock,MPI_REAL,nbrleft,1,comm2d)
  • CALL MPI_SEND(u(1,1),1,rowtype,nbrtop,2,comm2d)
  • CALL MPI_RECV(u(1,nylocal),1,rowtype,nbrbottom,2,comm2d)
  • CALL MPI_SEND(u(nxlocal-1,1),1,rowtype,nbrbottom,3,comm2d)
  • CALL MPI_RECV(u(1,0),1,rowtype,nbrtop,3,comm2d)
  • myerr = 0.0
  • DO j=1, nylocal-1
    • DO i = 1, nxlocal-1
      • unew(i,j) = (u(i-1,j)+u(i+1,j)+u(i,j-1)+u(i,j+1)+f(i,j))/4
      • myerr = max(err, ABS(unew(i,j)-u(i,j)))
    • END DO
  • END DO
  • CALL MPI_ALLREDUCE(myerr,err,1,MPI_REAL,MPI_MAX,MPI_COMM_WORLD,ierr)
  • DO j=1, nylocal-1
    • DO i = 1, nxlocal-1
      • u(i,j) = unew(i,j)
    • END DO
  • END DO
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 Apr 11 1999