Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132944 views
License: OTHER
1
#include "mpi.h"
2
3
int msglen, again=1;
4
void *buf;
5
MPI_Datatype datatype
6
MPI_Comm comm;
7
MPI_Status status;
8
9
...
10
while (again) {
11
MPI_Probe(ROOT, MPI_ANY_TAG, comm, &status);
12
MPI_Get_count(&status, datatype, &msglen);
13
buf=malloc(msglen*sizeof(int));
14
MPI_Recv(buf, msglen, datatype, status.MPI_SOURCE,
15
status.MPI_TAG, comm, &status);
16
...
17
}
18
...
19