[R-sig-hpc] Get identical results for parallel and sequential?

Paul Johnson pauljohn32 at gmail.com
Tue Feb 14 22:15:59 CET 2012


On Sat, Feb 11, 2012 at 4:27 PM, Libo Sun <libosun at rams.colostate.edu> wrote:
> Hi All,
>
> I have a question about R parallel computing by using snowfall.
>
> How can I set the seeds on parallel workers to get the same result as
> sequential mode?
>

As Hana S said, the snowFT package has the ability to assign seeds to
"replications", unlike other methods, which assign seeds to compute
nodes.  By associating seeds to replications, it is thus assured that
each time a step runs, it gets same seed, no matter on which node.

I've been trying to generalize that idea to allow multiple (separate)
streams of random numbers for each replication.  We have several
projects where the replication requires the "exact same random
numbers" from each of several streams. You could try this out and let
me know if it works for your purpose.

http://winstat.quant.ku.edu/svn/hpcexample/trunk/Ex66-ParallelSeedPrototype

If the README doesn't seem clear, email me, I will fix it up.

pj



> For example:
>
>> sfSapply(c(1,1),rnorm)
> [1]  1.823082 -2.222052
>> rnorm(2)
> [1] -0.5179967 -1.0807196
>
> How to get the identical result?
>
> Thanks.
> Libo
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas



More information about the R-sig-hpc mailing list