Skip to content

Sbs parallelism - #27

Merged
InfinityMonkeyAtWork merged 2 commits into
mainfrom
sbs-parallelism
Apr 26, 2026
Merged

Sbs parallelism#27
InfinityMonkeyAtWork merged 2 commits into
mainfrom
sbs-parallelism

Conversation

@InfinityMonkeyAtWork

Copy link
Copy Markdown
Owner

defaults to using number of cores -1 for slice-by-slice fitting

File.fit_slice_by_slice() gains an n_workers kwarg that dispatches
per-slice fits across a ProcessPoolExecutor. Default cpu_count() - 1,
capped at the number of slices. n_workers=1 keeps the original serial
loop as a debug escape hatch.

- Uses spawn (only portable option; Windows lacks fork)
- Workers reuse one pickled model installed at startup so per-slice
  pickle cost is bounded
- Worker init forces matplotlib Agg so per-slice plots don't try to
  open a display
- tqdm progress bar over as_completed() so the bar advances as slices
  finish; results reassembled into slice order via a dict
- Fail-fast on worker exception (cancel pending futures, re-raise)
- Final main-process model.const/args mirror the serial path's
  trailing state so save_sbs_fit reads consistent values either way

Tests parameterize the existing GIR/MCP compare test over n_workers
∈ {1, 2} and add a parity test asserting fitted params match between
serial and parallel paths within rtol=1e-10.
@InfinityMonkeyAtWork
InfinityMonkeyAtWork merged commit 796520a into main Apr 26, 2026
3 checks passed
@InfinityMonkeyAtWork
InfinityMonkeyAtWork deleted the sbs-parallelism branch April 29, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant