Skip to content

Conversation

@pkienzle
Copy link
Contributor

@pkienzle pkienzle commented Mar 7, 2025

Bumps parallel fitting uses dill to pickle models and send them to another process.

Not sure if this is a recent change in dill, but it no longer pickles lambda expressions and locally defined functions.

Work around this by creating callable objects with the relevant variables rather than returning an unpickleable closure.

Tested as follows:

  • use bumps in the sasmodels/example directory as follows: bumps model_ellipsoid_hayter_msa.py 093191_201.dat --fit=dream --store=/tmp/T1
  • ran sascomp with randomization: python -m sasmodels.compare sphere@hardsphere -sets=10
  • ran sasview and set up a model with sphere@hardsphere and the above data file, clicking calculate to make sure the results were populated with P(Q) and S(Q), and with β when the β approximation was requested.

Copy link
Collaborator

@krzywon krzywon left a comment

Choose a reason for hiding this comment

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

I haven't tested the functionality, but the code looks reasonable.

@krzywon
Copy link
Collaborator

krzywon commented Apr 22, 2025

Functionality tested. This works with beta release of bumps, but I get the matplotlib error outlined in SasView/sasview#3227 while testing with bumps v0.9.3.

Two options moving forward:

  1. Use the beta version of bumps until the final version is released (I would suggest this)
  2. Pin bumps to 0.9.3 and matplotlib to a version where the dream convergence plots can be generated

@jamescrake-merani
Copy link
Contributor

I'm going to hold off merging this until the release branch for SasModels 1.0.10 branch is created (which I will do on Wednesday, the day of the code freeze) since it will break compatibility with older versions of bumps. With bumps being pinned on the release branch, this shouldn't be an issue there.

@krzywon krzywon changed the base branch from master to sasmodels_1.0.10 May 6, 2025 13:47
@krzywon krzywon merged commit 1acb8fc into sasmodels_1.0.10 May 6, 2025
18 checks passed
@krzywon krzywon deleted the fix-bumps-product-pickle branch May 6, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants