<div dir="ltr"><div dir="ltr">On Fri, Jun 14, 2019 at 11:40 AM Dongyu Liu - CITG 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 dir="ltr">
<div id="gmail-m_8357849105491682367divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I am using PETSc to run FEM on domain decomposition. When I assemble the matrix, I need to pre-allocate first to get better performance, can you recommend how to preallocate in this case?</p>
<p><br>
</p>
<p>Right now we set big values for the number of nonzeros to preallocate memory, but when we do so, the program stuck at setZeroRowColumns. The error message is like:
<span><br>
</span></p>
<p><span>Matrix is missing diagonal entry in row 2.</span></p></div></div></blockquote><div>1) Most preconditioners require a diagonal element, even if it is 0. Thus it might be good to add diagonal elements, even if they are 0.</div><div><br></div><div>2) The best way to preallocate in general is to run your assembly twice. Once to discover all the nonzero locations, and a second time to</div><div> put in the values. Note that in the first pass, you do not have to compute the entries, only the indices. We have a matrix class which helps</div><div> with this process: <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPreallocatorPreallocate.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPreallocatorPreallocate.html</a></div><div><br></div><div> Thanks,</div><div><br></div><div> Matt </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_8357849105491682367divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><span>Do you have any idea why this happens?</span></p>
<p><span>Note: In the domain decomposition we used, processors share some nodes.</span></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Dongyu</span><br>
</p>
<p><br>
</p>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <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>