From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d541063ff843658f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 X-Received: by 10.180.98.102 with SMTP id eh6mr720404wib.7.1362276833631; Sat, 02 Mar 2013 18:13:53 -0800 (PST) Path: bp2ni69216wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!novso.com!nerim.net!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!not-for-mail From: Vincent LAFAGE Newsgroups: comp.lang.ada Subject: Re: Parallel_Simulation Date: Tue, 26 Feb 2013 08:13:28 +0100 Organization: In2p3 Message-ID: References: NNTP-Posting-Host: ipnnarval.in2p3.fr Mime-Version: 1.0 X-Trace: ccpntc8.in2p3.fr 1361862805 3494 134.158.92.7 (26 Feb 2013 07:13:25 GMT) X-Complaints-To: newsmaster@cc.in2p3.fr NNTP-Posting-Date: Tue, 26 Feb 2013 07:13:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 In-Reply-To: X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2013-02-26T08:13:28+01:00 List-Id: Le 25/02/2013 19:30, John B. Matthews a écrit : > In article , > Vincent LAFAGE wrote: > >> Le 25/02/2013 13:40, John B. Matthews a écrit : >>> In article , >>> Vincent LAFAGE 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. Indeed. >> 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. Thank you for your guidance and detailled answer! Vincent