ENH: use Improbe/Mrecv for NBX size exchange

- retains the queried message without secondary polling.
  Purported to be slightly faster. Better thread-safety.
This commit is contained in:
Mark Olesen
2023-05-08 09:13:25 +02:00
parent 50f4d0444c
commit 2eb1f5678d
2 changed files with 81 additions and 59 deletions

View File

@ -131,14 +131,16 @@ int main(int argc, char *argv[])
for (bool barrier_active = false, done = false; !done; /*nil*/)
{
int flag = 0;
MPI_Message message;
MPI_Status status;
MPI_Iprobe
MPI_Improbe
(
MPI_ANY_SOURCE,
tag,
MPI_COMM_WORLD,
&flag,
&message,
&status
);
@ -153,14 +155,12 @@ int main(int argc, char *argv[])
auto& buf = recvBufs(fromProci);
buf.resize_nocopy(count);
MPI_Irecv
MPI_Imrecv
(
buf.data_bytes(),
buf.size_bytes(),
MPI_BYTE,
fromProci,
tag,
MPI_COMM_WORLD,
&message,
&recvRequests.emplace_back()
);
}