[Rcpp-devel] Question on performance and strategy

Jordi Molins jordi.molins.coronado at gmail.com
Sat Sep 22 17:21:32 CEST 2018


Hello, I am new in this distribution list. I am using Rcpp and
RcppArmadillo for my project.

Now, I will have access to a relatively big computer, with both CPUs and
GPUs. And I want to take advantage of it.

So far, I am calling from C++ a R function (the nls.lm from minpack.lm,
which is a port of MINPACK, in Fortran, for the Levenberg-Marquardt nls
optimization). This call is pretty fast, so I am happy.

When I learned something like RcppParallel and RcppArrayFire existed, I was
quite happy. But then I saw that RcppParallel does not allow R calls, and
RcppArrayFire does not work on Windows (I am planning to have a Linux
partition soon on my personal computer, though).

So, the planning to do parallel calculations from C++ has gone down a bit.
For sure, I can do parallel calculations from R (and my R functions may use
Rcpp). But ideally, I would like to do all the calculations from C++, if
possible, especially on production.

Note: I know in RcppEigen there is a C++ port for the Levenberg-Marquardt
implementation. But again, this is just luck. Maybe next time I will need
the equivalent of an R function, and this function does not exist in C++. I
really would like to be able to call R functions from C++.

Also, I do not know how the ArrayFire implementation works, and especially,
how it relates to parallel calculations (and I do not know if I can call R
functions from RcppArrayFire, either, as it happens with RcppParallel). Is
it possible to use both parallel calculations and GPU calculations by using
Rcpp and its relatives?

I know my questions are not Rcpp per se, but they take into account other,
related packages. But I think there is no "devel distribution list" for
these other packages, so for this reason I ask here.

So, my question is: how do you use Rcpp in relation to parallel and GPU
calculations? Do you use Rcpp single threaded, and then do parallel from R?
Or do you use RcppParallel and / or RcppArrayFire? If so, how do you cope
with the "loss" of not being able to call R functions? And also if so, is
it possible that RcppParallel and RcppArrayFire work together?

Thank you in advance for your guidance.

Jordi Molins i Coronado
+34 69 38 000 59
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20180922/963ef09d/attachment.html>


More information about the Rcpp-devel mailing list