Skip to content

multiprocessing#355

Open
rozyczko wants to merge 3 commits into
bayesianfrom
bayesian_mp
Open

multiprocessing#355
rozyczko wants to merge 3 commits into
bayesianfrom
bayesian_mp

Conversation

@rozyczko
Copy link
Copy Markdown
Member

This pull request introduces two main improvements: it adds support for parallel sampling in the fitting workflow via a new n_workers parameter, and it implements serialization for CalculatorFactory to enable correct state sharing across worker processes. Comprehensive tests are included for both features.

Parallel Sampling Enhancements

  • Added an n_workers parameter to the sample method in easyreflectometry.fitting, enabling parallel population evaluation during sampling and updating the docstring to describe its behavior. The parameter is forwarded to the core fitter and supports sequential (None/1) and parallel (n > 1) execution.

CalculatorFactory Serialization

  • Implemented __reduce__ and __state_restore__ methods in CalculatorFactory to support pickling and unpickling, preserving the active calculator state (including storage, resolution function, and magnetism) for use in worker processes.
  • Added a dedicated test in tests/calculators/test_factory.py to ensure that pickled and restored CalculatorFactory instances retain their model storage and produce identical results.

Dependency Update

  • Updated the easyscience dependency in pyproject.toml to use the bayesian_mp branch, which likely includes required multiprocessing support.

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] high Should be prioritized soon labels May 21, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (d112d8d) to head (738117a).

Files with missing lines Patch % Lines
src/easyreflectometry/calculators/factory.py 0.00% 14 Missing ⚠️
src/easyreflectometry/calculators/wrapper_base.py 0.00% 6 Missing ⚠️
src/easyreflectometry/fitting.py 0.00% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           bayesian    #355   +/-   ##
========================================
  Coverage      0.00%   0.00%           
========================================
  Files            42      42           
  Lines          2871    2896   +25     
========================================
- Misses         2871    2896   +25     
Flag Coverage Δ
integration 0.00% <0.00%> (ø)
unittests 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/easyreflectometry/calculators/wrapper_base.py 0.00% <0.00%> (ø)
src/easyreflectometry/fitting.py 0.00% <0.00%> (ø)
src/easyreflectometry/calculators/factory.py 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] high Should be prioritized soon [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant