<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>Rob,<br><br></div>Thanks for your reply. Let me rephrase my question. I'm simulating what I do in a complicate code. P0 Isends data to P1, and does computations. P1 needs data to do computation, so it calls Recv. As you said, P0 is calling MPI_Test periodically. What puzzles me is why 2 calls of MPI_Test are needed to let P1 receive the data. (With Intel MPI, the number jumps to around 6.) The number of MPI_Test calls has influence on performance. Thanks.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Best regards,<div>Zhen</div></div></div></div>
<br><div class="gmail_quote">On Mon, Apr 25, 2016 at 4:13 PM, Rob Latham <span dir="ltr"><<a href="mailto:robl@mcs.anl.gov" target="_blank">robl@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 04/25/2016 02:57 PM, Zhen Wang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I have questions regarding MPI_Isend and MPI_Test. A sample code is<br>
attached, output is as follows.<br>
<br>
For instance, both Isend and Recv of 0 start at 15:46:14, but 2 MPI_Test<br>
are called before Recv of 0 finishes. My understanding is first Test<br>
receives the signal that receiver is ready, and data transfer follows.<br>
Then the second Test will see the transfer is complete, and free<br>
MPI_Request. Is my understanding correct? Thanks.<br>
</blockquote>
<br></span>
MPI_Test() is non-blocking.  MPI_Test() is not going to wait for anything to happen -- that's what MPI_Wait() will do.<br>
<br>
under the hood, MPI_Test "kicks the progress engine", which means everything that can execute right now will happen.  If there is anything that requires code to wait (to receive a signal, in your case), then test will return.<br>
<br>
A data transfer might take several calls to MPI_Test to complete.  Or, there's a background progress thread that's churning along and you only need to make one call to MPI_Test.  It's implementation-dependent.<br>
<br>
You are asking the wrong question, though.  At this level, it doesn't matter what MPI_Test does.  If your code has something it can do while the isend progresses, then go do that and call MPI_Test periodically. If you have nothing productive you can do, call MPI_Wait() (or one of the variants).<br>
<br>
==rob<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<br>
Best regards,<br>
Zhen<br>
<br>
MPI 1: Recv of 0 started at 15:46:14.<br>
MPI 0: Isend of 0 started at 15:46:14.<br>
MPI 0: Isend of 1 started at 15:46:14.<br>
MPI 0: Isend of 2 started at 15:46:14.<br>
MPI 0: Isend of 3 started at 15:46:14.<br>
MPI 0: Isend of 4 started at 15:46:14.<br>
MPI 0: MPI_Test of 0 at 15:46:16.<br>
MPI 0: MPI_Test of 0 at 15:46:18.<br>
MPI 0: Isend of 0 finished at 15:46:18.<br>
MPI 1: Recv of 0 finished at 15:46:18.<br>
MPI 1: Recv of 1 started at 15:46:18.<br>
MPI 0: MPI_Test of 1 at 15:46:20.<br>
MPI 0: MPI_Test of 1 at 15:46:22.<br>
MPI 0: Isend of 1 finished at 15:46:22.<br>
MPI 1: Recv of 1 finished at 15:46:22.<br>
MPI 1: Recv of 2 started at 15:46:22.<br>
MPI 0: MPI_Test of 2 at 15:46:24.<br>
MPI 0: MPI_Test of 2 at 15:46:26.<br>
MPI 0: Isend of 2 finished at 15:46:26.<br>
MPI 1: Recv of 2 finished at 15:46:26.<br>
MPI 1: Recv of 3 started at 15:46:26.<br>
MPI 0: MPI_Test of 3 at 15:46:28.<br>
MPI 0: MPI_Test of 3 at 15:46:30.<br>
MPI 0: Isend of 3 finished at 15:46:30.<br>
MPI 1: Recv of 3 finished at 15:46:30.<br>
MPI 1: Recv of 4 started at 15:46:30.<br>
MPI 0: MPI_Test of 4 at 15:46:32.<br>
MPI 0: MPI_Test of 4 at 15:46:34.<br>
MPI 0: Isend of 4 finished at 15:46:34.<br>
MPI 1: Recv of 4 finished at 15:46:34.<br>
<br>
<br>
<br></div></div>
_______________________________________________<br>
discuss mailing list     <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br>
<br>
</blockquote>
_______________________________________________<br>
discuss mailing list     <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br>
</blockquote></div><br></div>