[Rcpp-devel] Mersenne Twister in RcppArmadillo?
zhouyan at me.com
Sat Feb 9 17:42:37 CET 2013
This really is a BIG topic and worth a few more comments. Note that I wrote a
few related posts on RNGs at the Rcpp Gallery, see for example
which compares the RNGs from R, C++11 and Boost. Simon just added Armadillo to
the list, we can add even more RNGs fromn other packages.
If it is of interest to anyone, I once timed Boost, C++11 and Random123 (A high performance parallel RNG, http://www.thesalmons.org/john/random123/releases/latest/docs/, It come with a C++11 compatible RNG engine, can be used just like std::mt19937) once for different compilers on Linux. I just uploaded them to https://github.com/zhouyan/vSMC/wiki/RNG-performance-comparison
There are two benchmark, one for the performance of URNG (mt19937 etc). These include those in C++11 <random> and Boost.Random, which are almost identical in functionality (C++11 <random> is based on Boost.Random after all). Also they include two URNG from Random123, threefry and philox (both come with four basic configurations)
Another benchmark is the performance of generating distribution random numbers (such as normal). The Random123 threefry2x64 was used for all distribution and compilers, since it is the one with least performance difference between compilers.
clang SVN with libstdc++ 4.7
clang SVN with libc++ SVN
intel icpc 13
clang and gcc version also come with results when using AMD libm instead of glibc. However, the benchmark are not Rcpp specific. They are compiled to standalone C++ programs. But all these URNGs can be used Rcpp. As demonstrated in Dirk's example.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel