compileGPUCode {gpuMagic} | R Documentation |
Compile the R function without excute it in the device.
compileGPUCode( X, FUN, ..., .macroParms = NULL, .options = gpuSapply.getOption() )
X |
a vector that |
FUN |
The function to be applied to each element of |
... |
optional arguments to |
.macroParms |
The function argument that will be treated as macro in the code. If an argument is treated as macro, its value cannot be changed by the code |
.options |
The package and openCL compilation options, please call |
A list of compilation information
#matrix add function matAdd = function(ind,A,B){ C = A[,ind]+B[,ind] return(C) } n = 100 m = 200 #Create the data A = matrix(runif(n*m),n,m) B = matrix(runif(n*m),n,m) #Compile the R code res = compileGPUCode(1:m,matAdd,A,B) #print GPU code cat(res$gpu_code)