Basic HTML version of Foils prepared August 29 98

Foil 44 Jacobi Iteration: MPI Program

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


PARAMETER(nxblock=nx/nxp, nyblock=ny/nyp, nxlocal=nxblock+1, nylocal=nyblock+1)
REAL u(0:nxlocal,0:nylocal),unew(0:nxlocal,0:nylocal),f(0:nxlocal,0:nylocal)
dims(1) = nxp; dims(2) = nyp;
periods(1) = .false.; periods(2) = .false.
reorder = .true.
ndim = 2
call MPI_CART_CREATE(MPI_COMM_WORLD,ndim,dims,periods, reorder,comm2d,ierr)
CALL MPI_COMM_RANK( MPI_COMM_WORLD, myrank, ierr )
CALL MPI_CART_COORDS( MPI_COMM_WORLD, myrank, 2, coords, ierr )
CALL MPI_CART_SHIFT( comm2d, 0, 1, nbrleft, nbrright, ierr )
CALL MPI_CART_SHIFT( comm2d, 1, 1, nbrbottom, nbrtop, ierr )
CALL MPI_Type_vector( nyblock, 1, nxlocal+1, MPI_REAL, rowtype )
CALL MPI_Type_commit( rowtype, ierr );
dx = 1.0/nx; dy = 1.0/ny; err = tol * 1e6
DO j = 0, nylocal
  • DO i = 0, nxlocal
    • f(i,j) = -2*(dx*(i+coords(1)*nxblock))**2 + 2*dx*(i+coords(1)*nxblock)&
    • u(i,j) = 0.0
    • unew(i,j) = 0.0
  • 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