<div dir="ltr"><div>Thanks for the response, Hari - and for looking into this issue.</div><div><br></div><div>To probe a bit further on this though: is your advice mainly based on normal MPI_Send operations... or on asynchronous (ISend, ISSend) ops?</div><div><br></div><div>The reason I ask is that I can see how eager sends are always better for MPI_Send... since it lets MPI_Send return immediately and the program can do other things (effectively turns it into an ISend in a way).</div><div><br></div><div>But with asynchronous sends... I can't see how creating a temporary buffer and then copying the data would ever be faster than just directly using the buffer that was supplied. But maybe there is some part of this that I'm not considering? Maybe you are able to aggregate small messages, or maybe you can do things with memory alignment, or maybe you're able to allocate memory directly on the sending device?</div><div><br></div><div>Seriously wanting to learn here. I was surprised when digging into this that asynchronous sends were getting the eager send treatment and it would be great to have a better understanding of why.</div><div><br></div><div>Thanks!</div><div><br></div><div>Derek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 17, 2021 at 9:59 AM Subramoni, Hari <<a href="mailto:subramoni.1@osu.edu">subramoni.1@osu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="gmail-m_-8559030810811871606WordSection1">
<p class="MsoNormal">Hi, Derek.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I would not recommend that. Using eager send operations for small messages is always best for performance. Let me take a look at this and see how this can be circumvented. I am sure there are some quick ways in which we can achieve this.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thx,<u></u><u></u></p>
<p class="MsoNormal">Hari.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> Derek Gaston <<a href="mailto:friedmud@gmail.com" target="_blank">friedmud@gmail.com</a>> <br>
<b>Sent:</b> Thursday, June 17, 2021 11:35 AM<br>
<b>To:</b> Subramoni, Hari <<a href="mailto:subramoni.1@osu.edu" target="_blank">subramoni.1@osu.edu</a>><br>
<b>Cc:</b> <a href="mailto:mvapich-discuss@lists.osu.edu" target="_blank">mvapich-discuss@lists.osu.edu</a><br>
<b>Subject:</b> Re: [Mvapich-discuss] Excessive Memory Usage By Vbufs<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Thank you both - please let me know if there is anything else we can do to help track it down.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I also noticed that my table got destroyed by the mailing list - so I added it as a comment at the bottom of the gist here:
<a href="https://urldefense.com/v3/__https:/gist.github.com/friedmud/9533d5997f06414c25f8c5c57a1eaf37__;!!KGKeukY!kIluzLR7TbVtr2sNEO_wcv9WtBCfzAJN6IUIHipFo3EmfgxE_DpEPEpz2lGQi8JIeg$" target="_blank">
https://gist.github.com/friedmud/9533d5997f06414c25f8c5c57a1eaf37</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">As a related question: our application has a need to do this a _lot_ (lots of small messages sent asynchronously). All of the creation of temporary buffers and copying of data seems like it may be slowing us down in general. Do you think
it may be a good idea to just turn off (or way down) eager sending all together?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks again!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Derek<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Jun 17, 2021 at 9:05 AM Subramoni, Hari <<a href="mailto:subramoni.1@osu.edu" target="_blank">subramoni.1@osu.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi, Derek.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks for reporting this to us.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">There are a few potential solutions I can think of. Let us try this out and get back to you.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Best,<u></u><u></u></p>
<p class="MsoNormal">Hari.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">PS: The ID “<a href="mailto:mvapich-discuss@cse.ohio-state.edu" target="_blank">mvapich-discuss@cse.ohio-state.edu</a>” has been discontinued and replaced with
<a href="mailto:mvapich-discuss@lists.osu.edu" target="_blank">mvapich-discuss@lists.osu.edu</a>. That is probably why your previous e-mail bounced.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in;border-color:currentcolor">
<p class="MsoNormal"><b>From:</b> Mvapich-discuss <<a href="mailto:mvapich-discuss-bounces@lists.osu.edu" target="_blank">mvapich-discuss-bounces@lists.osu.edu</a>>
<b>On Behalf Of </b>Derek Gaston via Mvapich-discuss<br>
<b>Sent:</b> Thursday, June 17, 2021 10:42 AM<br>
<b>To:</b> <a href="mailto:mvapich-discuss@lists.osu.edu" target="_blank">mvapich-discuss@lists.osu.edu</a><br>
<b>Subject:</b> [Mvapich-discuss] Excessive Memory Usage By Vbufs<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">I got an odd message that seemed like my email bounced. So, just sending this again to make sure it goes through.<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">---------- Forwarded message ---------<br>
From: <b>Derek Gaston</b> <<a href="mailto:friedmud@gmail.com" target="_blank">friedmud@gmail.com</a>><br>
Date: Wed, Jun 16, 2021 at 3:33 PM<br>
Subject: Excessive Memory Usage By Vbufs<br>
To: <<a href="mailto:mvapich-discuss@cse.ohio-state.edu" target="_blank">mvapich-discuss@cse.ohio-state.edu</a>><u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12pt"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hello all,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">We're trying to track down an issue that we can see with MVAPICH 2.3.5, but not with OpenMPI.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">What's happening is that sending _many_ small messages with isend or issend is causing allocate_vbuf_pool to grow to incredibly large and not be released until MPI_Finalize. My
suspicion is that the messages are small enough that eager sends are creating temporary buffers that are not being freed once the send is completed (seems like that buffer should get freed with an MPI_Wait).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">To test this out I wrote a tiny little C++ program that you can find here:
<a href="https://urldefense.com/v3/__https:/gist.github.com/friedmud/9533d5997f06414c25f8c5c57a1eaf37__;!!KGKeukY!kJAyBUCMODuiN1Hj7XHPleuCMx-_JNRgpAIEmYxmDXRpAiYOHWxuu4-UYqzKFZHmo6JF0CrmNw$" target="_blank">
https://gist.github.com/friedmud/9533d5997f06414c25f8c5c57a1eaf37</a> (Need a C++11 compliant compiler to compile it)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The configuration parameters are all at the top - and what it does is send an array of doubles to every other process on COMM_WORLD. Nothing earth-shattering.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">You can see the results below when running on 576 procs (and using Gperftools instrumentation to check the memory usage for one process). What's happening is that for message sizes
of less than 2000 doubles (less than 128k) allocate_vbuf_pool is using a large amount of memory. Once the message size goes over 2000 doubles then the memory drops back down (in my theory: because then the buffer is used directly instead of being copied to
a temporary buffer for eager sending).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Note that the memory is being reported just before and after MPI_Finalize. Finalize seems to release all of the memory... so it's not being "lost"... it's just not getting freed
up once the send is done (and maybe not being reused well enough?).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Any suggestions here?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Derek<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<div>
<table cellpadding="0" border="0">
<tbody>
<tr style="height:15.75pt">
<td style="width:65.25pt;padding:0.75pt;height:15.75pt" width="87">
<p class="MsoNormal">MPI type<u></u><u></u></p>
</td>
<td style="width:138.75pt;padding:0.75pt;height:15.75pt" width="185">
<p class="MsoNormal">Num procs (sent-received)<u></u><u></u></p>
</td>
<td style="width:74.25pt;padding:0.75pt;height:15.75pt" width="99">
<p class="MsoNormal">Message size<u></u><u></u></p>
</td>
<td style="width:62.25pt;padding:0.75pt;height:15.75pt" width="83">
<p class="MsoNormal">Initial<u></u><u></u></p>
</td>
<td style="width:135.75pt;padding:0.75pt;height:15.75pt" width="181">
<p class="MsoNormal">Before MPI_Finalize (MB)<u></u><u></u></p>
</td>
<td style="width:108.75pt;padding:0.75pt;height:15.75pt" width="145">
<p class="MsoNormal">Final<u></u><u></u></p>
</td>
<td style="width:185.25pt;padding:0.75pt;height:15.75pt" width="247">
<p class="MsoNormal">Top function<u></u><u></u></p>
</td>
</tr>
<tr style="height:15.75pt">
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MVAPICH<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">576 (57500)<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
100<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
48.4<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">allocate_vbuf_pool<u></u><u></u></p>
</td>
</tr>
<tr style="height:15.75pt">
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MVAPICH<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">576 (57500)<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
1000<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
534.1<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">allocate_vbuf_pool<u></u><u></u></p>
</td>
</tr>
<tr style="height:15.75pt">
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MVAPICH<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">576 (57500)<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
10000<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
68<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MPIU_Handle_indirect_init<u></u><u></u></p>
</td>
</tr>
<tr style="height:15.75pt">
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MVAPICH<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">576 (57500)<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
100000<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
68.1<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal" style="text-align:right" align="right">
0<u></u><u></u></p>
</td>
<td style="padding:0.75pt;height:15.75pt">
<p class="MsoNormal">MPIU_Handle_indirect_init<u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>