[Haskell-cafe] Splittable random numbers
rrnewton at gmail.com
Fri Jan 21 23:19:30 CET 2011
I want to add the ability to use AES-NI instructions on Intel architectures
to GHC. Mainly I'd like to do splittable random number generators based on
AES as was suggested at the outset of this email. (I met Burton Smith last
week and this topic came up.)
I was just reading the below thread about the plugin architecture which got
me thinking about what the right way to add AES-NI is. (Disregarding for a
moment portability and the issue of where to test cpuid...)
The FFI is always an option. But after reading the first N pages I could
come across from google I'm still not totally clear on whether "unsafe"
foreign calls can happen simultaneously from separate Haskell threads (and
with sufficiently low overhead for this purpose).
I also ran across the phrase "compiler primitive" somewhere wrt GHC:
Is that the right way to go? Or would the compiler plugin mechanism
possibly allowing doing this without modifying mainline GHC?
On Fri, Nov 12, 2010 at 6:26 PM, wren ng thornton <wren at freegeek.org> wrote:
> On 11/12/10 5:33 AM, Richard Senington wrote:
>> It does not give the results you would want. This may have something to
>> do with picking "good" parameters for the mkLehmerTree function.
>> For example, using a random setup, I just got these results
>> result expected range
>> 16.814 expected = 16.0 (1,31)
>> 16.191 expected = 16.5 (1,32)
>> 16.576 expected = 17.0 (1,33)
>> 17.081 expected = 17.5 (1,34)
>> 17.543 expected = 18.0 (1,35)
> Have you run any significance tests? I wouldn't be surprised to see +/-0.5
> as within the bounds of expected randomness. I'm more worried about it
> seeming to be consistently on the -0.5 end of things, than I am about it not
> matching expectation (how many samples did you take again?). For small
> ranges like this, a consistent -0.5 (or +0.5) tends to indicate off-by-one
> errors in the generator.
> Live well,
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe