comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent LAFAGE <lafage@ipno.in2p3.fr>
Subject: Re: Parallel_Simulation
Date: Tue, 26 Feb 2013 08:09:45 +0100
Date: 2013-02-26T08:09:45+01:00	[thread overview]
Message-ID: <kghn3m$36m$1@ccpntc8.in2p3.fr> (raw)
In-Reply-To: <kgg6b2$kma$1@ccpntc8.in2p3.fr>

Le 25/02/2013 18:17, Vincent LAFAGE a écrit :
> 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.

Ooups...
Sorry I hastened to answer while I had not read carefully enough
A.5.2(47)

 47. If the generator period is sufficiently long in relation to the
     number of distinct initiator values, then each possible value of
     Initiator passed to Reset should initiate a sequence of random
     numbers that does not, in a practical sense, overlap the sequence
     initiated by any other value. If this is not possible, then the
     mapping between initiator values and generator states should be a
     rapidly varying function of the initiator value.

I see the statement, but while Mersenne Twister algorithms provides
very, very long period (2^19937?),  I would appreciate order of
magnitudes of the subperiods.

I guess I have to test,
And read much more m(__)m

Best regards

> 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.
> 
> Would you think of another way?
> 
> Best regards
> Vincent




  parent reply	other threads:[~2013-02-26  7:09 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     ` Parallel_Simulation John B. Matthews
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     ` Vincent LAFAGE [this message]
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