[FLASH-USERS] Random Number Generators in FLASH

Jason Galyardt jason.galyardt at gmail.com
Wed Feb 24 16:13:23 EST 2016


Hi Carlo,

Thanks for the response. I agree with your comments on MPI implementation
and general reproducibility of scientific results. One practical question,
though: In order to decouple the random sequence from the MPI
configuration, you would need to set the random seed separately for each
block, with the seed for each RNG calculated as you suggest from some
static, block-specific quantity. However, in the FLASH architecture, you
only have one RNG per MPI processor. For my case, this is not a problem,
since I'm only using the RNG at initialization; I can reset the seed for
each block and not worry about affecting the others on a given MPI
processor. Is this in line with your thinking?

Thanks,
Jason


On Wed, Feb 24, 2016 at 3:27 PM, Carlo Graziani <carlo at oddjob.uchicago.edu>
wrote:

> On 02/24/2016 01:56 PM, Jason Galyardt wrote:
>
>> Dear FLASH Users,
>>
>> In FLASH 4.3, there is a random number generator (RNG) unit, located at
>> source/flashUtilities/rng. There are two implementations: the default is
>> located at source/flashUtilities/rng, and the other is located at
>> source/flashUtilities/rng/mt_rng. The default implementation seems to use
>> the Fortran 90 intrinsic RNG facilities (random_seed() and
>> random_number()), while the mt_rng implementation uses the 32-bit Mersenne
>> Twister.
>>
>> Has anyone used the Mersenne Twister implementation before? Is there a
>> recommended prescription for setting the seed on each processor of an MPI
>> job? The latter is complicated by the fact that mt_rng seems to want an
>> integer array of length 624 instead of a single integer seed which can be
>> constructed from the processor ID and a global, user-provided seed.
>>
>> Thanks,
>> Jason
>>
>> ----
>> Jason Galyardt
>> Department of Physics and Astronomy
>> University of Georgia
>>
>>
> Hi Jason.
>
> As I recall, this functionality was introduced in order to obtain
> cross-platform reproducibility of results.  The Fortan 90 intrinsics
> random_seed() and random_number() produce platform-dependent results, so in
> cases where it is important that pseudorandomness should be repeatable
> across
> platforms, it is desirable to have a portable high-quality RNG, such as
> the Mersenne twister.
>
> I don't know whether a recommended seeding prescription was ever
> articulated.
> It should be obvious, though, that if RNG initialization is bound to MPI
> rank
> rather than to a stable in-application computational structure (e.g. hashed
> coordinates of local block center, or Morton ordering of a block) the
> advantage
> of reproducibility is promptly lost, since one has now tied RNG
> initialization
> to the system-level details of MPI process allocation, so that the same
> simulation performed with different number of MPI processes necessarily
> produces different results.
>
> Bit-for-bit simulation reproducibility, even despite RNG calls, is
> important
> for regression testing.  It is also (I would argue) very valuable in
> general
> scientific simulation, particularly in cases of flows where small
> differences
> can be amplified by irreducible instabilities.  However, it is not
> obtainable
> without some effort, so the effort involved had better pass some
> cost/benefit
> analysis for you. If you feel it is more trouble than it is worth, the
> standard
> F90 intrinsics should probably produces adequate randomness.
>
> Carlo
>
> --
> Carlo Graziani                                 (773) 702-7973 (Voice)
> University of Chicago Flash Center             (773) 702-6645 (FAX)
> 5747 South Ellis Avenue     -------------------------------------
> Jones 314                  | The less a statesman amounts to, the
> Chicago, IL 60637          | more he loves the flag.
> carlo at oddjob.uchicago.edu  |               --- Kin Hubbard
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20160224/8a43c946/attachment.htm>


More information about the flash-users mailing list