Identical Results with Rmpi and snowfall

198 views Asked by At

I'm doing analysis on some stuff with queueing system simulations in R and I'm using Rmpi and snowfall to run my program in parallel. Now, my program requires a lot of random number generation so this is especially bizarre. When I run simulations with the same parameters multiple times, I get identical results each time.

For instance, this was the output when I ran the simulation: -1 0 0 0 0 0 0 0 0 2 -1 -1 0 0 0

When I ran it again I got this: -1 0 0 0 0 0 0 0 0 2 -1 -1 0 0 0 0

I had 10 million samples and each one was identical. I've used sfClusterSetupRNG() which is intended to ensure unique random number generation across all the nodes so I don't think that is it. I never store my results globally in my R code and the simulation finishes way faster than I think it should. I honestly have no idea how or why this is occurring. Hoping someone can give some insight.

More insight: This seems to only be happening when I'm using sfClusterSetUpRNG().

1

There are 1 answers

0
Wesley Bland On

I don't know anything about snowfall or random number generation in R, but is there some way to seed the random number to ensure you don't get the same set each time? Usually you do this by seeding with the current system time.