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
The relevant C++ code is
char * _a;
--- from gpu.cu
cat("testing allocation on gpu\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?
Links to files: