[Rcpp-devel] RcppParallel with string or char?

brian knaus briank.lists at gmail.com
Wed Feb 28 03:38:13 CET 2018


Thanks for the suggestion! Unfortunately, I don't follow you. This is
likely because this is my first attempt at parallel code outside of one-off
mclapply(). My hope is to use this in a package on CRAN, so I'd like
something more portable than mclapply().

My understanding is that we need to work with 'thread safe' data
structures. For example, in the worker in (
http://gallery.rcpp.org/articles/parallel-matrix-transform/)
RMatrix<double> is used for input and output matrices. And part of the
point of RMatrix and RVector are to provide these 'thread safe' data
structures so the rest of us do not need to learn the details of their
complexities. When you say I could try using std::vector<std::string> do
you mean as a substitute for RMatrix in the worker? Or perhaps
std::vector<std::vector<std::string>> as a substitute for RMatrix?

Thank you!
Brian

On Tue, Feb 27, 2018 at 3:51 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 27 February 2018 at 15:46, brian knaus wrote:
> | Thanks for your suggestion Dirk! But it may be beyond my abilities. I may
> | have to learn more than I anticipated on this one.
>
> Yes, it looks like a handful.
>
> OTOH you may be able to get by with standard C++ container, possibly at the
> cost of one initial copy.  Maybe std::vector<std::string> can do the trick
> for you and we do already have converters to those.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20180227/9da45e96/attachment.html>


More information about the Rcpp-devel mailing list