[Insight-developers] Random number reseeding

Lorensen, William E (Research) lorensen at crd.ge.com
Sun Jan 16 14:52:21 EST 2005


On cygwin, why not seed the first time with a specific seed? I think the
other compilers are OK. The regression tests do a reseed with a specific
value to guarantee reproducable results.

Bill


-----Original Message-----
From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com]
Sent: Sunday, January 16, 2005 2:05 PM
To: Lorensen, William E (Research)
Cc: insight-developers at itk.org
Subject: Re: [Insight-developers] Random number reseeding


Hi Bill,

I have cygwin gcc running on my laptop and the errors disappear after
reseeding. Apparently it is required.
[ http://www.nersc.gov/nusers/resources/software/libs/math/random/
"Functions srand48, seed48, and lcong48 are initialization entry points, one
of which should be invoked before any of drand48, lrand48, or mrand48 is
called." ]

It looks like most compilers don't enforce it and automatically supply seeds
if drand48 is called without a prior call to srand48. But cygwin does not
seem to. (Cygwin uses Newlib for its math functions and there have been
others with similar problems :
http://sources.redhat.com/ml/cygwin/2004-11/msg00513.html)

On debugging through the code, I found that vnl_sample_uniform which calls
one of these random number generators returned 0 on cygwin gcc 3.3 and 3.4
unless it was called with a prior call to vnl_sample_reseed which calls
srand. VS6 had no problems however with or without reseeding.

There have been earlier problems on the mailing list and it looks like our
suggested solution worked.
[
http://public.kitware.com/pipermail/insight-users/2004-December/011369.html
]
But I looked at the dashboard this morning and noticed that some of the vnl
and related registration tests have started failing on the continuous
builds. I am thinking of uncommiting the changes.

I am hoping that the tests should pass on hemmingway UNC next morning.

Have you encountered a similar problem before ?
Thanks
regards
karthik
http://docs.sun.com/app/docs/doc/801-6680-03/6i11qck31?a=view
http://docs.hp.com/en/B2355-90694/drand48.3C.html

----- Original Message ----- 
From: "Lorensen, William E (Research)" <lorensen at crd.ge.com>
To: <Karthik.Krishnan at kitware.com>
Cc: <insight-developers at itk.org>
Sent: Sunday, January 16, 2005 11:03 AM
Subject: [Insight-developers] Random number reseeding


> Karthik,
> We need reproducible results for our nightly regression testing. The
changes
> to reseed the random number generator will prevent repeatability I
believe.
>
> I guess I misunderstood the fixes for cygwin.
>
> Suggestions?
>
> Bill
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list