compileGPUCode {gpuMagic} | R Documentation

## Compile the R function without excute it in the device.

### Description

Compile the R function without excute it in the device.

### Usage

    compileGPUCode(
      X,
      FUN,
      ...,
      .macroParms = NULL,
      .options = gpuSapply.getOption()
    )

### Arguments

`X` | a vector that `FUN` will loop over.
`FUN` | The function to be applied to each element of `X`
`...` | optional arguments to `FUN`
`.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 `gpuSapply.getOption()` to get all the available options

### Value

A list of compilation information

### Examples

    #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)

[Package gpuMagic version 1.4.0 Index]