[Top][All Lists]

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

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

From: Rodney Sparapani
Subject: [Help-gsl] Re: RNG and parallel MC simulations
Date: Tue, 30 Sep 2008 09:32:07 -0500
User-agent: Thunderbird (X11/20080505)

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?


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)


reply via email to

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