oclSimpleKernel creates a kernel object by compiling the supplied
code. The kernel can them be used in
Device (element of the list returned by
Name of the kernel function - must match the name used in the supplied code.
character vector containg the code. The code will be concatenated (as-is, no newlines are added!) by the engine.
precision of all floating-point arguments in the
kernel. Note that R uses only double-precision floating point
representation, so single-precision computation requires temporary
conversion of all input and output values and thus has significant
overhead. However, not all devices support double-precision
computation. If "best" is used then the kernel code is expected to
use single-precision but it will be automatically augmented to
double-precision (by replacing words "float" with "double" in the
code and adding the
oclSimpleKernel creates a new OpenCL context, then creates and
builds the program specified by code and finally 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* for the output
and the second argument must be
const int for the length of the
output vector. 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.
Kernel object that can be used by
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.