CALL MPI_COMM_RANK(comm, rank, ierr) IF (RANK.EQ.0) THEN CALL MPI_ISEND(a, 1, MPI_REAL, 1, 0, comm, r1, ierr) CALL MPI_ISEND(b, 1, MPI_REAL, 1, 0, comm, r2, ierr) ELSE ! rank.EQ.1 CALL MPI_IRECV(a, 1, MPI_REAL, 0, MPI_ANY_TAG, comm, r1, ierr) CALL MPI_IRECV(b, 1, MPI_REAL, 0, 0, comm, r2, ierr) END IF CALL MPI_WAIT(r1,status) CALL MPI_WAIT(r2,status)The first send of process zero will match the first receive of process one, even if both messages are sent before process one executes either receive.
MPI-Standard for MARMOT