Skip to content
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

Write checkpoint history #3347

Merged
merged 9 commits into from
Jul 10, 2020
Merged

Write checkpoint history #3347

merged 9 commits into from
Jul 10, 2020

Conversation

cdcapano
Copy link
Contributor

@cdcapano cdcapano commented Jul 1, 2020

This makes it so that some history is preserved in the inference checkpoint file on each checkpoint. Right now, only the MCMC samplers make use of this, but nested samplers could pick up the functionality later. This can be used for comparing performance between samplers, and to diagnose issues (like growing ACTs).

On each checkpoint, update_checkpoint_history is called. This is a method of BaseSamplerFile. It writes the current time and the time since the last checkpoint or last startup (which ever happened last). It then calls _update_sampler_history. This doesn't do anything in BaseSamplerFile, but can be overridden to write-sampler specific things. This is overriden by CommonMCMCMetadataIO to write the number of iterations, effective number of samples, burn-in iteration, and autocorrelation time. In the future, nested samplers could do something similar (e.g., writing the current dlogz). All information is written to samlper_info/checkpoint_history/.

To make this work, the ability to append data has been added to BaseInferenceFile.write_data. I also had to add the time that pycbc inference starts up, so that the time since the last checkpoint could be accurately computed. This is stored as run_start_time in the file's attrs. For completeness, I also added a run_end_time, which is written by pycbc_inference just before exiting.

I tested using the single template example in the docs, on emcee pt and epsie.

In another PR, I'll add an executable to plot the checkpoint history.

@cdcapano cdcapano requested review from ahnitz and removed request for dfinstad July 10, 2020 09:15
@cdcapano cdcapano assigned ahnitz and unassigned dfinstad Jul 10, 2020
@cdcapano
Copy link
Contributor Author

@ahnitz Can you take a look?

@ahnitz ahnitz merged commit 121ebbb into gwastro:master Jul 10, 2020
@cdcapano cdcapano deleted the checkpoint_acts branch July 10, 2020 12:58
lenona pushed a commit to lenona/pycbc that referenced this pull request Sep 14, 2020
* add ability to append data in base_hdf write_data

* add write start time method to base sampler io

* add update_checkpoint_history function to base sampler file

* add update sampler history to base mcmc file

* write run start time when starting up run

* call update checkpoint history in base mcmc's checkpoint

* fix various bugs

* add run end time attribute

* handle no act or burn in having been calculated
OliverEdy pushed a commit to OliverEdy/pycbc that referenced this pull request Apr 3, 2023
* add ability to append data in base_hdf write_data

* add write start time method to base sampler io

* add update_checkpoint_history function to base sampler file

* add update sampler history to base mcmc file

* write run start time when starting up run

* call update checkpoint history in base mcmc's checkpoint

* fix various bugs

* add run end time attribute

* handle no act or burn in having been calculated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants