Displaying 1 result from an estimated 1 matches for "creategpu".
Did you mean:
creategep
2016 May 14
2
R external pointer and GPU memory leak problem
...a R external pointer ext based on x, and copy the cpu vector input to my gpu external pointer ext,?
/*
define function to create a vector in GPU?
by transferring a R's vector to GPU.
input is R's vector and its length,?
output is a R external pointer
pointing to GPU vector(device)
*/
SEXP createGPU(SEXP input, SEXP n)
{ ?
int *lenth = INTEGER(n);
? ? ? ?PROTECT (input = AS_NUMERIC (input));
? ? ? ?double * temp;?
? ? ? ?temp = REAL(input);
double *x; ? ? ? ? ? ? ? ##here is the step which causes the memory leak
cudacall(cudaMalloc((void**)&x, *lenth * sizeof(double)));
//protect the R ext...