Excessive RAM consumption when running multiple simulations (Solver Issue)
See original GitHub issueProblem description
When using the same solver object for multiple simulations, memory consumption increases every simulation. The issue is triggered by the solver object. (If this is desired behaviour, please close the issue.)
This minimal example triggers the Issue
import pybamm as pb
import gc
solver = pb.CasadiSolver(mode="safe")
para = pb.ParameterValues(chemistry=pb.parameter_sets.Chen2020)
model = pb.lithium_ion.SPM()
exp = pb.Experiment(["Discharge at 0.2C until 2.9V (1 minutes period)"])
for i in range(30):
print(i)
sim = pb.Simulation(model, experiment=exp, parameter_values=para, solver=solver)
sim.solve()
del sim
gc.collect()
This minimal example is a workaround for the Issue
import pybamm as pb
import gc
para = pb.ParameterValues(chemistry=pb.parameter_sets.Chen2020)
exp = pb.Experiment(["Discharge at 0.2C until 2.9V (1 minutes period)"])
model = pb.lithium_ion.SPM()
for i in range(30):
print(i)
solver = pb.CasadiSolver(mode="safe") # creating solver object every iteration
sim = pb.Simulation(model, experiment=exp, parameter_values=para, solver=solver)
sim.solve()
del sim, solver # deleting object every iteration frees the space
gc.collect()
Issue Analytics
- State:
- Created 2 years ago
- Comments:22
Top Results From Across the Web
Monte Carlo - RAM usage issue, run each point consecutively?
The issue is that the memory (RAM) seems to fill up. One simulation takes about ~150GB of RAM (which is OK, the system...
Read more >Massive amount of memory (RAM) required for solve
The total memory required by all processes = 40993 MB. The total physical memory that is available on the system = 15435 MB....
Read more >How to reduce memory usage and simulation time in Ansys ...
SIwave Region in HFSS 3Dlayout | Hybrid simulation to High Speed PCB simulation more than 10GHz. HFSS_for_RF_Application.
Read more >Troubleshoot High Elapsed Run Times - Creo Simulate
Similar models should have the same element and analysis types and use the same type of solver. If the ratios of elapsed time...
Read more >High RAM use with few degrees of freedom - COMSOL
I also have this problem. Previously I mainly did 2D simulation. When moving to 3D, the memory consumption increases beyond my estimation... For ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There are a couple more storage variables in the casadi solver
solver.integrators
andsolver.integrator_specs
, for me this worked a lot better, but there is still a slow increase in RAM usage .sure