Basic HTML version of Foils prepared August 29 98

Foil 22 Simple Fortran Example (2)

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


...
dest = size - 1
if (rank .eq. 0) then
data = 0
call MPI_SEND( data, 1, MPI_INTEGER, rank+1, 99,
+ MPI_COMM_WORLD, ierr )
else if (rank .ne. dest) then
call MPI_RECV(data, count, MPI_INTEGER, rank-1,
+ tag, MPI_COMM_WORLD, status, ierr )
data = data + rank
call MPI_SEND( data, 1, MPI_INTEGER, rank+1, 99,
+ MPI_COMM_WORLD, ierr )
else
call MPI_RECV(data, count, MPI_INTEGER, rank-1,
+ tag, MPI_COMM_WORLD, status, ierr )
print *, rank, ' received', data
endif
...



© 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