comp.lang.ada
 help / color / mirror / Atom feed
From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: Parallel_Simulation
Date: Mon, 25 Feb 2013 13:30:49 -0500
Date: 2013-02-25T13:30:49-05:00	[thread overview]
Message-ID: <nospam-10D568.13304925022013@news.aioe.org> (raw)
In-Reply-To: kgg6b2$kma$1@ccpntc8.in2p3.fr

In article <kgg6b2$kma$1@ccpntc8.in2p3.fr>,
 Vincent LAFAGE <lafage@ipno.in2p3.fr> wrote:

> Le 25/02/2013 13:40, John B. Matthews a écrit :
> > In article <kgfdsp$tb0$1@ccpntc8.in2p3.fr>,
> >  Vincent LAFAGE <lafage@ipno.in2p3.fr> wrote:
> > 
> >> I am interested in MonteCarlo simulation and I had translated a 
> >> former F77 code to Ada with success, with the goal of 
> >> parallelizing it, but one part in the algorithm still resists 
> >> parallelization: the random number generator. I need the different 
> >> worker to rely on independant random number generators.
> >>
> >> Then I found a precious example in
> >>  RM-A-5-2 59., 60., 61.
> >> that compiles smoothly.
> >>
> >> I will now attempt to check the independance of the sequence 
> >> generated by each thread. But this kind of check is always more 
> >> subtle than expected.
> >>
> >> I wonder whether there is a statement about the independance of 
> >> such generator, in particular in the gnat implementation?
> > 
> > You should check your implementation's required documentation and 
> > any statements on implementation advice. For example, GNAT includes 
> > a comment in Ada.Numerics.Float_Random.ads, and the GNAT Reference 
> > Manual says, "The generator period is sufficiently long for the 
> > first condition here [A.5.2(47)] to hold true."
> 
> Thanks for the advice, but the particular doesn't exactly fit my 
> question. I understand that the sequence is long enough. But 
> different seeds will in the end be different starting points along 
> the same sequence (well, at least for congruential generators, I 
> still have to confirm it for Mersenne Twister algorithm that is 
> used). And this would in turn lead to fine correlations between the 
> sequences.
> 
> The best statement I have found until now is in gnat_rm-4.6.info:
> 
> *67*.  The minimum time interval between calls to the time-dependent 
> Reset procedure that are guaranteed to initiate different random 
> number sequences.  See A.5.2(45).
>   The minimum period between reset calls to guarantee distinct
>   series of random numbers is one microsecond.
> 
> So I need to assert the delay between the reset of each worker in 
> RM-A-5-2 60 to be sure that there is at least one microsecond.

IIUC, the example in A.5.2(60) uses the version of Reset that is _not_ 
time-dependent; it initializes each Worker's generator to "a state 
denoted by a single integer." As long as you're not using the 
time-dependent version, I don't see how the minimum period would come 
into play.

> Would you think of another way?

If you Reset a single instance of Discrete_Random in a time-dependent 
way and use it to generate each Worker's Initiator, as suggested in 
A.5.2(61), I don't see much chance of correlation.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



  parent reply	other threads:[~2013-02-25 18:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 10:20 Parallel_Simulation Vincent LAFAGE
2013-02-25 12:40 ` Parallel_Simulation John B. Matthews
2013-02-25 17:17   ` Parallel_Simulation Vincent LAFAGE
2013-02-25 18:18     ` Parallel_Simulation Shark8
2013-02-26  7:20       ` Parallel_Simulation Vincent LAFAGE
2013-02-25 18:30     ` John B. Matthews [this message]
2013-02-26  7:13       ` Parallel_Simulation Vincent LAFAGE
2013-02-25 21:04     ` Parallel_Simulation Simon Wright
2013-02-25 21:40     ` Parallel_Simulation gautier_niouzes
2013-02-26  7:09     ` Parallel_Simulation Vincent LAFAGE
2013-02-28 11:47       ` Parallel_Simulation John B. Matthews
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox