Skip to content
Prev 5958 / 10988 Next

[Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

Hi Asis,

in addition to what Dirk said I can tell you, that at least Armadillo Objects do work accurate with OpenMP. I used in my code an '#pragma omp parallel for' directive on a lot of Armadillo matrices without any problems. Be aware of what clauses you use in your parallel setting. 

There won't be a problem in parallel work, if you just read from matrices, but writing actions should be considered carefully. In case you need matrices in each thread which are manipulated individually make sure that you copy them for each thread (use the clause 'private(matrixName)' in the directive for the parallel region). Even if you have one matrix that collects al values from the threads, accessing in each thread different indices does work perfectly. 

Best

Simon
On May 31, 2013, at 7:37 PM, Dirk Eddelbuettel <edd at debian.org> wrote: