search for: cudafree

Displaying 3 results from an estimated 3 matches for "cudafree".

2012 Jul 21
3
Use GPU in R with .Call
...*/ VecAdd<<<(len+THREAD_PER_BLOCK-1)/THREAD_PER_BLOCK,THREAD_PER_BLOCK>>>(a_copy,b_copy,cout_copy,len); /*Step 2) Copy result back to host.*/ cudaMemcpy(cout,cout_copy,alloc_size,cudaMemcpyDeviceToHost); /*Step 3) Deallocate memory for device copies.*/ cudaFree(a_copy); cudaFree(b_copy); cudaFree(cout_copy); /*Step 4) Get rid of the cuda context,necessary to avoid segfault when R exits.*/ cudaThreadExit(); } (c) Lastly, I wrote a R wrapper function called "VecAdd_cuda.R" as below. ======================file VecAdd_cuda.R&...
2016 May 14
2
R external pointer and GPU memory leak problem
...for R external pointer input is R external pointer, function will finalize the pointer? when it is not in use. */ static void _finalizer(SEXP ext) { if (!R_ExternalPtrAddr(ext)) return; ? ? ? ?double * ptr= (double *) R_ExternalPtrAddr(ext); Rprintf("finalizer invoked once \n"); cudacall(cudaFree(ptr)); R_ClearExternalPtr(ext); } My create function can run smoothly, but if I run the create function too many times, it shows out of memory for my GPU device, which clearly implies memory leak problem. Can anybody help? Help alot in advance!?
2010 Nov 08
0
Segmentation Fault when using CUDA
...nd 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; cudaMalloc(&_a,sizeof(char)); cudaFree(_a); _a=NULL; } --- 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....