Re: [R] Help needed using 3rd party C library/functions from within R (Nvidia CUDA)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 04 Nov 2008 13:16:22 +0000 (GMT)

Please see the R posting guide (the footer of this and every R-help message).

But look at nm -g myFunc.so to see what symbols are exported.

Please post any follow-up help request on R-devel, with as far as possible a completely reproducible example.

On Tue, 4 Nov 2008, MarcelK wrote:

>
> 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.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 04 Nov 2008 - 13:22:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Nov 2008 - 14:00:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive