I am trying to use fortran intrinsic PRNG in a MPI code.
I understand from this link that GFortran implement the PRNG using xorshift1024* which has a period of 2^1024 - 1. It also says:
Note that in a multi-threaded program (e.g. using OpenMP directives), each thread will have its own random number state.
Then reading this I found:
When a new thread uses RANDOM_NUMBER for the first time, the seed is copied from the master seed, and forwarded N * 2^512 steps to guarantee that the random stream does not alias any other stream in the system, where N is the number of threads that have used RANDOM_NUMBER so far during the program execution
If this is an automatic feature of GFortran, it works only in OpenMP? What if I want to have parallel PRNG using MPI? How can I ensure the portability of the code to other compilers?
In other words: Is there any way to do what GFortran says it do (i.e. guarantee real parallel PRNG) in a portable way using the fortran intrinsic instructions?
NOTE: I was using the PRNG of Numerical Recipes in MPI. That worked well for some years, but now I am getting some errors in some assumptions on the integer model that Numerical Recipes says goes beyond fortran... so I don't see how to solve that and that is way I want to use the intrinsic PRNG if is possible.
Aucun commentaire:
Enregistrer un commentaire