<div dir="ltr">Thanks a lot for this advice. Will do.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Dec 3, 2025 at 4:18 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</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><div><br></div> Unix/Linux has never had a good API for tracking process memory usage. <span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">PetscMemoryGetCurrentUsage() gets what it can from the OS, but the exact number should not be considered a true measure of process memory usage at that point in time. Jumps up and down are not accurate measures of changes in memory usage.</span><div><font color="#222832" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><span><br></span></font></div><div><font color="#222832" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><span> </span></font>PetscMallocGetCurrentUsage() and the number from MUMPS are (assuming no bugs in our code and MUMPS counting space) accurate values of memory usage. You should use these to see how memory usage is scaling with your problem size.</div><div><br></div><div> Barry</div><div><br><div><br><blockquote type="cite"><div>On Dec 3, 2025, at 4:00 PM, neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>Dear users and developers, </div><div><br></div><div>I am recently running a large system from Nedelec element, 14 million dofs (complex number). </div><div>A little confused about the memory there. Then I tried a small system (34,000 dofs) to see the memory usage. It was solved with MUMPS with 1 rank. </div><div>Then I used <span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">PetscMemoryGetCurrentUsage() to show the memory used there. </span></div><div>The pseudocode is </div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">PetscMemoryGetCurrentUsage (<b>Memory 1:</b> 64.237M)</span></div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">KSPset</span></div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">KSPsolve (</span>INFOG(18) (size of all MUMPS internal data allocated during factorization: value on the most memory consuming processor): <span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><b>Memory 2:</b></span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""> </span> 408 MB<span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">)</span></div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">PetscMemoryGetCurrentUsage </span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""></span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">(</span><b><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">Memory 3:</span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""> </span></b><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">54.307M)</span></div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><br></span></div><div>[0] Maximum memory PetscMalloc()ed 49.45MB maximum size of entire process 424MB <span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">(</span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><b>Memory 4:</b></span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""> </span><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">54.307M)</span><br></div><div><span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><font size="4">The following is my understanding, please correct me if I am wrong, </font></span></div><div>It seems the difference between Memory 1 and 3 is approximately the size of 30 Krylov vectors (complex).<span style="color:rgb(34,40,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""></span></div><div>It seems Memory 4 is not the summation of Memory 2 and 3; but on the same order of magnitude. It is a little confusing here. </div><div><br></div><div>Thanks,</div><div>Xiaodong </div><div><br></div><div><br></div></div>
</div></blockquote></div><br></div></div></blockquote></div>