You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Grid like many codes uses the standard libraries implementation of the normal_distribution. This takes a uniform random number generator as a input and calls it twice to generate normally distributed random numbers using the polar method. This generates two normally distributed random numbers, one is returned in the current call to the normal distribution and the other is cached for the next call.
This causes an issue as the order in which the two normally distributed random number are returned and cached is not defined by the C++ standard. The implementations by llvm and gcc take different choice in the ordering of the returned and cached random numbers.
In essence this is not a bug as both compilers generate valid normally distributed random numbers but it makes the results dependent on the implementation of the standard as the sequence will have a different ordering. This can be problematic when comparing results between systems and hardware (CPU and GPU) as the implementation of the standard can change.
The text was updated successfully, but these errors were encountered:
the system is self reproducible (by language standard) if you use the same libstdc++.
the benefits of using the C++11 standardised random interfaces greatly exceeds the inconvenience of Clang and GCC using different (legal) orderings with respect to each other.
We just have to keep in mind that GCC and Clang will behaved differently. They actual Gaussian implementation algorithm is not standardised, just that it must be gaussian and self reproduce.
(Bitwise) self reproduction on the SAME machine & compiler is Grids goal - for use as a hardware test. Rounding and other things will differ in any case between different numbers of MPI ranks and between compilers (or even compiler flags) and other machines.
This is a (far) faster loss of correlation than I like, so I don't like to give this up, but the other option of binning the libstdc++ because we don't like the legal behaviour seems drastic. Another option would be to take one of the "gaussian" distribution headers and make it compile on both, but that seems to be an unnecessary maintenance burden and also assumes the correctness risk.
Grid like many codes uses the standard libraries implementation of the normal_distribution. This takes a uniform random number generator as a input and calls it twice to generate normally distributed random numbers using the polar method. This generates two normally distributed random numbers, one is returned in the current call to the normal distribution and the other is cached for the next call.
This causes an issue as the order in which the two normally distributed random number are returned and cached is not defined by the C++ standard. The implementations by llvm and gcc take different choice in the ordering of the returned and cached random numbers.
In essence this is not a bug as both compilers generate valid normally distributed random numbers but it makes the results dependent on the implementation of the standard as the sequence will have a different ordering. This can be problematic when comparing results between systems and hardware (CPU and GPU) as the implementation of the standard can change.
The text was updated successfully, but these errors were encountered: