<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 1, 2016 at 12:52 PM, David Knezevic <span dir="ltr"><<a href="mailto:david.knezevic@akselos.com" target="_blank">david.knezevic@akselos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Based on KSP ex52, I use PCFactorSetUpMatSolverPackage in the process of setting various MUMPS ictnl options. This works fine for me when I'm solving linear problems.<div><br></div><div>I then wanted to use PCFactorSetUpMatSolverPackage with the PC from a SNES object. I tried to do this with the following code (after calling SNESCreate, SNESSetFunction, and SNESSetJacobian):</div><div><br></div><div><div>KSP snes_ksp;</div><div>SNESGetKSP(snes, &snes_ksp);</div><div>PC snes_pc;</div><div>KSPGetPC(snes_ksp, &snes_pc);</div></div><div>PCFactorSetMatSolverPackage(snes_pc, MATSOLVERMUMPS);<br></div><div>PCFactorSetUpMatSolverPackage(snes_pc);<br></div><div><br></div><div>However, I get a segfault on the call to PCFactorSetUpMatSolverPackage in this case. I was wondering what I need to do to make this work?</div><div><br></div><div>Note that I want to set the MUMPS ictnl parameters via code rather than via the commandline since sometimes MUMPS fails (e.g. with error -9 due to a workspace size that is too small) and I need to automatically re-run the solve with different ictnl values when this happens.</div></div></blockquote><div><br></div><div>That is a good reason. However, I would organize this differently. I would still set the type from the command line.</div><div>Then later in your code, after SNES is setup correctly, you get out the PC and reset the icntl values if you have a</div><div>failure. Its very difficult to get the setup logic correct, and its one of the most error prone parts of PETSc. RIght now,</div><div>the most reliable way to do things is to have all the information available up front in options.</div><div><br></div><div>Someday, I want to write a small DFA piece in PETSc that can encode all this logic so that simple errors people</div><div>make can be diagnosed early with nice error messages.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks,<br>David</div><div><br></div><div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>