impy-project / chromo

Hadronic Interaction Model interface in PYthon
Other
30 stars 7 forks source link

Epos RNG state is not reproduced correctly #176

Closed jncots closed 4 months ago

jncots commented 1 year ago

EposLHC produces different particles for the same seed from run to run. It is an issue for test_final_state and test_rng_state tests. The most probable reason is that EposLHC has several seeds/rngs/rng instances. See the last comments for #170.

jncots commented 4 months ago

The problem in the above 2 cases (for sure for test_rng_state) is that EposLHC needs some random number for initializations. In the code 2 functions are used: ranfgt to stash generator state and ranfst to restore it. It looks like when the code needs some random numbers for initialization the rng state is stashed and then restored after it. It allows to have the same sequence next time for simulation, when initialization is skipped.

In our current implementations ranfgt and ranfst are dummy, i.e. don't do anything. If we change them to what they should do, the problems will be probably solved.

P.S. The issue have been investigated in connection to the problem that on CI we have FAILED tests/test_generators.py::test_generator[EposLHC-p-p-cms] - assert 7.190839319548559e-07 >= 1e-06. However, it seems that the problem is not related to the RNG state reproducibility and more related to the underlying libraries/platforms or versions of numpy/python, because we use numpy's rng.

HDembinski commented 4 months ago

Thank you for working on this. We use Chromo to run EPOS Simulations and found that EPOS occasionally fails. Because of the error you mention here, one cannot simply avoid the seed which lets EPOS fail, since EPOS currently does not run in a reproducable way.