Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Random Numbers

JohnNichols
Valued Contributor III
806 Views

The Intel manual for random numbers has :

 

If repeatable has the value .true. and image_distinct has the value .true.,
 the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED 
with a different processor-dependent value of PUT on each image 
that executes the call. 
If the invoking image index on the initial team is the same, 
the value of PUT is the same each time the program is executed.

 

Does anyone know what the processor dependent value is?

 

0 Kudos
5 Replies
JohnNichols
Valued Contributor III
801 Views

The Intel Sample uses dimension, is this the preferred style for coding?

REAL,DIMENSION(1000) :: y

 it is particularly interesting when one gets:

REAL y
dimension(1000) y 
0 Kudos
Steve_Lionel
Honored Contributor III
779 Views

You can call RANDOM_SEED with the GET argument after calling RANDOM_INIT to see what it used.

Personally, I would not use DIMENSION, but it's fine. Fortran lets you specify attributes across multiple statements.

0 Kudos
Arjen_Markus
Honored Contributor I
756 Views

Do you mean you want to predict the value? Or is Steve's answer enough?

0 Kudos
JohnNichols
Valued Contributor III
741 Views

In the Intel Statement, there is a reference to a processor dependent value for the PUT.  I was interested in what is the processor dependent value and what is the "quality of this set of numbers."

As an example, many years ago in Byte, best magazine ever, in the Recreational Maths column there is an example of a genetic algorithm.  The program was described in BASIC and I coded the algorithm and essentially get the same results as the Author.  The Random Number generator in BASIC is really good.  

I tried to code the program in Fortran, and it always ran forever and never converged to the "answer".  I spent a lot of time just playing with random number generators.  

It is just fun to play with, it has no great meaning, it just one of those annoyances with Fortran that the random number generator is not of a "high" quality.  

One of the useful Random Number Models is the Box-Mueller, the people who referenced this model, usually referenced the original paper from about 1956.  So I set out to find the original, people who copy make mistakes, turns out no one had ever asked for the paper from Princeton and it took them several weeks to find it, as the group had been created in WW2 (I think) and these old monographs were long forgotten.  I have a copy on my computer somewhere.  You should not reference a paper you have not read.  

As an example, in about 1904, Baker from UIUC created a device to measure tensile strengths of mortars, great little device.  The original paper and drawing are still available readily.  ASTM copied the original and then copyrighted the whole thing, not my idea of playing a straight bat (from cricket). But there is a mistake in the copied drawing, a dimension is incorrect. Even when you point this out to the committee, it is not fixed.  

 

0 Kudos
Steve_Lionel
Honored Contributor III
732 Views

The specific value used is not likely to be interesting - only that it leads to the same sequence each time you run the program. Intel uses the L'Ecuyer 1991 algorithm - it's very good, but nowadays there are better ones. Still, those who care about RNG "quality" are best served by selecting a specific implementation (from a library or built from source) rather than relying on whatever the compiler happens to use.

0 Kudos
Reply