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

Steven G. Kargl kargl
Sat Jan 20 19:57:01 EST 2018


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



More information about the J3 mailing list