Displaying 1 result from an estimated 1 matches for "resout_ptr".
2012 Jul 21
3
Use GPU in R with .Call
...***********************/
/* "VecAdd_cuda.c" adds two double vectors using GPU. */
/************************************************/
extern void vecAdd_kernel(double *ain,double *bin,double *cout,int len);
SEXP VecAdd_cuda(SEXP a,SEXP b) {
int len;
double *a_ptr,*b_ptr,*resout_ptr;
/*Digest R objects*/
len=length(a);
a_ptr=REAL(a);
b_ptr=REAL(b);
SEXP resout;
PROTECT(resout=allocVector(REALSXP,len));
resout_ptr=REAL(resout);
vecAdd_kernel(a_ptr,b_ptr,resout_ptr,len);
UNPROTECT(1);
return resout;
}
(b) Next, the host function and the kernel are in a *SEP...