Repository navigation
fix(nautilus): serial bound training + no per-task Fitness pickling (#1547) - #1548
Merged
Merged
Conversation
…not hang the fit nautilus was given the fork pool as `pool=pool`, so it used it for both likelihood calls and sampler calculations (neural bound training via `pool.map`). A worker that dies — e.g. a per-job OOM kill on a cluster — is replaced by multiprocessing.Pool but its task is never re-issued, so `map` blocks forever. Pass `pool=(pool, None)`: likelihoods stay parallel, bound training (4 small MLPs) runs in the parent. Closes #1547 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6Bmv35TPD1rGQ4bzrbZ15
This was referenced Aug 29, 2026
…ed per task With a Pool object, nautilus maps the bound Fitness.call_wrap directly, so multiprocessing pickles the whole analysis (dataset, PSF, sparse operator, adapt images) into every task chunk and each worker unpickles it per likelihood call: worker memory grows a few MB per call (8-core RAL runs hit 96 GB) and the parent starves the pool serialising it. Build the fork pool with nautilus's initialize_worker and hand nautilus a wrapper whose map dispatches likelihood_worker, as the int-pool path did before #1439. Refs #1547 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6Bmv35TPD1rGQ4bzrbZ15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nautilus bound training now runs serially in the parent (
pool=(pool, None)); likelihood evaluation stays on the fork pool. Prevents the permanentPool.maphang when a worker dies mid-fit (observed on RAL 2026-08-29, three 8-core runs idle for hours; py-spy: main innautilus/neural.py:96 train → pool.map, workers idle,_repopulate_poolreplacement worker).Second fix: per-task pickling of the Fitness
Since #1439 (e6279c5) replaced
pool=<int>with aPoolobject for the Py3.14 fork pin, nautilus no longer installs itsinitialize_worker/likelihood_workerpair and instead maps the boundFitness.call_wrapdirectly (sampler.py→pool_l.map(self.likelihood, args)), somultiprocessingpickles the whole analysis — dataset, PSF convolver, sparse operator, adapt images — into every task chunk and each worker unpickles a fresh copy for every likelihood call. Symptoms: worker RSS grows a few MB per call until 8-core RAL jobs hit the 96 GB cgroup limit, and the parent starves the pool serialising it (only ~2.5 of 8 cores busy). The fork pool is now built with nautilus's owninitialize_worker(fitness.call_wrap)— inherited by fork, never pickled — and handed over as_LikelihoodWorkerPool, whosemapignores the mapped function and dispatcheslikelihood_worker, exactly as the int-pool path did before #1439.API Changes
None (internal pool plumbing;
number_of_cores<=1path unchanged).Tests
test__multi_core_passes_serial_sampler_pool— asserts(pool, None)reaches nautilus.test__single_core_builds_no_pool— unchanged, still passes.test__likelihood_pool_does_not_pickle_fitness— maps a likelihood whose__getstate__raises through_LikelihoodWorkerPoolon a real forkPool(2)and asserts the results come back, proving the mapped function is ignored and nothing is pickled per task.Closes #1547
🤖 Generated with Claude Code
https://claude.ai/code/session_01M6Bmv35TPD1rGQ4bzrbZ15