Gocl - Documentation and Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
struct GoclProgram; struct GoclProgramClass; void gocl_program_build (GoclProgram *self
,const gchar *options
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gocl_program_build_finish (GoclProgram *self
,GAsyncResult *result
,GError **error
); gboolean gocl_program_build_sync (GoclProgram *self
,const gchar *options
,GError **error
); GoclContext * gocl_program_get_context (GoclProgram *self
); GoclKernel * gocl_program_get_kernel (GoclProgram *self
,const gchar *kernel_name
,GError **error
); cl_program gocl_program_get_program (GoclProgram *self
); GoclProgram * gocl_program_new (GoclContext *context
,const gchar **sources
,guint num_sources
,GError **error
);
A GoclProgram allows to transform OpenCL source code into kernel objects that can run on OpenCL runtimes.
A GoclProgram is created with gocl_program_new()
, provinding a
null-terminated array of strings, each one representing OpenCL source code.
Currently, creating a program from pre-compiled, binary code is not supported,
but will be in the future.
Once a program is created, it needs to be built before kernels can be created
from it. To build a program asynchronously, gocl_program_build()
and
gocl_program_build_finish()
methods are provided. For building synchronously,
gocl_program_build_sync()
is used.
Once a program is successfully built, kernels can be obtained from it using
gocl_program_get_kernel()
method.
struct GoclProgramClass { GObjectClass parent_class; };
The class for GoclProgram objects.
GObjectClass |
The parent class |
void gocl_program_build (GoclProgram *self
,const gchar *options
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Builds the program using the build options specified in
options
. This method is non-blocking. If callback
is provided, it will
be called when the operation completes, and gocl_program_build_finish()
can be used within the callback to retrieve the result of the operation.
A GCancellable object can be passed in cancellable
to allow cancelling
the operation.
|
The GoclProgram |
|
A string specifying OpenCL program build options |
|
A GCancellable object, or NULL . [allow-none]
|
|
Callback to be called upon completion, or NULL . [allow-none]
|
|
Arbitrary data to pass in callback , or NULL . [allow-none]
|
gboolean gocl_program_build_finish (GoclProgram *self
,GAsyncResult *result
,GError **error
);
Retrieves the result of a gocl_program_build()
asynchronous operation.
On error, FALSE
is returned and error
is filled accordingly.
|
The GoclProgram |
|
The GAsyncResult object from callback's arguments |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, or FALSE on error |
gboolean gocl_program_build_sync (GoclProgram *self
,const gchar *options
,GError **error
);
Builds the program using the build options specified in
options
. This method is blocking. For an asynchronous version,
gocl_program_build()
is provided. On error, FALSE
is returned and
error
is filled accordingly.
A detailed description of the build options is available at Kronos documentation website: http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clBuildProgram.html
|
The GoclProgram |
|
A string specifying OpenCL program build options |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success or FALSE on error |
GoclContext * gocl_program_get_context (GoclProgram *self
);
Obtain the GoclContext the program belongs to.
|
The GoclProgram |
Returns : |
A GoclContext. The returned object is owned by the program, do not free. [transfer none] |
GoclKernel * gocl_program_get_kernel (GoclProgram *self
,const gchar *kernel_name
,GError **error
);
Creates and retrieves a new GoclKernel object from a kernel function
in the source code, specified by kernel_name
string. Upon success,
a new GoclKernel is returned, otherwise NULL
is returned and error
is filled accordingly.
|
The GoclProgram |
|
A string representing the name of a kernel function |
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
A newly created GoclKernel object. [transfer full] |
cl_program gocl_program_get_program (GoclProgram *self
);
Retrieves the OpenCL internal cl_program object. This is not normally called by applications. It is rather a low-level, internal API.
|
The GoclProgram |
Returns : |
The internal cl_program. [transfer none][type guint64] |
GoclProgram * gocl_program_new (GoclContext *context
,const gchar **sources
,guint num_sources
,GError **error
);
Creates and returns a new GoclProgram. Upon error, NULL
is returned and
error
is filled accordingly.
|
The GoclContext |
|
Array of source code null-terminated strings. [array length=num_sources][type utf8] |
|
The number of elements in sources
|
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
A newly created GoclProgram. [transfer full] |