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

Norm Matloff matloff at cs.ucdavis.edu
Sun Feb 12 06:25:46 CET 2012


Sorry, I hadn't seen your simple example, and was just speaking
generally.  Looks like a random number stream issue in this case, all
right.

Norm

----- Forwarded message from Libo Sun <libosun at rams.colostate.edu> -----

Date: Sat, 11 Feb 2012 18:25:12 -0700
From: Libo Sun <libosun at rams.colostate.edu>
To: Norm Matloff <matloff at cs.ucdavis.edu>
Cc: r-sig-hpc at r-project.org
Subject: Re: [R-sig-hpc] Get identical results for parallel and sequential?

Thanks, but I still don't know how to make this very simple example get the
same result?

> sfSapply(c(1,1),rnorm)
[1]  1.823082 -2.222052
> rnorm(2)
[1] -0.5179967 -1.0807196

Libo


On Sat, Feb 11, 2012 at 5:50 PM, Norm Matloff <matloff at cs.ucdavis.edu>wrote:

> No, it's certainly not sufficient to simply make sure the same random
> number stream is used.
>
> Depending on the manner in which work is partitioned to processes,
> things can occur in an order different from that one gets in a
> sequential version.
>
> In typical cases, this will affect only roundoff error, and the parallel
> and sequential results should be close to each other.
>
> But they could be quite different.  Say for instance you are doing
> variable selection in regression.  Different partitions of the data
> could give different sets of predictor variables being chosen, etc.
>
> So, if your results are quite different, the first guess would be that
> you simply have a programming error, but there could be inherent
> algorithmic issues too.
>
> Norm Matloff
>
>
> Norm
>
>
> ----- Forwarded message from Libo Sun <libosun at rams.colostate.edu> -----
>
> Date: Sat, 11 Feb 2012 16:39:52 -0700
> From: Libo Sun <libosun at rams.colostate.edu>
> To: Dirk Eddelbuettel <edd at debian.org>
> Cc: r-sig-hpc at r-project.org
> Subject: Re: [R-sig-hpc] Get identical results for parallel and sequential?
>
> How to do that? By using sfClusterSetupRNGstream or sfClusterSetupRNG, it
> can reproduces the same parallel result, but it cannot give me the same
> result as sequential mode.
>
> Libo
>
> On Sat, Feb 11, 2012 at 4:26 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> >
> > 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
> >
>
>         [[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
>
> ----- End forwarded message -----
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>

----- End forwarded message -----



More information about the R-sig-hpc mailing list