Displaying 1 result from an estimated 1 matches for "vecadd_kernel".
2012 Jul 21
3
Use GPU in R with .Call
...) as below.
=================file VecAdd_cuda.c===================
#include <R.h>
#include <Rinternal.h>
/************************************************/
/* "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);...