oclSimpleKernel {OpenCL} | R Documentation |
Create and compile OpenCL kernel code.
Description
Creates a kernel object by compiling the supplied code.
The kernel can then be used in oclRun
.
Usage
oclSimpleKernel(context, name, code,
output.mode = c("numeric", "single", "double", "integer"))
Arguments
context |
Context (as created by |
name |
Name of the kernel function - must match the name used in the supplied code. |
code |
Character vector containing the code. The code will be concatenated (as-is, no newlines are added!) by the engine. |
output.mode |
Mode of the output argument of the kernel, as in
The kernel code may use a type |
Details
oclSimpleKernel
builds the program specified by code
and
creates a kernel from the program.
The kernel built by this function is simple in that it can have
exactly one vector output and arbitrarily many inputs. The first
argument of the kernel must be __global double*
or
__global float*
for the output and the second argument must be
const unsigned int
for the length of the output vector.
Additional numeric scalar arguments are assumed to have the same mode as the
output, i.e. if the output shall have "double" precision, then numeric scalar
arguments are assumed to be double values, similarly for single-precision.
All additional arguments are optional. See oclRun
for an
example of a simple kernel.
Note that building a kernel can take substantial amount of time (depending on the OpenCL implementation) so it is generally a good idea to compile a kernel once and re-use it many times.
Value
Kernel object that can be used by oclRun
.
Author(s)
Simon Urbanek, Aaron Puchert