[petsc-dev] strangness in Chebyshev estimate of eigenvalues

Matthew Knepley knepley at gmail.com
Thu Aug 27 17:45:32 CDT 2015


On Thu, Aug 27, 2015 at 5:35 PM, Jed Brown <jed at jedbrown.org> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
> >    This is the default behavior if one just creates a PetscRandom and
> uses it, so don't be going and setting seeds inside GAMG or Chebyshev.
>
> You're right (my mistake), but the consequences are dangerous if the
> user is holding a PetscRandom across calls to GAMG (or anything that
> creates new PetscRandom instances).  The reason is that merely creating
> a PetscRandom reseeds the global PRNG.  (What moron thought a global
> seed was a good idea?)  Seems to me we should avoid drand48 always so we
> don't disrupt the user's source of randomness (leading to really
> confusing incorrect results).  We could use the non-disastrous
> drand48_r, but it's a GNU extension so we'd need an alternative anyway.
>
> If Matt changes "rander48" to the rand48_r (or erand48_r) interface,
> then we'd be okay.  This would also remove the internal variables that
> Matt forget to make static.
>

I will make them local to the object, and we will all be fine then.

   Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150827/3e0b70f9/attachment.html>


More information about the petsc-dev mailing list