![]() |
![]() |
![]() |
Gocl - Documentation and Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
struct GoclKernel; struct GoclKernelClass; cl_kernel gocl_kernel_get_kernel (GoclKernel *self
); gboolean gocl_kernel_set_argument (GoclKernel *self
,guint index
,gsize size
,const gpointer *buffer
); gboolean gocl_kernel_set_argument_int32 (GoclKernel *self
,guint index
,gsize num_elements
,gint32 *buffer
); gboolean gocl_kernel_set_argument_float (GoclKernel *self
,guint index
,gsize num_elements
,gfloat *buffer
); gboolean gocl_kernel_set_argument_buffer (GoclKernel *self
,guint index
,GoclBuffer *buffer
); gboolean gocl_kernel_run_in_device_sync (GoclKernel *self
,GoclDevice *device
,GList *event_wait_list
); GoclEvent * gocl_kernel_run_in_device (GoclKernel *self
,GoclDevice *device
,GList *event_wait_list
); void gocl_kernel_set_work_dimension (GoclKernel *self
,guint8 work_dim
); void gocl_kernel_set_global_work_size (GoclKernel *self
,gsize size1
,gsize size2
,gsize size3
); void gocl_kernel_set_local_work_size (GoclKernel *self
,gsize size1
,gsize size2
,gsize size3
);
"name" gchar* : Read / Write / Construct Only "program" GoclProgram* : Read / Write / Construct Only
A GoclKernel object represents a special type of functions in OpenCL programs, that allows for host code to set its arguments and invoke the function.
A GoclKernel is not created directly. Instead, it is obtained from a
GoclProgram by calling gocl_program_get_kernel()
method.
Before a kernel object can be executed, all its arguments must be set.
Several methods are provided for this purpose, and depending on the type
of the argument to set, one or other is used.
gocl_kernel_set_argument()
, gocl_kernel_set_argument_int32()
and
gocl_kernel_set_argument_buffer()
are examples of such methods.
More will be added soon.
Once all arguments are set, the kernel is ready to be executed on a device.
For this, the gocl_kernel_run_in_device()
is used for non-blocking execution,
and gocl_kernel_run_in_device_sync()
for a blocking version. Notice that
these methods will use the device's default command queue. In the future,
methods will be provided to run the kernel on arbitrary command queues
as well.
struct GoclKernelClass { GObjectClass parent_class; };
The class for GoclKernel objects.
cl_kernel gocl_kernel_get_kernel (GoclKernel *self
);
Retrieves the internal OpenCL cl_kernel object. This is not normally called by applications. It is rather a low-level, internal API.
|
The GoclKernel |
Returns : |
The internal cl_kernel object. [transfer none][type guint64] |
gboolean gocl_kernel_set_argument (GoclKernel *self
,guint index
,gsize size
,const gpointer *buffer
);
Sets the value of the kernel argument at index
, as an arbitrary block of
memory.
|
The GoclKernel |
|
The index of this argument in the kernel function |
|
The size of buffer , in bytes |
|
A pointer to an arbitrary block of memory |
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument_int32 (GoclKernel *self
,guint index
,gsize num_elements
,gint32 *buffer
);
Sets the value of the kernel argument at index
, as an array of int32.
|
The GoclKernel |
|
The index of this argument in the kernel function |
|
The number of int32 elements in buffer
|
|
Array of int32 values. [array length=num_elements][element-type guint32] |
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument_float (GoclKernel *self
,guint index
,gsize num_elements
,gfloat *buffer
);
Sets the value of the kernel argument at index
, as an array of floats.
|
The GoclKernel |
|
The index of this argument in the kernel function |
|
The number of float elements in buffer
|
|
Array of float values. [array length=num_elements][element-type gfloat] |
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument_buffer (GoclKernel *self
,guint index
,GoclBuffer *buffer
);
Sets the value of the kernel argument at index
, as a buffer object.
|
The GoclKernel |
|
The index of this argument in the kernel function |
|
A GoclBuffer |
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_run_in_device_sync (GoclKernel *self
,GoclDevice *device
,GList *event_wait_list
);
Runs the kernel on the specified device, blocking the program
until the kernel execution finishes. For non-blocking version,
gocl_kernel_run_in_device()
is provided.
If event_wait_list
is provided, the kernel execution will start
only when all the events in the list have triggered.
|
The GoclKernel |
|
A GoclDevice to run the kernel on |
|
List of GoclEvent
events to wait for, or NULL . [element-type Gocl.Event][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
GoclEvent * gocl_kernel_run_in_device (GoclKernel *self
,GoclDevice *device
,GList *event_wait_list
);
Runs the kernel on the specified device, asynchronously. A GoclEvent is returned, and can be used to get notified when the execution finishes, or as wait event input to other operations on the device.
If event_wait_list
is provided, the kernel execution will start
only when all the events in the list have triggered.
|
The GoclKernel |
|
A GoclDevice to run the kernel on |
|
List of GoclEvent
events to wait for, or NULL . [element-type Gocl.Event][allow-none]
|
Returns : |
A GoclEvent to get notified when execution finishes. [transfer none] |
void gocl_kernel_set_work_dimension (GoclKernel *self
,guint8 work_dim
);
Sets the work dimension (1, 2, 3) to use when executing the kernel.
|
The GoclKernel |
|
The work dimension |
void gocl_kernel_set_global_work_size (GoclKernel *self
,gsize size1
,gsize size2
,gsize size3
);
Sets the global work sizes to use when executing the kernel, corresponding to the first, second, and third dimensions, respectively. By default, the sizes are all zeros.
If the size1
value is zero, it means no global work size is specified and
NULL
will be used when enqueuing the kernel.
|
The GoclKernel |
|
global work size for the first dimension |
|
global work size for the second dimension |
|
global work size for the third dimension |
void gocl_kernel_set_local_work_size (GoclKernel *self
,gsize size1
,gsize size2
,gsize size3
);
Sets the local work sizes to use when executing the kernel, corresponding to the first, second, and third dimensions, respectively. By default, the sizes are all zeros.
If the size1
value is zero, it means no local work size is specified and
NULL
will be used when enqueuing the kernel.
|
The GoclKernel |
|
local work size for the first dimension |
|
local work size for the second dimension |
|
local work size for the third dimension |
"name"
property "name" gchar* : Read / Write / Construct Only
The name of the kernel function.
Default value: NULL
"program"
property"program" GoclProgram* : Read / Write / Construct Only
The program owning this kernel.