<div dir="ltr"><div dir="ltr">Hi Barry, thank you for the thoughtful response, I've answered your questions below.</div><div><br></div>Best,<div>Alexander<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Wed, Sep 16, 2020 at 6:36 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;"><p style="text-align:center"><font color="red"><strong>External Email</strong><br></font></p><div><br></div>  Alexander,<div><br></div><div>   A few background questions.</div><div><br></div><div>     Do the small solves need to be done sequentially, that is is the input of one needed by the next or can many solves be done "at the same time".</div></div></blockquote><div>Sequentially </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 style="overflow-wrap: break-word;"><div><br></div><div>     Would you be using Newton's method with an analytic Jacobian?</div></div></blockquote><div>Yes </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 style="overflow-wrap: break-word;"><div><br></div><div>     For the larger problems 9 unknowns is there a consistent sparsity of the Jacobian (say 20 to 30 nonzeros) or are they essentially dense?</div></div></blockquote><div>Dense </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 style="overflow-wrap: break-word;"><div><br></div><div>     Are the problems of varying nonlinearity, that is will some converge with say a couple of Newton iterations while others require more, say 8 or more Newton steps?<br></div></div></blockquote><div>The nonlinearity should be pretty similar, the problem setup is the same at every node but the global domain needs to be traversed in a specific order.</div><div><br></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 style="overflow-wrap: break-word;"><div><div><br><blockquote type="cite"><div>On Sep 16, 2020, at 6:09 PM, Alexander B Prescott <<a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a>> wrote:</div><br><div><div dir="ltr">Hello PETSc listserv,<div><br></div><div>This is an inquiry about code structure and the appropriateness of using SNES for a specific problem. 

I've found PETSc powerful and quite useful for my other problems, but for this application I'm concerned about computational overhead. 

Our setup involves many thousands of independent calls to the nonlinear solver on small subproblems, i.e. 2<=d.o.f.<=9. Speed of execution is the primary concern. Now straight to my questions:</div><div><ul><li>does it even make sense to use PETSc for a problem like this? Would it be like using a nuclear reactor to warm a quesadilla?

</li></ul></div></div></div></blockquote><div><br></div>    There is a good deal of overhead for that small a problem size, but much of the overhead is in the initial construction of the PETSc objects, once they are created the extra overhead may be acceptable. There are plenty of tricks to bring down the extra overhead by avoiding the more expensive functions that are beneficial for larger problems but just add overhead for small problems, such as the calls to BLAS (and calls to more expensive linear solvers). The most extreme is to remove the use of the virtual functions and essentially inline everything, some of this might be automatable. <br><blockquote type="cite"><div><div dir="ltr"><div><ul><li>if it does make sense, is it better to create/destroy the SNES structures with each new subproblem, OR to create the structures once and modify them every time?</li></ul></div></div></div></blockquote><div>    You would definitely benefit from creating a SNES for each size 2 to 9 and reusing that one for all those of the same size.</div><div><br></div><div>     If you have hundreds of thousands that can be done simultaneously (but independently) then GPUs could perform extremely well.</div>    <br><blockquote type="cite"><div><div dir="ltr"><div><div>Best,</div><div>Alexander</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:arial,sans-serif">Alexander</span><span style="font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif">Prescott</span><br></div><div style="font-size:12.8px"><span style="font-family:arial,sans-serif"><a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px"><div style="font-family:arial,sans-serif"><span>PhD</span> <span>Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif">Department of Geosciences</div><div style="font-family:arial,sans-serif">1040 E. 4th Street</div><div style="font-family:arial,sans-serif">Tucson, AZ, 85721</div></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br></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 style="font-size:12.8px"><span style="font-family:arial,sans-serif">Alexander</span><span style="font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif">Prescott</span><br></div><div style="font-size:12.8px"><span style="font-family:arial,sans-serif"><a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px"><div style="font-family:arial,sans-serif"><span>PhD</span> <span>Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif">Department of Geosciences</div><div style="font-family:arial,sans-serif">1040 E. 4th Street</div><div style="font-family:arial,sans-serif">Tucson, AZ, 85721</div></div></div></div></div></div></div></div></div></div>