(j3.2006) (SC22WG5.4125) [ukfortran] Parallel random numbers

Bill Long longb
Mon Oct 26 12:04:34 EDT 2009

N.M. Maclaren wrote:
> On Oct 23 2009, Robert W. Numrich wrote:
>> I agree with Aleks:
>>> 1) All the sequencies are independent
>>> 2) The same random number generator is used on each image (same seed,
>>> same sequence).
>>> 3) No restrictions on calling RANDOM_SEED and RANDOM_NUMBER ala ordering
>>> of segments.
>>> If the user wants to get different sequencies on different images, just
>>> use different seeds. No quasi-independence or any such quality
>>> guarantees---this is to be used in simple tests, debugging, student
>>> codes, and for certain algorithms where the quality does not matter much
>>> (for example, random alternation algorithms in linear-algebra algorithms
>>> or even some PDE grid solvers)
> There are two issues there.
>     1) The first is that the examples are too optimistic; while the
> quality doesn't matter much, the association is often SO bad that it
> causes even those algorithms to give wrong answers.  Yes, I have seen
> that, quite a few times.

I believe that Aleks meant by (1)  that each image maintains a separate 
and is not proposing that they are statistically independent of each 
other. By (2)
I assume he means that the default seed is the same on each image - clearly
the user can change the seed independently on each image if desired.

>     2) Are you really saying that the Fortran standard should REQUIRE a
> known, deficient approach, of a nature that every expert in this area
> regards as unacceptable?  That's not the Fortran I know.

This is how every MPI program works today.

>> Making things "proceesor dependent", as suggested below, is a bad idea.
>> If the programmer wants some special random sequence, he needs to generate
>> it himself.  If he is serious about random numbers, even on a single
>> processor, he should generate his own and not depend on some compiler
>> generated sequence with no known properties.
> That is the converse advice of what every expert has said since Knuth,
> and all still say today.

Usually claims to speak for "every expert" are wildly  overstated, as is 
clearly the
case here.  Bob's statement is exactly what the  serious user has been 
told for decades.

> While I agree that very few vendors have a clue about this area,

At this point the pompous condescension has gone just too far.  Vendors, 
contrary to
claims, are not idiots.  We know that the simplistic linear 
congruential  generators that
are normally supplied  do not represent quality generators.  They are 
supplied because of
market forces (i.e. customer demand) require  that the generator be as 
fast as possible.
If the people who decide the requirements for machines change to wanting 
a slow, but
higher quality generator behind  RANDOM_NUMBER, the vendors  would 
certainly  change.

> ordinary programmers have even less clue.  They are likely to pick up
> some catastrophically bad generator from the net, because there are so
> many more of them than competent ones out there.

> The point here is precisely that coarrays are based on a SPMD model, and
> not a MIMD model.  There is a single program, and not a collection of
> independent images - that's the MPI model.

I really don't understand that statement at all.  Fortran 2008 and MPI 
have the same
SPMD model. Indeed , we fully  expect  to have mixed coarray and  MPI 
codes.  E
Each image does execute independently most of the time, just as with MPI.


Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

More information about the J3 mailing list