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


1 ...
2 dest = size - 1
3 if (rank .eq. 0) then
4 data = 0
5 call MPI_SEND( data, 1, MPI_INTEGER, rank+1, 99,
6 + MPI_COMM_WORLD, ierr )
7 else if (rank .ne. dest) then
8 call MPI_RECV(data, count, MPI_INTEGER, rank-1,
9 + tag, MPI_COMM_WORLD, status, ierr )
10 data = data + rank
11 call MPI_SEND( data, 1, MPI_INTEGER, rank+1, 99,
12 + MPI_COMM_WORLD, ierr )
13 else
14 call MPI_RECV(data, count, MPI_INTEGER, rank-1,
15 + tag, MPI_COMM_WORLD, status, ierr )
16 print *, rank, ' received', data
17 endif
18 ...

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 Apr 11 1999