-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add initial checkpoint and restore functionality. #178
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #178 +/- ##
==========================================
+ Coverage 96.28% 96.37% +0.08%
==========================================
Files 36 36
Lines 1722 1764 +42
==========================================
+ Hits 1658 1700 +42
Misses 64 64 ☔ View full report in Codecov by Sentry. |
The long term goal is to support mrc-ide/malariasimulation#196. There's obviously still a long way to go for this, especially since malariasimulation maintains quite a lot of state that isn't visible to |
This allows a user to run a simulation for a number of time steps and save the state of the simulation. The state can then be restored to continue the simulation. This is,for example, useful to compare the impact of an intervention based on different parameters. The simulation can be run up to the point of an intervention, when the parameters' value don't matter. The simulation can then be resumed multiple times but with different intervention parameters each time. For now, only variables are supported. Events will be added next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor suggestions, I love the way this is done.
I'm curious about whether users would want to restore_state
themselves, instead of simulation_loop doing it for them. That way users can do their own (re-)initialisations based on the restored variables. e.g. in malariasimulation, they may want to calculate an FOIM based on restored variables so that they can initialise their differential equation solver.
I'm sure those issues could be worked around by saving more state. My guess is that saving more state would be the most concise approach. But it's something to bear in mind.
Thanks so much!
Co-authored-by: Giovanni <[email protected]>
Co-authored-by: Giovanni <[email protected]>
Co-authored-by: Giovanni <[email protected]>
Thanks for the review, I've applied the suggestions. I think it would be much simpler to have malariasimulation save and restore its state buffers than re-creating them from the Variables (I'm not sure that would even be possible). It should be able to do that before/after calling Another option would be to add an argument to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, the former option seems like a good place to start. Looking forward to it!
This allows a user to run a simulation for a number of time steps and save the state of the simulation. The state can then be restored to continue the simulation.
This is,for example, useful to compare the impact of an intervention based on different parameters. The simulation can be run up to the point of an intervention, when the parameters' value don't matter. The simulation can then be resumed multiple times but with different intervention parameters each time.
For now, only variables are supported. Events will be added next.