You need to use a parallel random generator and i think your nodes are
starting with the same seed.
Please see
http://stat.ethz.ch/R-manual/R-devel/library/parallel/html/RngStream.html
Not sure how to incorporate this into Rmpi, others would know.

Regards
Saptarshi



On Fri, Jul 19, 2013 at 2:30 PM, Hodgess, Erin <HodgessE@uhd.edu> wrote:

> Hi everyone!
>
> Here is an Rmpi question, please:  I am trying to do a little demo program
> in which I generate a few random numbers.
>
> Here is the code and the output:
> mpi3 <- function(n=2) {
> library(Rmpi)
> mpi.spawn.Rslaves(nslaves=n)
> mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
> z <-mpi.remote.exec(rnorm(10),n)
> print(str(z))
> par(mfrow=c(n,1))
> for(i in 1:n) plot(z[,i])
> par(mfrow=c(1,1))
> mpi.close.Rslaves()
>
>
> }
>
>     3 slaves are spawned successfully. 0 failed.
> master (rank 0, comm 1) of size 4 is running on: erinminfo
> slave1 (rank 1, comm 1) of size 4 is running on: erinminfo
> slave2 (rank 2, comm 1) of size 4 is running on: erinminfo
> slave3 (rank 3, comm 1) of size 4 is running on: erinminfo
> 'data.frame':    10 obs. of  3 variables:
>  $ X1: num  1.189 -0.497 -0.92 -1.531 -0.6 ...
>  $ X2: num  1.189 -0.497 -0.92 -1.531 -0.6 ...
>  $ X3: num  1.189 -0.497 -0.92 -1.531 -0.6 ...
> NULL
> [1] 1
>
> All of the random numbers are the same across the various variables.  Has
> anyone run into this, please?
>
> Any help truly appreciated.
>
> Sincerely,
> Erin
>
>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>

	[[alternative HTML version deleted]]

