Syntax:
Sind mehrere Operationen beendet, wird eine davon ausgewählt. Falls array_of_requests keine oder nur inaktive Request-Objekte enthält, kehrt die Funktion sofort mit index=MPI_UNDEFINED und undefiniertem Status zurück.
Aufruf:
#include "mpi.h"
#define N 32
#define MAXLEN 128
...
int index, flag=0;
char recvbuf[N][MAXLEN];
MPI_Request array_of_requests[N];
MPI_Status status;
...
for (i=0; i<N; i++) {
MPI_Send_init(buf, bufsize, MPI_CHAR, i+1, i, comm, &array_of_requests[i]);
}
...
MPI_Startall(N, array_of_requests);
...
while (flag==0) {
MPI_Testany(N, array_of_requests, &index, &flag, &status);
if (flag) {
MPI_Recv(recvbuf[index], MAXLEN, MPI_CHAR, status.MPI_SOURCE,
status.MPI_TAG, comm, &status);
...
}
...
}
...
for (i=0; i<N; i++) {
MPI_Request_free(&array_of_requests[i]);
}
...