On 29/05/2015 9:52 AM, Charles Determan wrote:
I am actively working on an R package that will incorporate some CUDA code
for using NVIDIA GPU devices.  I am quite familiar with Rcpp for C++ code
and accustomed to using a Makevars file for specifying compiler options.
However I am stumped currently about how to use the NVCC compiler for the
.cu files.

Typically, a CUDA program will first be compiled with NVCC and the linked
with any other .o files.

# very simplified example
nvcc my_cuda_function.cu -o my_cuda_function.o
g++ -o my_program.so other_cpp_function.o my_cuda_function.o

I have seem some older packages using a Makefile but I have also read that
this is currently recommended against because of the need for multiarch
builds.

Does anyone know how I can tell R to compile .cu files with NVCC and
'proceed as normal' with the resulting .o files?

You can include the recipes for those .o files in your Makevars file. It is essentially a fragment of the full Makefile needed by your package. I forget if you'll need to give an explicit recipe for the library, or whether the standard file will link them in. Try it!

Duncan Murdoch

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to