Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up nonsparse AD initial setup significantly
We have been setting `ADReal::do_derivatives=true` by default and only toggling to `false` during residual computation. This can be very bad for non-sparse calculations. For instance in a navier-stokes input file supplied by Gavin Ridley, I saw 10 seconds spent in initial condition computation and 9 seconds in `ComputeMaterialsObjectThread` for a total of 19 seconds in `FEProblemBase::initialSetup`. This was 27% of the total computation time! With the changes here `FEProblemBase::initialSetup` no longer even appears in the graph, which is how it should be. I recall that I was forced to do derivative calculations by default for the reasons stated in the comment I'm deleting. My memory says some phase field object was initializing its material properties in its constructor, or more likely during `initialSetup`, so we had to enable derivative calculations then or else its results would be garbage. Hopefully, however, if there are objects still doing things like that we can do a little more fine-grained control to make their objects work without significantly sabotaging everyone's performance. Refs #14701
- Loading branch information