-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
EnsembleProblem solving time increases by one order of magnitude when modelingtoolkitizing #949
Comments
Here I include the profiling of the 4 cases: for_loop.html -> for_loop_ModelingToolkit.html -> It seems that the what is taking most of the time in EnsembleProblem_ModelingToolkit.html is a call to |
This is due to line 89 from SciMLBase/src/ensemble/basic_ensemble_solve.jl:
What is the reason behind |
It's needed if there are any caches that are modified. That can happen in people's mutating code, mutating a |
Great, thanks a lot!! :) I've just checked and setting @btime ensemble_solve($prob, $solver, $u0s, $ps, $t);
# 19.065 ms (145002 allocations: 15.34 MiB)
@btime ensemble_solve2($prob, $solver, $u0s, $ps, $t);
# 19.141 ms (147998 allocations: 16.22 MiB) However, oddly, their performances are a bit lower respect to not using MTK: @btime ensemble_solve($prob, $solver, $u0s, $ps, $t);
# 13.890 ms (153002 allocations: 13.69 MiB)
@btime ensemble_solve2($prob, $solver, $u0s, $ps, $t);
# 13.899 ms (155998 allocations: 14.57 MiB) I know its unrelated to the current issue (which is solved!) but do you have any idea why this could be happening? |
That could happen if MTK ends up with less SIMD. |
I was surprised to find that changing the parameters and initial conditions with a basic for-loop was resulting in much better performance than using
EnsembleProblem
. Eventually, I realized that it was due to the usage of ModelingToolkit for "optimizing" the ODEProblem, which was actually causing the opposite effect! Here is an MWE:The text was updated successfully, but these errors were encountered: