-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Refactoring implementations of solver types to use tableau-based forms #233
Comments
Instead of matrices we should just use static arrays a la #114 But the issue here is that you can do the simple case, but I am not sure this can actually be so simple in the full case. For example, we want to use broadcasting to keep compatibility with GPUs when possible (http://www.stochasticlifestyle.com/solving-systems-stochastic-pdes-using-gpus-julia/), but then after a certain line size broadcasting isn't possible (#106). We will want those lines to fuse as well instead of a loop because that would require less GPU kernel calls (or whatever other form of parallelism by the array type). Another issue is, how do you deal with the fact that some of the methods have to use non-standard error estimators? The codes that do fall under the same category are actually quite small. I think the largest category this can hit (without multiple macros of course) is the explicit Runge-Kutta methods. The nicest thing to hit would be the SDIRK methods, but each of them have different stage predictors (along with things like KenCarp getting additive parts) so while there is repetitive code there is unique parts in most of them. If you can find a good and easy to maintain way to implement this I will accept it, but those are the constraints and it's not an easy problem to satisfy those except maybe in the explicit RK and symplectic RK cases. |
src/integrators
There was a big push during a Hackathon to investigate this a bit more, see:
It was determined that metaprogramming isn't needed, but smart implementations of RK methods could do it fine. In particular, the hardest algorithms to get correct with this are the standard explicit Runge-Kutta algorithms because they can do certain optimizations when unrolled. This kind of goes hand-in-hand with #2177. Maybe we can keep the more optimized versions of the explicit RK methods around but as a subpackage or something. However, at least the implicit methods should not see any benefit from any form of unrolling since the cost is dominated by the implicit solves. In that case, we should be looking to refactor Rosenbrock, SDIRK, etc. first. |
@ChrisRackauckas , @YingboMa May I work on this issue ?? |
or is it done ?? |
It has not been done. If you want to claim it, go for it. Send the email for the SciML Small Grants claim and let's get this started. I think Rosenbrock is the first set to do. Unify Rosenbrock4Cache and Rosenbrock5Cache first, the Rodas4, Rodas5, Rodas4P, Rodas5P, Rodas5Pr, etc. set should be the most similar, then grow that to all of the Rosenbrocks. Rosenbrock23 will be the odd one I think, it's fine to do a first merge with that separate. |
Sounds good. I'll do the needful and get started with this |
I have a PR coming soon that will make Rosenbrock32 less special as well (but it will take a little bit) |
@ChrisRackauckas My contribution period under the small grants program is over but I want to continue to work on this issue and solve this for other solvers after we get this done with rosenbrock. If you allow, may I get an extension for this, please ?? |
Currently, the code in
src/integrators
is very repetitive and I think it can be cleaned up by some metaprogramming techniques. One concern that @ChrisRackauckas has about metaprogramming in the integrators is that it cannot handle zeros in tableaux automatically because the tableaux are not visible at parse time as they are in a struct. I think we can avoid this problem by just using matrices to store the tableaux, so the compiler can perform constant folding. Also, we can implement fast tableau methods from this. Here is an example.The above code can generate the expression
The text was updated successfully, but these errors were encountered: