Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] RFC: Add an OPAL rand and srand
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2014-02-07 17:57:26


+1

On Feb 7, 2014, at 5:23 PM, Joshua Ladd <joshual_at_[hidden]>
 wrote:

> What: Add an internal random number generator to OPAL.
>
> Why: OMPI uses rand and srand all over the place. Because the middleware is mucking with the RNG’s global state, applications that use these library routines will not achieve reproducible results with the same seed.
>
> How: I plan to put in an additive lagged Fibonacci generator seeded with a Tausworthe generator that itself is seeded by the user’s seed. The short story here is that the ALFG has a toroidal state space, i.e. it can be decomposed into non-overlapping cycles with maximal period. It’s well understood how to fully enumerate these cycles when, for a length k register composed of m-bit words, we view this as a k X m binary matrix. It was proven by Marsaglia et al. that this matrix has a canonical form that is uniquely determined by the values k and l (the two numbers that (almost) completely characterize an ALFG.) So, distinct seeds are guaranteed to map to distinct, non-overlapping, long period streams that have measurably very, very low inter- and intra-stream correlations. We used this for large scale Monte Carlo simulations back in my PhD days.
>
> Will define a new type:
>
> struct opal_rng_buffer_t {
>
> uint32_t buff[127]; /* if people are going to pitch a fit over the size, we can go smaller, down to 7, but, obviously, this affects the quality of the streams */
> int tap1;
> int tap2;
>
> };
>
> and two functions:
>
> /* User is responsible for defining his/her own opal_rng_buffer_t
> * or malloc-ing and managing the resources themselves.
> */
> int opal_srand(opal_rng_buffer_t *buff, uint32_t seed);
>
> /* Returns a 32-bit pseudo random integer */
> uint32_t opal_rand(opal_rng_buffer_t *buff);
>
>
> When: Should be in by the end of February. Code is written, but integration and testing always takes some time.
>
>
>
> Joshua S. Ladd, PhD
> HPC Algorithms Engineer
> Mellanox Technologies
>
> Email: joshual_at_[hidden]
> Cell: +1 (865) 258 - 8898
>
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/