Replies: 1 comment 1 reply
-
Hi, if you want to break out of a simulation after a specific time period, BattBot uses the following snippet to break out of stuck simulations - while True:
manager = multiprocessing.Manager()
return_dict = manager.dict()
choice_list = [
"degradation comparison",
"model comparison",
"parameter comparison",
]
if choice is None:
choice = random.choice(choice_list)
p = Process(
target=random_plot_generator, args=(return_dict, choice, None, testing)
)
p.start()
# time-out
p.join(1200)
if p.is_alive(): # pragma: no cover
print(
"Simulation is taking too long, "
+ "KILLING IT and starting a NEW ONE."
)
p.kill()
p.join()
else: # pragma: no cover
break |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am running a few hundred simulations in a loop with a parameter sweep. As some of the parameter combinations are not feasible, the solver gets very slow at a time. Sometimes it even gets stucked, and doesn't solve or crash the simulation for a few hours, e.g.
`
At t = 0.460958 and h = 1.50237e-20, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.460958 and h = 1.01936e-14, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.460958 and h = 2.74873e-18, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.460958 and h = 4.07547e-16, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0822078 and h = 1.30316e-14, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0822074 and h = 2.22506e-22, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0822079 and h = 9.38556e-15, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0348644 and h = 5.10754e-28, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0111925 and h = 2.81322e-15, the corrector convergence failed repeatedly or with |h| = hmin.
At t = 0.0111924, repeated recoverable residual errors.
At t = 0.00527447, repeated recoverable residual errors.
'
Is there a way to for example monitor the execution time of a simulation.solve() function and then break it if it overruns some threshold? Or some other way to deal with such cases?
I'm using "safe" mode btw, and have already tried to play with dt_min and tolerances.
Beta Was this translation helpful? Give feedback.
All reactions