<div dir="ltr">Thanks Matt and Barry. Clear.<div><br></div><div>Ed</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 11, 2020 at 2:05 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 style="overflow-wrap: break-word;"><br><div><br><blockquote type="cite"><div>On Sep 11, 2020, at 2:58 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div dir="ltr">On Fri, Sep 11, 2020 at 3:57 PM Ed Bueler <<a href="mailto:elbueler@alaska.edu" target="_blank">elbueler@alaska.edu</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">Dear PETSc --<div><br></div><div>I notice in the users manual that the C examples show</div><div><br></div><div>ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;</div><div><br></div><div>at the start of main() and </div><div><br></div><div>ierr = PetscFinalize();<br>return ierr;</div><div><br></div><div>at the end of main(). Is this the deliberate, recommended style?</div></div></blockquote><div><br></div><div>Yes.</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 dir="ltr"><div> My understanding of these choices is that if PetscInitialize() fails then CHKERRQ(ierr) may not do the right thing,</div></div></blockquote><div><br></div><div>Yes, failure early-on in Initialize() can predate setting up error handling.</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 dir="ltr"><div> while if PetscFinalize() fails then that should be the result of main() (without any fiddling by CHKERRQ etc.). Is this the correct understanding?</div></div></blockquote><div><br></div><div>Yes.</div></div></div></div></blockquote><div><br></div> If there is a failure in PetscFinalize() then PETSc will be in some unknown state where the CHKERRQ macros will no longer work so PETSc error handling should not be called.</div><div><br></div><div> Barry</div><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div><br></div><div> Thanks,</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 dir="ltr"><div>Thanks,</div><div><br>Ed</div><div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Ed Bueler<br>Dept of Mathematics and Statistics<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>306C Chapman<br></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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>
</div></blockquote></div><br></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>Ed Bueler<br>Dept of Mathematics and Statistics<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>306C Chapman<br></div></div></div></div></div></div></div>