skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
mpi-probing
This page is read only. You can view the source, but not change it.
# MPI probing for messages **Probing** checks for incoming messages without consuming them. `MPI_Probe` returns metadata in `MPI_Status` (including element count) so you can allocate the right buffer before calling `MPI_Recv`. ```c MPI_Status status; MPI_Probe(src, tag, MPI_COMM_WORLD, &status); int count; MPI_Get_count(&status, MPI_DOUBLE, &count); double *buf = malloc(count * sizeof(double)); MPI_Recv(buf, count, MPI_DOUBLE, src, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE); ``` `MPI_Iprobe` is the non-blocking variant: it sets a flag and returns immediately whether or not a matching message is available. Both functions accept `MPI_ANY_SOURCE` and `MPI_ANY_TAG`. When wildcards are used, the source rank from the `MPI_Status` must be passed verbatim to the following `MPI_Recv` to ensure the same message is consumed, not a different one that arrived in between.
Page Tools
Show pagesource
Backlinks
Back to top