https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108336

--- Comment #2 from Gareth Davies <gareth.davies.ga.code at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Most likely there is only one seed per program so the random # generator is
> using locks. So the order is dependent on which thread calls the function.
> 
> Now having a seed per thread might be a good idea but it does have other
> kind of issues. Even initializing it and even Making sure it does not
> reinitialized each time a new openmp thread is launched.

There is some documentation as to how it's supposed to work here:
https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html

It sounds like we should be able to get repeated random numbers - even if their
mapping to the threads does vary. Indeed, the results are pretty close to that.

Reply via email to