MPI recv from an unknown source
This assumes you are using C. There are similar concepts in C++ and Fortran. You would just specify MPI_ANY_SOURCE as the source in the MPI_recv(). The status struct contains the actual source of the message. int buf[32]; MPI_Status status; // receive message from any source MPI_recv(buf, 32, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status); int replybuf[]; // … Read more