MPI_Status - , : MPI_SOURCE (), MPI_TAG (), MPI_ERROR ().
:
MPI_Status status; int source; MPI_Recv(buf,N,MPI_INT,1,10,MPI_COMM_WORLD,&status); source = status.MPI_SOURCE; |
/
int MPI_Sendrecv(void *sbuf, int scount, MPI_Datatype stype, int dest, int stag, void *rbuf, int rcount, MPI_Datatype rtype, int source, MPI_Dtatype rtag, MPI_Comm comm, MPI_Status *status)
. . , MPI_Sendrecv, , MPI_Sendrecv , MPI_Send. .
sbuf -
scount -
stype -
dest - -
stag -
rbuf -
rcount -
rtype -
source - -
rtag -
comm -
status -
:
#define N 10 int rank,buf[N], buf1[N]; MPI_Status status; MPI_Sendrecv(buf,N,MPI_INT,1,10,buf1,N,MPI_INT,0,10,MPI_COMM_WORLD,&status); |
int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status status)
, . - (" ", " "), , .
source -
tag
comm -
status -
:
MPI_Status status; MPI_Probe(MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&status); |
int MPI_Get_count(MPI_Status status, MPI_Datatype datatype, int *count)
count . MPI_Probe.
status
datatype
count -
:
MPI_Status status; int count; MPI_Get_count(&status,MPI_INT,&count); |
int MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int source, MPI_Comm comm)
. source , . buf source . count, datatype source .
|
|
buf -
count -
datatype -
source -
comm -
:
#define N 10 int buf[N]; MPI_Bcast(buf,N,MPI_INT,0,MPI_COMM_WORLD); |
int MPI_Scatter(void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, int dest, MPI_Comm comm)
root . .
sbuf -
scount - ; ,
stype -
rbuf -
rcount -
rtype -
dest - ,
comm -
:
#define N 10 #define PROCS 5 int buf[N],buf1[N/PROCS],size; MPI_Scatter(buf,N/PROCS,MPI_INT, buf1,N/PROCS,MPI_INT,0,MPI_COMM_WORLD); |