Closed segasai closed 1 year ago
Dynesty version 2.0.0-2.1.1
Describe the bug The resuming of dynamic nested sampler when using a pool does not properly restore a pool.
This can be seen while running this script. (first to create one checkpoint file, and then restore from it). After restoring the pool is not used.
import numpy as np import multiprocessing as mp import dynesty import sys def func(x): ret = -(x**2).sum() for i in range(1000000): i**2 return ret def priort(x): return x * 20 - 10 def main(fname, nthreads=35, dynamic=True): ndim = 10 if nthreads == 1: pool = None else: pool = mp.Pool(36) CL = get_class(dynamic) dns = CL(func, priort, ndim, pool=pool, queue_size=100) dns.run_nested(checkpoint_file=fname) def get_class(dynamic): if dynamic: CL = dynesty.DynamicNestedSampler else: CL = dynesty.NestedSampler return CL def resume(fname, nthreads=35, dynamic=True): if nthreads == 1: pool = None else: pool = mp.Pool(36) print(pool, pool.map) CL = get_class(dynamic) dns = CL.restore(fname, pool=pool) dns.run_nested(resume=True) if __name__ == '__main__': dynamic = True fname = 'xx.pkl' if sys.argv[1] == '0': main(fname, dynamic=dynamic) else: resume(fname, dynamic=dynamic)
I'll submit the PR in a second. This issue is just for tracing/discovery purposes.
Dynesty version 2.0.0-2.1.1
Describe the bug The resuming of dynamic nested sampler when using a pool does not properly restore a pool.
This can be seen while running this script. (first to create one checkpoint file, and then restore from it). After restoring the pool is not used.
I'll submit the PR in a second. This issue is just for tracing/discovery purposes.