program pingpong !!! 10-June-2005 c....... This program send the own processor number to the other processor c....... (run with only 2 processors!) c....... WRONG VERSION!! should not work include 'mpif.h' integer status(MPI_STATUS_SIZE) c........initialize MPI call mpi_init(ierr) call mpi_comm_rank(mpi_comm_world,iam,ierr) call mpi_comm_size(mpi_comm_world,nproc,ierr) c........set an ID value for the message tag itag=99 icount=1 isbuf = iam if (iam.eq.0) then idest=1 isource=1 endif if (iam.eq.1) then idest=0 isource=0 endif CALL MPI_RECV(irbuf, icount, MPI_INTEGER, isource, itag, 1 MPI_COMM_WORLD, status, ierr) PRINT*, "TASK #", iam, " received ", irbuf PRINT*, "TASK #", iam, " sent ", isbuf CALL MPI_SEND(isbuf, icount, MPI_INTEGER, idest, itag, 1 MPI_COMM_WORLD, ierr) c........close out MPI call mpi_finalize(ierr) stop end