[Rd] Segmentation Fault when using CUDA

From: Andrew Redd <amredd_at_gmail.com>
Date: Mon, 08 Nov 2010 14:02:18 -0700

I'm developing packages with CUDA, and I'm running into a problem with memory allocation. Since CUDA involves memory on the GPU device it requires that the program handle memory allocation and deallocation separately from R.

The simplest case of allocating a char and then deallocating causes a segmentation fault when R closes. Not on garbage collection but only on exit. Is there anything in the R internals that explain why this is happening?

The relevant C++ code is

void gpualloctest(){
       char * _a;

--- from gpu.cu gputest<-function(){ cat("testing allocation on gpu\n") Module('test','gputest')$gpualloctest() cat("Test successful\n") cat("Collecting Garbage\n") gc() cat("done.\n")
--- from gputest.R As you can see Rcpp is used to interface with the C++ code, but the Rcpp is not the problem, but happened to be convenient to use to get the configure scripts right for the CUDA cu files. The results from running "valgrind Rscript testgpu.R" are linked to in testgpu.log but do not show anything interesting. Can anyone give any insight? Thanks, Andrew Redd Links to files: http://andrewredd.us/gputest/testgpu.R http://andrewredd.us/gputest/testgpu.Rout http://andrewredd.us/gputest/gputest_1.0.tar.gz http://andrewredd.us/gputest/testgpu.log ______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 08 Nov 2010 - 22:17:10 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 09 Nov 2010 - 09:30:19 GMT.

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

list of date sections of archive