[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Help-gsl] Re: RNG and parallel MC simulations

From: Abbas Alhakim
Subject: RE: [Help-gsl] Re: RNG and parallel MC simulations
Date: Thu, 2 Oct 2008 10:40:35 -0400

Hi Torquil:

In general the choice of the seeds should not be done randomly, as two 
different seeds might very well lead to highly overlapped streams, thus losing 
independence. Independence here is only "artificial" in the sense that two 
streams pass statistical tests of independence.

The SPRNG streams are carefully designed and tested to provide non-overlapping 
streams that simulate independent sequences of uniform random variables.

Note that there are other libraries for parallel random numbers such as the one 
designed by L'Ecuyer et al. google up L'Ecuyer publications and check e.g. the 
paper titled (something like): "A random number generator with many streams and 

-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Rodney Sparapani
Sent: Tuesday, September 30, 2008 10:32 AM
To: address@hidden
Subject: [Help-gsl] Re: RNG and parallel MC simulations

Torquil Macdonald Sørensen wrote:
> Hi everyone,
> I have a parallel (OpenMP) Monte Carlo simulation program that uses 
> independent streams of random numbers (using GSL) on each processor. The 
> parallelization of the program is trivial, there is no communication 
> between the threads.
> Up to now I have simply declared the RNGs within each thread and seeded 
> them with the thread-number. It works fine, and I have tried ranlxs2, 
> taus2 and mt19937, using seed = threadnumber+1. The +1 is to avoid 
> seed=0 which would give the default seed in GSL in thread 0.
> Is it problematic to do this, wrt. the quality of the "independent" 
> streams? Should I go through the trouble of changing to SPRNG? Does the 
> GSL development team have any special recomendations for choice of RNG 
> and/or seeds in the case of parallel streams?
> Since I have no interaction between the threads, all I require is that 
> the streams I use are as independent as possible, so that would be 
> accomplished by not choosing an unfortunate set of seed values?
> According to the SPRNG web page, they offer the following algorithms:
> (i) Linear Congruential with Prime Addend
> (ii) modified Additive Lagged Fibonacci
> (iii) Multiplicative Lagged Fibonacci
> (iv) Combined Multiple Recursive Generator
> (v) Prime Modulus Linear Congruential Generator.
> I'm not sure why these should be better suited than a good RNG in GSL. 
> Does anyone have an opinion on this?
> Ref:
> Best regards
> Torquil Sørensen

Hi Torquil:

I'm jealous.  I tried to do something like this with PVM (however,
the users of the other workstations thought otherwise :o).  Maybe
I'll look into OpenMP since it is now part of the compiler (I'm
using Sun Studio 12; has any one tried OpenMP with that; I haven't
been keeping up with latest/greatest compiler technology).  Are
you going to post your code some where (pretty please)?

In any case, if memory serves...  The idea of SPRNG is that their
seeds produce truly independent PRNG streams.  In order to demonstrate
that your GSL PRNG streams were independent would be difficult I
suspect.  The proofs would be horrific and, most likely, it would
be impractical to demonstrate in practice with lagged 
cross-correlations, etc.  It seems to me that SPRNG is exactly what you 
want, don't fight it :o)


Help-gsl mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]