<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  Alexander,<div class=""><br class=""></div><div class="">   A few background questions.</div><div class=""><br class=""></div><div class="">     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 class=""><br class=""></div><div class="">     Would you be using Newton's method with an analytic Jacobian?</div><div class=""><br class=""></div><div class="">     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 class=""><br class=""></div><div class="">     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 class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 16, 2020, at 6:09 PM, Alexander B Prescott <<a href="mailto:alexprescott@email.arizona.edu" class="">alexprescott@email.arizona.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello PETSc listserv,<div class=""><br class=""></div><div class="">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 class=""><ul class=""><li class="">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 class=""></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 class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><ul class=""><li class="">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 class=""></div><div>     If you have hundreds of thousands that can be done simultaneously (but independently) then GPUs could perform extremely well.</div>    <br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">Best,</div><div class="">Alexander</div><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div style="font-size:12.8px" class=""><span style="font-family:arial,sans-serif" class="">Alexander</span><span style="font-family:arial,sans-serif" class=""> </span><span style="font-family:arial,sans-serif" class="">Prescott</span><br class=""></div><div style="font-size:12.8px" class=""><span style="font-family:arial,sans-serif" class=""><a href="mailto:alexprescott@email.arizona.edu" target="_blank" class="">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px" class=""><div style="font-family:arial,sans-serif" class=""><span class="">PhD</span> <span class="">Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif" class="">Department of Geosciences</div><div style="font-family:arial,sans-serif" class="">1040 E. 4th Street</div><div style="font-family:arial,sans-serif" class="">Tucson, AZ, 85721</div></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>