-
-
Notifications
You must be signed in to change notification settings - Fork 600
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
Performance: Solver speed up + Parallel processing support #4881
Comments
hi @leehangyue. re 1., can you please post your code for the test case and I can investigate the slowdown you are experiencing in 25.1.1. For 2. you can pass in a list of input parameters to the solver and set the |
Thanks for your reply! I'll try your recommendation for 2. The code for the test case in 1 is in the Additional Context section, and I copied it below:
|
Your issue is that you are using way too many points in your interpolant, if you want to model a discontinuous step change in t_in = np.array([0, 300, 300.01, 600, 600.01, 900]) The solver needs to stop at each data point in the interpolant, so you want to make sure you have as few as possible |
Description
{
parameter_values_list +
initial_condition_list (i.e. initial_soc_list) +
operating_condition_list (experiment_list / current_function_list / other means of operating conditions)
}
I'm expecting a fast solver like the IDAKLUSolver in pybamm==24.1, in the newer versions,
and I'm curious to know why the IDAKLUSolver in pybamm==25.1.1 is slower than pybamm==24.1
In my case, I'm simulating a lithium-ion battery with pybamm.lithium_ion.DFN, while setting options.dimensionality = 2 and options.thermal = x-lumped (resolving y and z spatial coordinates). During this, I noticed that the IDAKLUSolver in pybamm==25.1.1 is slower than in pybamm==24.1
With identical parameter values and operating conditions, I created simulation and solved with IDAKLUSolver and CasadiSolver (fast mode) for pybamm versions 24.1 and 25.1.1, respectively (2x2=4 cases in total).
The results are in the table below:
For the test code and outputs, see additional context for details.
The tests were run in virtual environments.
Motivation
I'm trying to solve multiple cases for parameter identification. Solver speed is critical to the overall time consumption.
With faster / built-in parallel processing, the community could benefit from faster parameterization, etc.
Possible Implementation
For faster solver:
Figure out why IDAKLUSolver in pybamm==24.1 is faster than pybamm==25.1.1 in the tested case,
Revert / merge part of the code to pybamm==24.1, or implement a new and fast solution, if possible
I've done a few tests for solver speed, see additional context for details.
For parallel processing,
Create an interface that accepts a case_list (collections of parameter_values, initial conditions, and operating conditions), convert the cases to native variables like parameter_values, and simulate them in parallel.
The interface returns a solution_list corresponding to the case_list.
If the geometries / discretization differes among the cases, discretize and initialize in each process / Actor.
Otherwise, discretize and initialize once, then change only the inputs for different cases.
Additional context
The test case implementation:
The outputs of the test case:
with pybamm==24.1
with pybamm=25.1.1
The text was updated successfully, but these errors were encountered: