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

Dirk Eddelbuettel edd at debian.org
Sat Jun 1 15:47:50 CEST 2013


On 1 June 2013 at 14:05, Simon Zehnder wrote:
| On Jun 1, 2013, at 1:45 PM, Asis Hallab <asis.hallab at gmail.com> wrote:
| > 1) Use private directive on all Rcpp-Objects that are only accessed to
| > be read from, and a shared statement on the Rcpp List that collects
| > the results. -> segfault
| 
| First, you do usually not need a private clause on objects you read from, but only objects you want to manipulate inside a thread. 
| Second, I do not know how an Rcpp-List is embedded into memory, but it could be, that dependent on this memory structure,

Collection ("list") objects which, in the case of vectors or matrices, are
contiguous memory. Ie a collection of R objects.

In short: better not to write there.

Good discussion otherwise.

My general recommendation: split the issues. Try to solve your OpenMP design
questions in a standalone C++ program without any R.  If and when you're
happy (and this is no small task even for experienced C++ programmers) mix
with R(cpp).

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list