[Numpy-discussion] speed of random number generator compared to Julia
pierre.haessig at crans.org
Mon Apr 3 11:59:22 EDT 2017
Le 03/04/2017 à 15:44, Jaime Fernández del Río a écrit :
> <https://github.com/JuliaLang/julia/blob/7fb758a275a0b4cf0e3f4cbf482c065cb32f0011/doc/src/stdlib/numbers.md#L116> says
> that Julia uses this library
> <http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/#dSFMT>, which
> is different from the home brewed version of the Mersenne twister in
> NumPy. The second link I posted claims their speed comes from
> generating double precision numbers directly, rather than generating
> random bytes that have to be converted to doubles, as is the case of
> NumPy through this magical incantation
> They also throw the SIMD acronym around, which likely means their
> random number generation is parallelized.
> My guess is that most of the speed-up comes from the SIMD
> parallelization: the Mersenne algorithm does a lot of work
> <https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/randomkit.c#L221> to
> produce 32 random bits, so that likely dominates over a couple of
> arithmetic operations, even if divisions are involved.
Thanks for the feedback.
I'm not good in enough in reading Julia to be 100% sure, but I feel like
that the random.jl
a Julia implementation of Mersenne Twister... but I have no idea whether
it is the "fancy" SIMD version or the "old" 32bits version.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion