program main include 'mpif.h' integer ierr, rank real sendbuf(2048) real recvbuf(2048) integer count, tag, request, status, i logical flag call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) count = 2048 tag = 0 flag = .FALSE. if (rank == 0) then call SLEEP(3) print *, 'Hello world! I am proc ', rank, 1 ', sending to proc 1' call MPI_ISEND(sendbuf, count, MPI_REAL, 1 1, tag, MPI_COMM_WORLD, request, ierr) call MPI_WAIT(request, status, ierr) else if (rank == 1) then call MPI_IRECV(recvbuf, count, MPI_REAL, 1 0, tag, MPI_COMM_WORLD, request, ierr) DO WHILE (.NOT. flag) print *, 'Wait ', i call MPI_TEST(request, flag, status, ierr) i = i + 1 END DO endif print *, 'Proc ', rank, ' finished!!' call MPI_FINALIZE(ierr) end