Random Number Generators: Performance
Lars Segerlund
lars.segerlund@comsys.se
Mon Apr 26 10:14:00 GMT 2004
Would you you mind having a look at the Mersenne twister in libgfortran ? Do you think it's up to the job ?
I choose the MT since it has a VERY big period and a not too big seed, coupled with a performance which is right 'up there'.
You could also try 'ent' ( a program to calculate the entropy of random bit sequences ) on the different algorithms, when I did this it did suggest that MT had a good entropy measure for any size bitstream.
/ Lars Segerlund.
On Sat, 24 Apr 2004 10:10:05 -0400
Scott Robert Ladd <coyote@coyotegulch.com> wrote:
> As someone whose work is reliant on reliable, long-period random number
> generators, I've collected the several top-flight algorithms, including
> the Mersenne Twister and several suggested by George Marsaglia. You can
> find the implementations of these in my Coyotl library, available from
> the website in my sig below.
>
> On a Pentium 4 (Northwood), I get the following performance numbers:
>
> mtwister = 13.87 (72105154 rn/sec)
> mwc1038 = 15.65 (63913964 rn/sec)
> kissrng = 17.64 (56692771 rn/sec)
> mwc256 = 16.84 (59386090 rn/sec)
> cmwc4096 = 13.51 (74011471 rn/sec)
>
> On an pure 64-bit Opteron system, the numbers are quite different, due
> to the availability of 64-bit processor instructions:
>
> mtwister = 15.89 (62952145 rn/sec)
> mwc1038 = 9.73 (102786532 rn/sec)
> kissrng = 10.36 (96536781 rn/sec)
> mwc256 = 14.97 (66808050 rn/sec)
> cmwc4096 = 10.08 (99243210 rn/sec)
>
> I suspect the twister could be improved on a 64-bit platform by
> converting the array of 32-bit seeds into one using 64-bit values.
>
> Relative performance is, as shown above, highly platform-specific. The
> C++ code was compiled with -O3 -march={pentium4|opteron}, using GCC
> 3.4.1 from CVS. (Tree-ssa does not bootstrap this morning due to a bad
> patch.)
>
> In terms of general overall performance, cmwc4096 looks to be a good
> overall choice, save for it's use of a 4096-element array of 32-bit
> integers. KISS is a short period generator, but requires only four
> 32-bit state variables.
>
> I'm working on parallel random number gereators, but that is another
> tale. My feeling is that RANDOM_NUMBER should a general algorithm that
> performs well across platforms, and we ignore thread-safety, providing
> an extension random number generator suitable for parallel applications.
>
> --
> Scott Robert Ladd
> Coyote Gulch Productions (http://www.coyotegulch.com)
> Software Invention for High-Performance Computing
>
More information about the Fortran
mailing list