Using send and receive Calls
rules of use:
- mpi_send/recv are defined as blocking calls
- the program should not assume blocking behaviour (small messages are buffered)
- when these calls return, the buffers can be (re-)used
-
- the arrival order of messages send from A and B to C is not determined. Two messages from A to B will arrive in the order sent.
-
- Message Passing programming models are non-deterministic.
If(mod(myid,2).eq.0) then
call mpi_send(A,N,MPI_REAL,idst,itag,MPI_COMM_WORLD,ierr)
if(ierr.ne.MPI_SUCCESS) print *,’error from’,id,np,ierr
call mpi_recv(B,NSIZE,MPI_REAL,isrc,itag,MPI_COMM_WORLD,stat,ierr)
if(ierr.ne.MPI_SUCCESS) print *,’error from’,id,np,ierr
call mpi_get_count(stat,MPI_REAL,N)