joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
357 stars 77 forks source link

added save_bounds option to dynamic sampler #105

Closed bacook17 closed 6 years ago

bacook17 commented 6 years ago

Dynamic sampler doesn't allow "save_bounds" option to be passed during initial batch. When combined with "update_interval" of 1, this can result in huge memory usage from saving each bounding object, which is then copied upon each call to "sampler.results"

bacook17 commented 6 years ago

Also added option for "maxcall_per_iter": stop any sampling if more than some number of calls are required for a given iteration

bacook17 commented 6 years ago

dynesty_memory

The figure above shows the memory usage of two dynamic runs before the "save_bounds" option is propagated through the initial batch (using MultiEllipse bounds, and update_interval of 1, so each step it saves a bound object). The huge spike in the black line is when the first dynamic batch is launched in that run, and the entire array of bounds is copied twice by calls to "sampler.results".

With the save_bounds option propagated through, the four other lines show the new memory usage when "save_bounds" set to False.

bacook17 commented 6 years ago

Not saving bounds caused new batch creation to (silently) fail.