-
I am trying to execute a function with azimuthal integration inside via In order to try debugging it, I did the following steps:
Just in case, I attach the Jupyter notebook and two files with numpy arrays used. P.S. updated the zip-file because |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Well, resetting an azimuthal integrator (because the geometry is changed) in a parallel section is not a good idea at all. This does not explain why it breaks with mutliprocessing. With Python 3.14, the default behaviour of the module will change, from |
Beta Was this translation helpful? Give feedback.
-
This should cause no problems at all because the new instances of azimuthal integrator class are copied to the worker processes (I checked that). Moreover, I defined another function at the end of the notebook called The bug itself is totally version dependent. I did similar calculations with Regarding the strategy of calculation, which I want to deploy - I need to do the integration for the SAME image but on the big meshgrid of possible beam center positions and then process the results, finding the optimal position (via doing the pizza-slicing and minimizing the variance, assuming that the image is isotropic). It works fine with single core but I want to increase performance and speed it up. The calculation itself is done on the cluster (Maxwell cluster of DESY). Anyway, I need parallelization for other means, too. For example, I need to calculate pulse resolved I(q) for ~ 500.000 images in each run/scan. This issue will definitely hang up the calculation in this case as well. |
Beta Was this translation helpful? Give feedback.
-
I found an issue with your code: apparently, the serialization of the function Here is a snippet of code:
|
Beta Was this translation helpful? Give feedback.
I found an issue with your code: apparently, the serialization of the function
check_center_all_in(X, Y)
does not play nicely with jupyter notebook.The default serializer,
pickle
, is known to be safe but picky about user supplied functions.dill
is an alternative, much more powerful but be careful: with power comes responsibilities.I also replaced the
Pool
from multiprocessing with an alternative frommpire
. Other exist likejoblib
,dask
, ... I let you explore the one that best fits your needs. The WorkerPool allows to tune the start_method amongthreading
,fork
,forkserver
andspawn
. Threading works withpickle
, all other requiredill
.fork
crashes after a while but this a known side e…