<div dir="ltr"><div dir="ltr">On Thu, Dec 14, 2023 at 2:06 PM Fackler, Philip via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-8534799362439227644">




<div dir="ltr">
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">I'm using the following sequence of functions related to the Jacobian matrix:</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMDACreate1d(..., &da);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMSetFromOptions(da);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMSetUp(da);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMSetMatType(da, MATAIJKOKKOS);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMSetMatrixPreallocateSkip(da, PETSC_TRUE);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">Mat J;</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">DMCreateMatrix(da, &J);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">MatSetPreallocationCOO(J, ...);</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">I recently added the call to DMSetMatrixPreallocateSkip, hoping the allocation would be delayed to MatSetPreallocationCOO, and that it
 would require less memory. The <a href="https://petsc.org/release/manualpages/DM/DMSetMatrixPreallocateSkip/" title="https://petsc.org/release/manualpages/DM/DMSetMatrixPreallocateSkip/" id="m_-8534799362439227644LPlnk731661" target="_blank">
documentation</a> says that the data structures will not be preallocated. </span></div></div></div></blockquote><div><br></div><div>You are completely correct. DMDA is just ignoring this flag. We will fix it.</div><div><br></div><div>  Thanks for catching this.</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-8534799362439227644"><div dir="ltr"><div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">The following data from heaptrack shows that the allocation is still happening in the call to DMCreateMatrix.</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><img style="max-width: 998px;" size="54775" src="cid:ii_18c6a31b1d1cb971f161"></span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">Can someone help me understand this?</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">Thanks,</span></div>
<div style="font-family:Consolas,Courier,monospace;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-8534799362439227644Signature">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-size:11pt"><b>Philip Fackler<br>
</b></span></div>
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">Research Software Engineer, Application Engineering Group</span></div>
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">Advanced Computing Systems Research Section</span></div>
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">Computer Science and Mathematics Division<br>
</span></div>
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)"><b>Oak Ridge National Laboratory</b></span><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
</div>
</div>

</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>