(j3.2006) Rationale for RANDOM_INIT?
Steven G. Kargl
kargl
Wed Jan 10 20:55:37 EST 2018
On Wed, Jan 10, 2018 at 07:13:48PM -0500, Steve Lionel wrote:
> On 1/10/2018 4:06 PM, Steven G. Kargl wrote:
> > Now, suppose that the executable instantiates two images, and for
> > this discussion call them image0 and image1.
> >
> > 2) IMAGE_DISTINCT=.true. means *distinct* seeds are used to seed
> > the PRNG in image0 and image1. This suggests that there is an
> > implied assumption that the *distinct* seeds will lead to
> > *distinct* sequences of RN. Is this the intent of the Standard?
> > If yes, then the Standard should remove the assumption and state
> > the expected behavior.
> >
> > Compilers likely use a PRNG with some long period. The seed
> > initializes the PRNG by essentially pointing to a particular
> > member in the sequence of all RN. It is then possible that
> > *distinct* seeds lead to a sequence for image0 of [A B C D E ...]
> > and for image1 of [C D E ...]. That is, the two sequences have
> > a significant overlap. Here, a question of how much overlap
> > should be permissable arises.
> >
> > So, what does *distinct* mean?
> >
> > 3) Given the requirement of *distinct* seeds, this eliminates a class
> > of PRNG that can use a single seed to select a particular member in
> > the sequence of all RN, and then use a transform to select independent
> > subsequences. For example, internally, xform(0) would cause image0
> > to select subsequence 0 and xform(1) causes image1 to select
> > the subsequence 1. A description of this class of generator can
> > be found at http://vigna.di.unimi.it/ftp/papers/xorshift.pdf.
> >
> > It seems to me that the Standard should not require *distinct* seeds
> > when IMAGE_DISTINCT=.true., but rather require independent sequences.
> > The level of independence can be some statistical metric.
> The design of RANDOM_NUMBER and, in particular, RANDOM_SEED, has the
> explicit assumption that a given seed will generate a given sequence.
> There is no opportunity here for a RNG that can generate distinct
> sequences from a given seed. Users who want such behavior would need to
> look at supplying their own RNG.
I think we are talking passed each other here as I have a
proof-of-concept patch for gfortran that uses a PRNG
with a single seed that generates different non-overlapping
sequences for the different images via an xform() function
(the cited paper calls it a jump function). From a user's
prespective, she has no way of knowing whether a single
seed was used to initialize the PRNG in each image or
*distinct* seeds were used. That's an implementation detail,
and the Fortran Standard normally avoids implementation
details. The only thing that the user cares about is what
does RANDOM_NUMBER return after a call to RANDOM_INIT with
IMAGE_DISTINCT=.true. (and whether the sequences satisfy the
properties of a uniform distribution on [0,1)). If the intent
of the Standard is that each image has access to different
sequence of random number, then that's what the Standard
ought to state. Implementation details should be removed.
--
Steve
More information about the J3
mailing list