Currently requires something like:
with HDF5Storage(H5_FILE, "a"): # load up state on all cores
smc = AdaptiveSampler(kernel)
with HDF5Storage(HIERARCH_H5_FILE, "a") if comm.Get_rank() == 0 else nullcontext():
steps, mll = smc.sample(
N_PARTICLES, N_MCMC_SAMPLES, target_ess=0.9
)
Whereas we would prefer save_step to be rank0 only so that we can use context as normal:
with HDF5Storage(H5_FILE, "a"):
smc = AdaptiveSampler(kernel)
steps, mll = smc.sample(
N_PARTICLES, N_MCMC_SAMPLES, target_ess=0.9
)
Currently requires something like:
Whereas we would prefer
save_stepto berank0only so that we can use context as normal: