conduit icon indicating copy to clipboard operation
conduit copied to clipboard

Allow recv_using_schema to work with MPI_ANY_SOURCE and MPI_ANY_TAG

Open gunney1 opened this issue 3 years ago • 0 comments

This requests a small change in conduit::relay::mpi::recv_using_schema to make it work properly when the source is MPI_ANY_SOURCE.

This currently doesn't work because the MPI_Recv doesn't necessarily catch the message found by the preceding MPI_Probe, because it doesn't specifically identify the message it wanted (and allocated memory for). To fix this, replace

mpi_error = MPI_Recv(n_buffer.data_ptr(),
                     buffer_size,
                     MPI_BYTE,
                     src,
                     tag,
                     comm,
                     &status);

with

mpi_error = MPI_Recv(n_buffer.data_ptr(),
                     buffer_size,
                     MPI_BYTE,
                     status.MPI_SOURCE,
                     tag,
                     comm,
                     &status);

Better yet, it can also support MPI_ANY_TAG as well, with

mpi_error = MPI_Recv(n_buffer.data_ptr(),
                     buffer_size,
                     MPI_BYTE,
                     status.MPI_SOURCE,
                     status.MPI_TAG,
                     comm,
                     &status);

gunney1 avatar Jul 29 '22 21:07 gunney1