(j3.2006) What does "same image" mean?
Bader, Reinhold
Reinhold.Bader
Mon Jan 22 03:55:39 EST 2018
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7773 bytes
Desc: not available
URL: <http://mailman.j3-fortran.org/pipermail/j3/attachments/20180122/e8e52ae5/attachment-0003.p7s>
More information about the J3
mailing list