(j3.2006) What does "same image" mean?

Steven G. Kargl kargl
Tue Jan 23 13:25:16 EST 2018


Bill,

I agree with your assessment with the observation that I'm
concern with what a mere mortal user thinks the standard
says.  As far as I know, the following conforms

program foo
   real x(3)
   call random_init(.true., .false.)
   call random_number(x)
   write(*,'(3F15.7)') x
end program foo

% gfcx -o z c.f90
% ./z
      0.9166497      0.0343677      0.9250018
% ./z
      0.3294057      0.3634282      0.6506106
% ./z
      0.8441532      0.5690981      0.7679952

but, is this what a user expects and wants?  As the person that
made 'call RANDOM_SEED()' return the same sequence of RN with
gfortran, I am well aware that a number of users were unhappy
because other vendors choose a different behavior.

-- 
steve



On Mon, Jan 22, 2018 at 07:19:39PM +0000, Bill Long wrote:
> Images exist only during a particular execution of a program.  The
> images from one execution are unrelated to the images of a different
> execution. 
> 
> The desire/request for ?reproducible? random number sequences is
> motivated by the desire that every time you run the program you get
> the same sequence.  This is an important property of you are trying
> to debug a code, or example, or want to have a specific set of output
> for purposes of validating the code after a compiler update.  That
> can be accomplished by an explicit PUT of the seed value, though I
> think most people expect this as the default behavior if the
> random_init value is set to repeatable=.true. , or no call at all
> if this is the processor default already.  The random_init routine
> was introduced because processors differed on their default behavior. 
> 
> The ?called from the same image? text in the description for the
> repeatable argument to random_init is there mainly for the case
> of image_distinct=.true. to emphasize that the reset of the
> ?the same? seed value is independent for each image in that case.
> No matter what the argument values, calling random_init affects
> only the seed value on the image where it is called. 
> 
> Cheers,
> Bill
> 
> 
> > On Jan 22, 2018, at 11:59 AM, Steven G. Kargl <kargl at troutmask.apl.washington.edu> wrote:
> > 
> > On Mon, Jan 22, 2018 at 11:21:12AM +0000, Anton Shterenlikht wrote:
> >> I think "same image" here means same image in a particular
> >> execution of the program. Two different exections of
> >> a program with RANDOM_INIT(.true., ... ) might initialise
> >> the seed to different values. So the random number sequences
> >> from 2 executions of such program might be distinct.
> >> 
> >> I think RANDOM_SEED(PUT=...) is meant for cases
> >> where sequences of random numbers must be repeatable
> >> for every execution of a program.
> >> 
> >> Or have I got this wrong?
> >> 
> > 
> > Your interpretation coincides with mine.  Thanks
> > for the confirmation.
> > 
> > -- 
> > Steve
> > _______________________________________________
> > J3 mailing list
> > J3 at mailman.j3-fortran.org
> > http://mailman.j3-fortran.org/mailman/listinfo/j3
> 
> Bill Long                                                                       longb at cray.com
> Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
> Bioinformatics Software Development                      fax:  651-605-9143
> Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425
> 
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

-- 
Steve



More information about the J3 mailing list