[R] Help needed using 3rd party C library/functions from within R (Nvidia CUDA)
MarcelK
m_kempenaar at planet.nl
Tue Nov 4 13:55:25 CET 2008
Hello,
I'm trying to combine the parallel computing power available through NVIDIA
CUDA (www.nvidia.com/cuda) from within R. CUDA is an extension to the C
language, so I thought it would be possible to do this.
If I have a C file with an empty function which includes a needed CUDA
library (cutil.h) and compile this to an .so file using a NVIDIA compiler
(nvcc), called 'myFunc.so' I can load this fine from within R with
dyn.load("myFunc.so").
But, as soon as I want to call it's function I get:
> dyn.load("myFunc.so")
> .C("testFunc")
Error in .C("testFunc") : C symbol name "testFunc" not in load table
The myFunc.c file looks like this:
#include<cutil.h>
#include<stdio.h>
#include<stdlib.h>
#include<R.h>
void testFunc() {
printf("Hello!\n");
}
The problem is that NVIDIA has their own C compiler (nvcc) which is needed
to compile code for their devices. This compiler calls 'gcc' (or Windows C
compiler) for all standard C code, so setting the 'CC = nvcc' might still
work when using 'R CMD SHLIB' to compile C files to shared libraries. But as
far as I know, if I use the same flags R CMD SHLIB uses (nvcc passes them to
gcc) it should work..
Can anyone point me in the right direction?
Thanks in advance.
--
View this message in context: http://www.nabble.com/Help-needed-using-3rd-party-C-library-functions-from-within-R-%28Nvidia-CUDA%29-tp20321716p20321716.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list