icecube / skyllh

https://icecube.github.io/skyllh/
GNU General Public License v3.0
11 stars 5 forks source link

Yield values when using multiple cores #222

Open juanma-cano-vila opened 3 months ago

juanma-cano-vila commented 3 months ago

I have noticed that for the weights in the analysis their computation and access is done through the SrcDetSigYieldWeightsService object.

This object has 2 different methods form computing the weights (.calculate() ) and for retrieving the values ( .get_weights() ). When working with multiple processors, the same SrcDetSigYieldWeightsService is called by all processors, so it might happen that the values from .get_weights() might be not the correct ones if another processor made a .calculate() before.

These would potentially give wrong results for analysis using more than one processor.

A potential fix would be to generate a copy of SrcDetSigYieldWeightsService for each processor used, similar to what is done with other objects such as FluxModels and ParamGridSet.

martwo commented 3 months ago

Because Python cannot really run things in parallel while using the same data, a copy will be made automatically when data is changed. So I'm quite certain that there is no bug. But feel free to prove me wrong ;)