<div dir="ltr">I got an odd message that seemed like my email bounced.  So, just sending this again to make sure it goes through.<br><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <b class="gmail_sendername" dir="auto">Derek Gaston</b> <span dir="auto"><<a href="mailto:friedmud@gmail.com">friedmud@gmail.com</a>></span><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">mvapich-discuss@cse.ohio-state.edu</a>><br></div><br><br><div dir="ltr"><div>Hello all,</div><div><br></div><div>We're trying to track down an issue that we can see with MVAPICH 2.3.5, but not with OpenMPI.</div><div><br></div><div>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).</div><div><br></div><div>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)<br></div><div><br></div><div>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.</div><div><br></div><div>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).</div><div><br></div><div>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?).</div><div><br></div><div>Any suggestions here?</div><div><br></div><div>Thanks!</div><div><br></div><div>Derek<br></div><div><br></div><div><br></div><div><br></div><div><div style="box-sizing:border-box;font-family:"Segoe UI",system-ui,"Apple Color Emoji","Segoe UI Emoji",sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="box-sizing:border-box;font-family:"Segoe UI",system-ui,"Apple Color Emoji","Segoe UI Emoji",sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><table><tbody><tr height="21"><td width="87" height="21">MPI type</td>
<td width="185">Num procs (sent-received)</td>
<td width="99">Message size</td>
<td width="83">Initial</td>
<td width="181">Before MPI_Finalize (MB)</td>
<td width="145">Final</td>
<td width="247">Top function</td>
</tr>
<tr height="21">
<td height="21">MVAPICH</td>
<td>576 (57500)</td>
<td align="right">100</td>
<td align="right">0</td>
<td align="right">48.4</td>
<td align="right">0</td>
<td>allocate_vbuf_pool</td>
</tr>
<tr height="21">
<td height="21">MVAPICH</td>
<td>576 (57500)</td>
<td align="right">1000</td>
<td align="right">0</td>
<td align="right">534.1</td>
<td align="right">0</td>
<td>allocate_vbuf_pool</td>
</tr>
<tr height="21">
<td height="21">MVAPICH</td>
<td>576 (57500)</td>
<td align="right">10000</td>
<td align="right">0</td>
<td align="right">68</td>
<td align="right">0</td>
<td>MPIU_Handle_indirect_init</td>
</tr>
<tr height="21">
<td height="21">MVAPICH</td>
<td>576 (57500)</td>
<td align="right">100000</td>
<td align="right">0</td>
<td align="right">68.1</td>
<td align="right">0</td>
<td>MPIU_Handle_indirect_init</td></tr></tbody></table></div></div></div></div>
</div></div></div>