An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-hpc/attachments/20120211/b701e44e/attachment.pl>
Get identical results for parallel and sequential?
4 messages · Libo Sun, Dirk Eddelbuettel, Paul Johnson
On 11 February 2012 at 15:27, Libo Sun 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? | | 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? By making sure the RNG streams are initialised identically on all nodes. Dirk
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too dark to read." -- Groucho Marx
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-hpc/attachments/20120211/29382694/attachment.pl>
2 days later
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