Gocl - Documentation and Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
struct GoclKernel; struct GoclKernelClass; cl_kernel gocl_kernel_get_kernel (GoclKernel *self
); GoclEvent * gocl_kernel_run_in_device (GoclKernel *self
,GoclDevice *device
,gsize global_work_size
,gsize local_work_size
,GList *event_wait_list
); gboolean gocl_kernel_run_in_device_sync (GoclKernel *self
,GoclDevice *device
,gsize global_work_size
,gsize local_work_size
,GList *event_wait_list
,GError **error
); gboolean gocl_kernel_set_argument (GoclKernel *self
,guint index
,gsize size
,const gpointer *buffer
,GError **error
); gboolean gocl_kernel_set_argument_buffer (GoclKernel *self
,guint index
,GoclBuffer *buffer
,GError **error
); gboolean gocl_kernel_set_argument_int32 (GoclKernel *self
,guint index
,gsize num_elements
,gint32 *buffer
,GError **error
);
"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.
GObjectClass |
The parent class |
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] |
GoclEvent * gocl_kernel_run_in_device (GoclKernel *self
,GoclDevice *device
,gsize global_work_size
,gsize local_work_size
,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 |
|
The global work group size |
|
The local work group size |
|
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] |
gboolean gocl_kernel_run_in_device_sync (GoclKernel *self
,GoclDevice *device
,gsize global_work_size
,gsize local_work_size
,GList *event_wait_list
,GError **error
);
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 |
|
The global work group size |
|
The local work group size |
|
List of GoclEvent
events to wait for, or NULL . [element-type Gocl.Event][allow-none]
|
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument (GoclKernel *self
,guint index
,gsize size
,const gpointer *buffer
,GError **error
);
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 |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument_buffer (GoclKernel *self
,guint index
,GoclBuffer *buffer
,GError **error
);
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 |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_kernel_set_argument_int32 (GoclKernel *self
,guint index
,gsize num_elements
,gint32 *buffer
,GError **error
);
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] |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
"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.