public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Robert G. Brown" <rgb@phy.duke.edu>
To: Brian Gough <bjg@network-theory.co.uk>
Cc: GSL Discussion list <gsl-discuss@sources.redhat.com>
Subject: Re: RNG question
Date: Mon, 18 Aug 2008 21:12:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0808181638000.3196@lilith.rgb.private.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0808080823080.1860@lilith.rgb.private.net>

On Fri, 8 Aug 2008, Robert G. Brown wrote:

>> The macro is really an internal implementation detail and not intended
>> to be a limit (as far as I'm aware it's not publically accessible).
>> There are currently about 60 generators so if you wanted to give them
>> numbers 100 is too small but 1000 or 500 shouldn't be a problem.
>
> I looked over the code again and decided that was probably true on my
> own.  I'm preparing to basically clone the types.c module but create a
> larger vector of types.  I'll then run through a loop to populate it
> with the gsl ones, then add my own, in ranges.

I've done exactly this, and it works fine in dieharder 2.27.11.

If you are interested in contributed rngs all wrapped up and ready to
literally drop into place, let me know.  I have gsl-ready code for the
hardware/entropy /dev/random "generator", the related /dev/urandom
"generator" and the (BSD) /dev/arandom "generator" if you'd like it.  I
put these inside conditionals so that they are only added and show up in
the list of available generators (which I generate with fairly obvious
code) if they exist.

A suggestion:  I cannot realloc the built-in types[] (I'm pretty sure)
because it is statically allocated in types.c.  Right now in order to
get a types[] long enough to hold the GSL generator and the various
source dieharder generators in ranges, I have to allocate space for e.g.
dieharder_types[1000], create a pointer to gsl_types, initialize
gsl_types with gsl_rng_types_setup(), and then copy over the types (or
duplicate the specific code in gsl_rng_types_setup(), which then might
change without warning as GSL bumps a version and leave dieharder out of
sync with GSL where they overlap).  I then fill in my own and
contributed and R-derived generators in various ranges in
dieharder_types and it all works fine, BUT it is a bit of a hassle and
the alternative is a segment violation.

So, a minor request for a future snapshot of the GSL:  I think that if
you JUST increased N to 1000 (and maybe set the entire types vector to
zero before filling it as that makes it easy to test for where
generators are installed in the types vector) it wouldn't affect current
code in any way -- as you say it is hidden inside the source -- but it
would keep me from having to allocate a types[] vector of my own as I
could then just fill in the upper ranges of the one returned by the GSL.
I can easily imagine filling up the GSL-provided vector with only 100
slots, but I think it will take a bit of time to fill up a GSL-provided
types vector with 1000 slots.

> Are future/new rngs going to always be added at the end (new numbers) or
> will they get inserted in typed groupings?  I ask because IIRC the new
> MT's went in next to the original MT and displaced all the numbers.
> This makes logical sense, but breaks code that has hard coded rng
> numbers.  I can make dieharder work either way, but to lock in the
> numbers in dieharder in the latter case I have to work harder...;-).

I've decided to stick with the GSL numbers rigorously (reserving the
bottom 200 for the current GSL and any future expansion) -- if they
shift they shift.  Just remember that if you add new e.g. MT's grouped
in with the old ones (and displace e.g. the taus generators up a couple
of number-notches) you WILL break a lot of code that uses the old
numbers (which will all change).  I personally don't care -- dieharder
documents the generator name-to-number match automagically -- but
somebody that selected a generator by number in simulation code might
not notice and could end up getting "wrong answers" in the worst case
scenario as they run a few hundred CPU-months of simulation using a
different generator from the one they thought they were using...;-)

     rgb

-- 
Robert G. Brown                            Phone(cell): 1-919-280-8443
Duke University Physics Dept, Box 90305
Durham, N.C. 27708-0305
Web: http://www.phy.duke.edu/~rgb
Book of Lilith Website: http://www.phy.duke.edu/~rgb/Lilith/Lilith.php
Lulu Bookstore: http://stores.lulu.com/store.php?fAcctID=877977

  parent reply	other threads:[~2008-08-18 21:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 23:32 Robert G. Brown
2008-08-05  9:05 ` Fabian Bastin
2008-08-08 11:12 ` Brian Gough
2008-08-08 12:33   ` Robert G. Brown
2008-08-11 20:47     ` Brian Gough
2008-08-18 21:12     ` Robert G. Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-12-07 10:25 rng question Jari Häkkinen
2005-12-07 20:07 ` Brian Gough
2005-12-09 13:49   ` Jari Häkkinen
2005-12-17 16:50     ` Brian Gough
2005-12-17 23:58       ` Jari Häkkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0808181638000.3196@lilith.rgb.private.net \
    --to=rgb@phy.duke.edu \
    --cc=bjg@network-theory.co.uk \
    --cc=gsl-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).