Dear Rcpp developers, I am working on a small package (here <https://github.com/mfasiolo/mvn>) that should provide efficient tools for the multivariate normal distribution using Rcpp/RcppArmadillo and OpenMP.
Creating functions that evaluate the multivariate normal density efficiently was fairly straightforward, but I am struggling with parallel random number generation with OpenMP. 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 other hand R level parallelism using clusterApply, mclapply etc appears to be too slow to be of any use for this purpose. Is anybody aware of any package providing a parallel C++ rng which my package might link to? I have read this post<http://www.lindonslog.com/programming/parallel-random-number-generation-trng/> about Tina's rng, which seems to work with OpenMP and Rcpp. How hard would it be to have such a library included in my package (if at all possible)? Sorry for the possibly silly questions and thanks for any suggestion. Matteo
_______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
