-
-
Notifications
You must be signed in to change notification settings - Fork 79
[v14 ready] Tutorial for ensuring performance for ODE simulations #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When implicit solvers use e.g. the Newton-Raphson method to, in each simulation time step, solve a (typically non-linear) equation, they actually solve a linearised version of this equation. For this they use a linear solver, the choice of which can impact performance. To specify one, we use the `linsolve` option (given to the solver function, *not* the `solve` command). E.g. to use the `KLUFactorization` linear solver we run | ||
```@example ode_simulation_performance_3 | ||
using DifferentialEquations | ||
solve(oprob, Rodas5P(linsolve = KLUFactorization())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the wrong solver for anything of this size and we should demonstrate this more correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should recommend using MKL
and trying UMFPACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean that Rodas5P is wrong for large problems (where we would do something like this) and should be changed, or that since preconditioners and stuff like this is not good for a 2-state brusselators we should demonstrate on a larger model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't find any examples for MKL, so was unsure on how to implement it here.
``` | ||
Next, `incompletelu` can be supplied to our solver using the `precs` argument: | ||
```@example ode_simulation_performance_3 | ||
solve(oprob, Rodas5P(precs = incompletelu)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't use the preconditioner
``` | ||
Finally, we note that since matrix-free linear solvers (like `KrylovJL_GMRES`) by default do not build a Jacobian. Hence, if we want to use them with a preconditioner we must tell them to build it. This can be done using the `concrete_jacobian=true` option: | ||
```@example ode_simulation_performance_3 | ||
solve(oprob, Rodas5P(linsolve = KrylovJL_GMRES(), precs = incompletelu, concrete_jac=true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to skip straight to here because the line above is just incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does preconditioners make sense for linear solvers except for KrylovJL_GMRES
then? Or should concrete_jac=true
be used for the previous case?
Why don’t we just use some of the examples from the Catalyst paper that show different performance characteristics to illustrate which solvers and configurations work best in different cases? Then we’ve already done the benchmarking and know what is fastest. |
Thanks for the input! I'm a little bit uncertain how to deal with the precondition part, but otherwise all good. |
Did you have any further input on the preconditioners @ChrisRackauckas? Also, what is the progress on moving default solvers to OrdinaryDiffEq? If that is coming soon then useful, but it would be useful to have a quick and dirt solver selection advice that did not depend on reading through all the doc, nor loading the full DifferenitalEquations suite. |
4d5ca83
to
3c5be5c
Compare
e3605da
to
298d61c
Compare
Co-authored-by: Christopher Rackauckas <[email protected]>
ae04812
to
603fd07
Compare
Creates a new doc page, providing some performance advice for ODE simulations. Stuff covered:
The GPU parallelization part is not ready, I have only started. However, I need to go through some stuff with Utkarsh before finishing that part.
Also, if someone have a link to a good reference book introducing this kind of stuff, that would be useful