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

Dirk Eddelbuettel edd at debian.org
Sun Feb 12 00:26:57 CET 2012


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



More information about the R-sig-hpc mailing list