Re: [Rcpp-devel] Parallel random numbers using Rcpp and OpenMP

2014-04-28 Thread Romain Francois
Hi, If you can assume c++11, you might bot need openmp, as you can just use standard support for threads, etc ... Although the compiler suite used on windows (if you care about that) does not support c++11 threads. This might be available later. Romain Le 28 avr. 2014 à 12:51, Matteo Fasi

Re: [Rcpp-devel] Parallel random numbers using Rcpp and OpenMP

2014-04-28 Thread Matteo Fasiolo
Hi all, many thanks for your detailed replies, I see that there are many options out there. As a first step I think I will try out the C++11 option that Matt suggested, as it seems relatively simple. In particular I might do something like: #pragma omp parallel { std::mt19937_64 engine(

Re: [Rcpp-devel] Parallel random numbers using Rcpp and OpenMP

2014-04-28 Thread Matt D.
On 4/28/2014 01:30, Matteo Fasiolo wrote: [...] As I understand, doing things such as: NumericMatrix out(n, d); #pragma omp for schedule(static) for(int kk = 0; kk < d; kk++) out( _, kk) = rnorm(n); is not going to work, because rnorm() is not thread safe (in fact this code crashed R). On the