<div dir="ltr"><div dir="ltr">On Tue, Jul 28, 2020 at 11:33 PM Bin Liu <<a href="mailto:lbllm2018@hotmail.com">lbllm2018@hotmail.com</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 style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dear Barry,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks for your suggestions. I just tested it. I still get the same error. I attached it below:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
[1]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
<div>[1]PETSC ERROR: Object is in wrong state</div>
<div>[1]PETSC ERROR: Matrix is missing diagonal entry in the zeroed row 24214</div>
<div>[1]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div>
<div>[1]PETSC ERROR: Petsc Release Version 3.9.1, Apr, 29, 2018 </div>
<div>[1]PETSC ERROR: ./re100 on a  named kdp-MS-7850 by kdp Wed Jul 29 11:26:57 2020</div>
<div>[1]PETSC ERROR: Configure options --prefix=/home/kdp/petsc --debugging=0 --with-mpi-dir=/home/kdp/mpich --download-fblaslapack --download-metis --download-parmetis --download-hypre=/home/kdp/hypre-2.14.0.tar.gz --download-superlu_dist</div>
<div>[1]PETSC ERROR: #1 MatZeroRows_SeqAIJ() line 1819 in /home/kdp/petsc-3.9.1/src/mat/impls/aij/seq/aij.c</div>
<div>[1]PETSC ERROR: #2 MatZeroRows() line 5710 in /home/kdp/petsc-3.9.1/src/mat/interface/matrix.c</div>
<div>[1]PETSC ERROR: #3 MatZeroRows_MPIAIJ() line 797 in /home/kdp/petsc-3.9.1/src/mat/impls/aij/mpi/mpiaij.c</div>
<div>[1]PETSC ERROR: #4 MatZeroRows() line 5710 in /home/kdp/petsc-3.9.1/src/mat/interface/matrix.c</div>
<br>
It still report missing diagonal entry. However I have epxlicitly assign 0.0 to the diagonal element of the system matrix and solve it in sequential mode without error. Where could possibly my wrong set up be? </div></div></blockquote><div><br></div><div>1) Please send the complete error message. The stack trace here is cut off.</div><div><br></div><div>2) It does not look like it is failing in the solver, but in the call to MatZeroRows(), which as it says, requires diagonal elements</div><div><br></div><div>3) It looks like you are not assembling the matrix correctly in parallel</div><div><br></div><div>I recommend making as small a problem as possible, running on 1 and 2 processes, and printing out the matrix using -mat_view to compare them entry-by-entry.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><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 dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Best<br>
</div>
<div>
<div id="gmail-m_-8610359906417740984appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-8610359906417740984divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Sent:</b> Wednesday, July 29, 2020 10:49 AM<br>
<b>To:</b> Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank">lbllm2018@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] solving saddle point problem in distributed memory</font>
<div> </div>
</div>
<div style="word-wrap:break-word">
<div><br>
</div>
   No, PETSc direct solvers do not work in parallel. Only SuperLU_DIST, MUMPS, and PasTix. 
<div><br>
</div>
<div>    -pc_type lu (or cholesky depending on the package) -pc_factor_mat_solver_type superlu_dist or mumps or pastix  </div>
<div><br>
</div>
<div>   to run the direct solver in parallel. </div>
<div><br>
</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On Jul 28, 2020, at 9:01 PM, Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank">lbllm2018@hotmail.com</a>> wrote:</div>
<br>
<div>

<div lang="EN-SG">
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Dear Barry,</span></p>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks for your explanation. Does it mean the default director solver LU in PETSc can also run in the distributed memory mode? I only used iterative solvers with preconditioners
 in distributed memory before.  My experience in using director solver in parallel is indeed limited, especially the saddle point problem in parallel. I have done some search online, but I did not find a working set up at this moment. Could you give a sample
 setup of the direct solver for parallel run? It is really appreciated. </span></p>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<a name="m_-8610359906417740984_x__MailEndCompose"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></a></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<b><span style="font-size:11pt;font-family:Calibri,sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif" lang="EN-US"> Barry Smith [<a href="mailto:bsmith@petsc.dev" target="_blank">mailto:bsmith@petsc.dev</a>]
<br>
<b>Sent:</b> Wednesday, 29 July 2020 9:48 AM<br>
<b>To:</b> Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank">lbllm2018@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] solving saddle point problem in distributed memory</span></p>
</div>
</div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
   SuperLU_DIST won't "magically" run on saddle point problems. It only does limited pivoting, realistically a parallel LU cannot always do complete pivoting or it becomes a sequential algorithm. For parallel you need to use PCFIELDSPLIT, for sequential you
 can use SuperLU (not SuperLU_DIST) since it can do more pivoting, being a sequential algorithm.</p>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
  Barry</p>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<br>
<br>
</p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
On Jul 28, 2020, at 7:59 PM, Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank">lbllm2018@hotmail.com</a>> wrote:</p>
</div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks for your tutorials. Yes. I tried PCFIELDSPLIT. However, it only works for sequential runs. When I run the code in distributed memory, it reports errors. In fact,
 the essence of my wonder is (a) how to set up superlu_dist in petsc for solving saddle point problem in distributed memory? (b) does the direct solvers in petsc can run in distributed memory for solving saddle point problem?</span></p>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
</div>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<b><span style="font-size:11pt;font-family:Calibri,sans-serif" lang="EN-US">From:</span></b><span><span style="font-size:11pt;font-family:Calibri,sans-serif" lang="EN-US"> </span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" lang="EN-US">Stefano
 Zampini [<a href="mailto:stefano.zampini@gmail.com" target="_blank"><span style="color:purple">mailto:stefano.zampini@gmail.com</span></a>]<span> </span><br>
<b>Sent:</b><span> </span>Tuesday, 28 July 2020 6:55 PM<br>
<b>To:</b><span> </span>Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank"><span style="color:purple">lbllm2018@hotmail.com</span></a>><br>
<b>Cc:</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="color:purple">petsc-users@mcs.anl.gov</span></a><br>
<b>Subject:</b><span> </span>Re: [petsc-users] solving saddle point problem in distributed memory</span></p>
</div>
</div>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
If you want advice you should post the error trace PETSc reports.</p>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
Anyway, solving Stokes is not so trivial (without direct solvers, you may need mesh dependent information), but we have examples for it</p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<a href="https://gitlab.com/petsc/petsc/-/blob/master/src/ksp/ksp/tutorials/ex42.c" target="_blank"><span style="color:purple">https://gitlab.com/petsc/petsc/-/blob/master/src/ksp/ksp/tutorials/ex42.c</span></a></p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<a href="https://gitlab.com/petsc/petsc/-/blob/master/src/ksp/ksp/tutorials/ex43.c" target="_blank"><span style="color:purple">https://gitlab.com/petsc/petsc/-/blob/master/src/ksp/ksp/tutorials/ex43.c</span></a></p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<a href="https://gitlab.com/petsc/petsc/-/blob/master/src/snes/tutorials/ex69.c" target="_blank"><span style="color:purple">https://gitlab.com/petsc/petsc/-/blob/master/src/snes/tutorials/ex69.c</span></a></p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
If you scroll to the end of those files, you see a bunch of possible options either using PCFIELDSPLIT,  PCBDDC or KSPFETIDP.</p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<br>
<br>
<br>
</p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
On Jul 28, 2020, at 12:37 PM, Bin Liu <<a href="mailto:lbllm2018@hotmail.com" target="_blank"><span style="color:purple">lbllm2018@hotmail.com</span></a>> wrote:</p>
</div>
</div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-family:Calibri,sans-serif">I would like to solve a saddle point problem arising from the stokes equation. I got successful to use the direct solvers in sequential runs. However, I would like to extend it for distributed memory computation.
 I tried to use superlu_dist, but the program returns errors. Is it possible to solve a saddle point problem in distributed memory using superlu_dist? Could anyone give a simple sample code to set up the parameters of the solver?</span></p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-family:Calibri,sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-family:Calibri,sans-serif">Thanks</span></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif">
 </p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</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>