atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

Fix compilation with OPENMP=1 #607

Closed lfarv closed 1 year ago

lfarv commented 1 year ago

Fixes a bug reported in #592. The fix for compiling with OpenMP was easy, but it revealed a problem with random generators.

This PR solves the problem of compilation failure with OPENMP=1, but OpenMP is disabled in the BndMPoleSymplectic4QuantPass, StrMPoleSymplectic4QuantPass and QuantDiffPass passmethods until the random generation of quantum emission is validated with OpenMP.

I keep the issue #592 open because it documents the remaining problem. A dummy passmethod called TestRandomPass is temporarily added to the repository: it checks the random generators with and without OpenMP. The direct output of Gaussian distribution looks correct.

swhite2401 commented 1 year ago

Ok for for me, any idea on the problem with the RNG?

lfarv commented 1 year ago

Ok for for me, any idea on the problem with the RNG?

It looks very strange. The results of TestRandomPass show the mean and std values of the generated numbers are correct and identical with and without OpenMP. The common and thread-specific behaviours are also correct.

A next step will be to check if the problem lies in getting the number of emitted photons, or in computing their energy…