MPI_Send MPI_Recv 2, .
:
- , (source), (dest), (tag) (comm). , .
- .
- , . ( buf), - status.
, :
- (comm), ;
- (source);
- (tag), .
count ( ) , . , . , MPI :
- (MPI_ANY_TAG - )
- (MPI_ANY_SOURCE - ).
. . , PSE nCUBE2 [1]. : , , .
, , : , . status. status MPI-. C status - MPI_Status MPI_SOURCE, MPI_TAG, MPI_ERROR. FORTRAN status - INTEGER MPI_STATUS_SIZE. MPI_SOURCE, MPI_TAG MPI_ERROR . status 3.2.
3.2. status. | ||
status | C | FORTRAN |
- | status.MPI_SOURCE | status(MPI_SOURCE) |
status.MPI_TAG | status(MPI_TAG) | |
status.MPI_ERROR | status(MPI_ERROR) |
3.2, status .
|
|
MPI_Get_count:
C:
int MPI_Get_count (MPI_Status *status, MPI_Datatype datatype, int *count)
IN | status | - ; |
IN | datatype | - ; |
OUT | count | - . |
MPI_Get_count ( MPI_Recv, MPI_Irecv), ( MPI_Probe, MPI_Iprobe). . count , , .
MPI_Probe.
C:
int MPI_Probe (int source, int tag, MPI_Comm comm, MPI_Status *status)
IN | source | - -; |
IN | tag | - ; |
IN | comm | - ; |
OUT | status | - . |
MPI_Probe , , - . status. MPI_Probe MPI_Recv ( -, ) , MPI_Probe.
, . , .
CALL MPI_COMM_RANK(comm, rank, ierr)IF (rank.EQ.0) THEN CALL MPI_RECV(recvbuf, count, MPI_REAL, 1, tag, comm, status, ierr) CALL MPI_SEND(sendbuf, count, MPI_REAL, 1, tag, comm, ierr)ELSE IF (rank.EQ.1) THEN CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr) CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr)END IF(0- 1-) . .
.
CALL MPI_COMM_RANK(comm, rank, ierr)IF (rank.EQ.0) THEN CALL MPI_SEND(sendbuf, count, MPI_REAL, 1, tag, comm, ierr) CALL MPI_RECV(recvbuf, count, MPI_REAL, 1, tag, comm, status, ierr)ELSE IF (rank.EQ.1) THEN CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr) CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr)END IFSEND/RECV MPI ( ).
, , MPI_Sendrecv.
:
int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, MPI_Datatype recvtag,
MPI_Comm comm, MPI_Status *status)
|
|
IN | sendbuf | - | ; |
IN | sendcount | - | ; |
IN | sendtype | - | ; |
IN | dest | - | -; |
IN | sendtag | - | ; |
OUT | recvbuf | - | ; |
IN | recvcount | - | ; |
IN | recvtype | - | ; |
IN | source | - | -; |
IN | recvtag | - | ; |
IN | comm | - | ; |
OUT | status | - | . |
MPI_Sendrecv . , . . .
, , MPI_Sendrecv_replace.
:
MPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype,
int dest, int sendtag, int source, int recvtag,
MPI_Comm comm, MPI_Status *status)
INOUT | buf | - | ; |
IN | count | - | ; |
IN | datatype | - | ; |
IN | dest | - | -; |
IN | sendtag | - | ; |
IN | source | - | -; |
IN | recvtag | - | ; |
IN | comm | - | ; |
OUT | status | - | . |
buf .
source dest MPI_PROC_NULL. . / . , , .