Re: [Rd] portable parallel seeds project: request for critiques

From: Petr Savicky <savicky_at_cs.cas.cz>
Date: Fri, 02 Mar 2012 14:51:30 +0100

On Fri, Mar 02, 2012 at 01:36:34PM +0100, Karl Forner wrote:
> Thanks for your quick reply.
>
> About the rngSetSeed package: is it usable at c/c++ level ?

Not directly. The rngSetSeed package is meant to provide an R-level alternative to set.seed() for Mersenne-Twister with a better guarantee that different seeds provide unrelated streams. In particular, with rngSetSeed, it should be safe to reseed quite often, for example in each iteration of a loop like

  for (i in 1:n) {

      setVectorSeed(c(base.seed, i))
      # some code

  }

Otherwise everything remains the same as with set.seed(). In order to maintain several streams, one has to maintain copies of .Random.seed and use them, when required.

> Hmm I had not paid attention to the last paragraph:
>
> > The seeding procedure used in the
> > present software use*s a separate random number* generator of a different
> > design in order to
> > avoid any interference. An extra feature is the RandomInitByArray function
> > which makes
> > it possible to initialize the random number generator with multiple seeds.
> > We can make sure
> > that the streams have different starting points by using the thread id as
> > one of the seeds.
> >
>
> So it means that I am already using this solution ! (in the RcppRandomSFTM,
> see other post).
> and that I should be reasonably safe.

If RcppRandomSFTM uses the initialization for SFMT provided by the authors of SFMT, then you should be reasonably safe. I do not know exactly the SFMT initializations, but for the original Mersenne-Twister, the initializations from 2002, both the single number seed and a vector seed avoid known problems with the previous initializations. It should be pointed out, however, that the initialization by array from 2002 is more careful than the single number initialization, So, it is better to use the array initialization even for a single number seed.

Petr Savicky.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 02 Mar 2012 - 13:53:17 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Fri 02 Mar 2012 - 14:00:24 GMT.

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

list of date sections of archive