gandalfcode / gandalf

GANDALF (Graphical Astrophysics code for N-body Dynamics And Lagrangian Fluids)
GNU General Public License v2.0
44 stars 12 forks source link

Meshless OpenMP fluxes/gravity bug #87

Closed dhubber closed 7 years ago

dhubber commented 7 years ago

Meshless FV code has a bug where self-gravitating simulations (e.g. the Boss Bodenheimer ICs) do NOT give the same results when compiled and run with OpenMP (gcc 5.4.0). The problem can be 'fixed' by commenting out the OpenMP statements in the UpdateGodunovFluxes routine, but of course this is not a solution. The possible cause/solution of summing floating-point variables in a different order (which can cause differences) is seemingly eliminated by using global timesteps which should compute and sum particle fluxes independent of the OpenMP thread. The absolute cause of the problem is not completely clear atm.

dhubber commented 7 years ago

Cause appears to be due to different partial sums (for each OpenMP thread) of the Godunov fluxes being added together in different ways when run in parallel. The errors (i.e. floating point differences) grow and lead to slightly different results. Not ideal having different results, but is not an actual error or bug so unless there is a simple solution to this, I will perhaps close this issue soon!