[R] rsprng, snow, rmpi interactions

From: Ross Boylan <ross_at_biostat.ucsf.edu>
Date: Tue, 04 Mar 2008 18:33:01 -0800


The proper use of SPRNG is a little unclear to me in each of these packages, even more so when I put them all together.

My immediate question: in snow I did clusterSetupSRNG. If a later want to (re) set the system to a known seed, how do I do it? That is, I want each distributed process to recreate exactly the same random numbers that it did before; I assume SPRNG assures the streams are independent betweeen processes.

Here's what I did, trying to stick within SNOW to avoid trouble (from memory):
lamboot
start up R

library(snow)
library(rsprng)
library(rmpi)

cl<-makeMPIcluster(11)
clusterSetupSPRNG(cl, seed=123)
clusterEvalQ(cl, source("mycode.R"))
r<-parSapply(cl, seq(1000), function(i) doMyThing()))

Any comments on that? For example, would sticking to Rmpi and using parSim make sense (I'm not using seq(1000) for anything but getting that many repetitions.)?

Both rmpi and rsprng had a bunch of functions for setting of the parallel random number generators. Could anyone clarify if these are alternatives, or steps that must be run in sequence, or something else?

Is there a way to get multiple distributed random number streams. For example, in each simulation I may generate random variables X, Y, and Z. Some simulations skip generating X, but I'd like to get the same random sequences for Y as I did before. I assume that if X, Y and Z are each generated off a separate stream this is possible, but I'm not sure if it's possible within the existing libraries.

Thanks for any help.

Ross Boylan



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 05 Mar 2008 - 02:35:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Mar 2008 - 03:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive