(j3.2006) Rationale for RANDOM_INIT?

Steven G. Kargl kargl
Thu Jan 11 11:22:54 EST 2018


On Thu, Jan 11, 2018 at 06:05:28PM +0900, Malcolm Cohen wrote:
> >> >*distinct* seeds were used. That's an implementation detail,
> >> 
> >> No, it is part of the API.
> >> 
> >
> >I disagree; other than J3 has codified implementation details
> >into the API.
> 
> It is part of the API since 1991.
> 

Mistakes happen.  Why extend the mistake into a new intrinsic
subprogram?

> > The seed is not distinct but the sequences are.
> 
> On the face of it that does not conform to Fortran 90, 95, 2003, 2008 or 2018.
> 
> It has to be repeatable across images, as delivering a different
> sequence for the same seed does not conform.  Users also require
> it to be repeatable across executions.  These are important
> considerations!

What do you mean by "repeatable across images"?  It is repeatable
across execution.

For image N, "call random_init(.true.,.true.)" becomes

imageN:
   1.) Seed PRNG with XXXX
   2.) Determine image index. (This is the same across execution.)
   3.) Jump by index.         (This is the same across execution.)

Each image gets a distinct non-ovelapping sequence, and if the
program is executed again each image gets the same sequence it
had in a previous execution.

For image N, "call random_init(.false.,.true.)" and 
"call random_init(.false.,.false.)" becomes

imageN:
   1.) Seed PRNG with distinct processor-dependent seed. 

At least with gfortran, each image has its own private PRNG.  So
IMAGE_DISTINCT=.false. is automatically satisfied.

For image N, "call random_init(.true., .false.)" becomes.
   1.) Seed PRNG with XXXX

which I believe conforms to the standard as each image gets it
own private copy of the same sequence.  If you run the executable
again, then each image gets the same sequence, again.
 
-- 
Steve



More information about the J3 mailing list