OpenCL kernels allow the use of local memory which is shared by all
work-items of a work-group. In most cases, such memory is allocated inside
the kernel at compile time such as __local numeric temp[GROUP_SIZE].
However, in some rare circumstances it may be desirable to allocate
the buffer dynamically as an argument to the kernel. In that case the
corresponding argument of the kernel is defined with the
__local keyword and the caller has to specify the size of the
local memory buffer at run-time when calling the kernel.
The clLocal() function creates a specification of the local
memory buffer. It is the only object that may be passed to a kernel
argument declared with __local. The object is merely a
specification that oclRun knows how to interpret,
clLocal doesn't actually allocate any memory.
By default, size is interpreted as bytes, but for convenience
it can also specify the number of elements of a particular type. In
the special case of "numeric" the actual size of one element
(and thus the total buffer size) will depend on the context in which
this specification is used (single or double precision).
With is.clLocal one can check if an object is a local buffer
specification.
The methods length.clLocal and print.clLocal retrieve
the length (number of elements) and print the contents, respectively.
clLocal(length, mode = c("byte", "numeric", "single", "double", "integer"))
is.clLocal(x)
# S3 method for clLocal
print(x, ...)
# S3 method for clLocal
length(x)clLocal returns an object of the class "cLocal"
is.clLocal return TRUE for "clLocal" objects and
FALSE otherwise.
print method returns x invisibly.
length returns a numeric scalar with the length (number of
elements) in the buffer specification.
numeric, length (number of elements) of the required
buffer. The actual size will depend on mode.
string, mode of the buffer (only used to compute the total
size in bytes). The default is to treat length as the size in
bytes (i.e., "byte" is aways allowed irrespective of the type
of the kernel argument).
object
Ignored
Simon Urbanek
oclRun