[Rcpp-devel] NVCC compatibility

Charles Determan cdetermanjr at gmail.com
Tue Jan 9 16:25:22 CET 2018


Greetings,

I have been exploring GPU implementations for R.  Primarily I have been
using OpenCL given it is so portable and everyone can use it without being
tied to NVIDIA.  That said, NVIDIA hardware is difficult to beat and
creating packages that leverage are arguably valuable (e.g. gputools,
gmatrix).  In my efforts to explore how to best develop these types of
packages I must use NVCC but I also would like to continue leveraging
Rcpp.  Normally, any compilation with NVCC would results in the following
warnings and error when including Rcpp.h.

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/r_cast.h(121): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/r_cast.h(74): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/vector_from_string.h(42):
warning: statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/r_cast.h(54): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/r_cast.h(74): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/r_cast.h(121): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Environment.h(97): warning:
statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/vector_from_string.h(42):
warning: statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/Vector.h(324):
warning: statement is unreachable

/usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/proxy.h(99): error:
the object has type qualifiers that are not compatible with the member
function "Rcpp::internal::string_name_proxy<RTYPE>::get"
            object type is: const Rcpp::internal::string_name_proxy<RTYPE>


I stumbled upon another github user's package that tries to address this by
a small modification in Rcpp.  You can see it here (
https://github.com/jtilly/RcppThrust) were the user notes that removing the
'const' in line 98 of Rcpp/vector/proxy.h allows the compilation to succeed
(although the warnings continue).

Does anyone have any thoughts regarding this modification?  Would changing
that line cause any issues?  I'm not sure about the warnings at the moment
but at least nvcc and Rcpp could be used in concert.

Regards,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20180109/e216e58d/attachment.html>


More information about the Rcpp-devel mailing list