[Rcpp-devel] Mersenne Twister in RcppArmadillo?
Yan Zhou
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
http://gallery.rcpp.org/articles/timing-normal-rngs/
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.
Compilers include,
clang SVN with libstdc++ 4.7
clang SVN with libc++ SVN
gcc 4.7
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.
Best,
Yan Zhou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130209/e6582d0d/attachment.html>
More information about the Rcpp-devel
mailing list