(j3.2006) What does "same image" mean?
Steven G. Kargl
kargl
Mon Jan 22 12:56:31 EST 2018
Reinhold,
Thanks for the response. You've confirmed how I read the
standard. Unfortunately, your "practical reason" is
causing me a headache in that a user, who is not intimately
familiar with the details of the Fortran standard, may expect
that REPEATABLE will give the same sequence of RN for each
execution of a single-image program.
--
steve
On Mon, Jan 22, 2018 at 08:55:39AM +0000, Bader, Reinhold wrote:
> Hello Steve,
>
> "same image" as used in the standard document seems to me always to
> apply to a single program execution. The same applies for "another image"
> or "different image"
>
> So you cannot deduce that for two execution instances the two instances
> of image 1 are "different images" or "same images" in the sense the standard
> uses the term ...
>
> For practical reasons, I would think "same image" refers to equality of the
> image index
> (of the initial team).
>
> Regards
> Reinhold
>
> > -----Urspr?ngliche Nachricht-----
> > Von: J3 [mailto:j3-bounces at mailman.j3-fortran.org] Im Auftrag von Steven
> > G. Kargl
> > Gesendet: Sonntag, 21. Januar 2018 01:57
> > An: J3 Fortran <j3 at j3-fortran.org>
> > Betreff: (j3.2006) What does "same image" mean?
> >
> > In the description of the dummy argument REPEATABLE for the
> > RANDOM_INIT intrinsic subroutine, one finds the sentence
> >
> >
> > REPEATABLE ... If it has the value true, the seed accessed by the
> > pseudorandom number generator is set to a processor-dependent
> > value that is the same each time RANDOM_INIT is called from
> > the same image.
> >
> > What does "same image" mean here? There are two case to consider.
> > For this discussion consider a Fortran program that does not use
> co-arrays, so
> > the execution of a compiled program creates a single image.
> >
> > program same_image1
> > real x(2), y(2)
> > call random_init(.true., .false.)
> > call random_number(x)
> > print *, x
> > call random_init(.true., .false.)
> > call random_number(y)
> > print *, y
> > end program same_image1
> >
> > Here, with the implied assumption that a seed yields a unique sequence of
> > random numbers, one can expect that x == y.
> >
> > Now, consider
> >
> > program same_image2
> > real x(2)
> > call random_init(.true., .false.)
> > call random_number(x)
> > print *, x
> > end program same_image2
> >
> > Compile this program to create an executable and run it to create an
> image.
> > This will produce two numbers and then terminate. Wait an hour and re-run
> > the executable. This will create a new image, two numbers will be
> produced,
> > and the image terminates. Should one expect that the two sets of numbers
> > are the same? Clearly, the new image cannot be the previous image as the
> > previous image terminated an hour ago, so the call to RANDOM_INIT() in the
> > new image cannot occur in the "same image" as the previous image. So,
> > does this mean that the second program's use of RANDOM_INIT does not
> > guarantee repeatable sequences of random numbers for multiple
> > executions of the same executable?
> >
> > --
> > steve
> > _______________________________________________
> > J3 mailing list
> > J3 at mailman.j3-fortran.org
> > http://mailman.j3-fortran.org/mailman/listinfo/j3
> _______________________________________________
> 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