On Sun, 19 Jul 2020, Sven Schreiber wrote:
Hi,
here's a question about some details of random number generation in
MPI-parallelized scripts.
I have read the relevant section 7 of the gretl + MPI guide, but one
thing still isn't clear to me: How to imitate the effect of what "set
seed" would do in the standard single-thread setting? As far as I
understand, the default setting in gretl's MPI world is to have separate
RNGs, to preserve independence of the pseudo-random numbers. OK. The
alternative that is described in the guide is to enforce identical RNG
sequences in all parallel threads.
What about the case where you want to have independent RNG sequences
across processes, but you want to be able to control them for
replication purposes, from one run to the next? How to achieve that
effect in gretl's MPI implementation?
set seed
<hansl>
print "starting MPI..."
mpi
set seed 88775531
matrix m = mnormal(3,3)
mpireduce(&m, vcat)
if $mpirank == 0
print m
endif
end mpi --np=3
</hansl>
Run it a few times and you'll always get the same results, though
the three 3 x 3 matrices differ from each other.
Allin