cf4ocl (C Framework for OpenCL)
v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
|
The memory object wrapper module provides functionality for simple handling of generic OpenCL memory objects. More...
Data Structures | |
struct | ccl_memobj |
Base class for memory object wrappers, i.e., CCLBuffer and CCLImage. More... | |
Macros | |
#define | ccl_memobj_get_info(mo, param_name, err) |
Get a CCLWrapperInfo memory object information object. More... | |
#define | ccl_memobj_get_info(mo, param_name, err) |
Get a CCLWrapperInfo memory object information object. More... | |
#define | ccl_memobj_get_info_array(mo, param_name, param_type, err) |
Macro which returns an array memory object information value. More... | |
#define | ccl_memobj_get_info_array(mo, param_name, param_type, err) |
Macro which returns an array memory object information value. More... | |
#define | ccl_memobj_get_info_scalar(mo, param_name, param_type, err) |
Macro which returns a scalar memory object information value. More... | |
#define | ccl_memobj_get_info_scalar(mo, param_name, param_type, err) |
Macro which returns a scalar memory object information value. More... | |
#define | ccl_memobj_ref(mo) ccl_wrapper_ref((CCLWrapper*) mo) |
Increase the reference count of the cl_mem wrapper object. More... | |
#define | ccl_memobj_ref(mo) ccl_wrapper_ref((CCLWrapper*) mo) |
Increase the reference count of the cl_mem wrapper object. More... | |
#define | ccl_memobj_unwrap(mo) ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) mo)) |
Get the OpenCL cl_mem object. More... | |
#define | ccl_memobj_unwrap(mo) ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) mo)) |
Get the OpenCL cl_mem object. More... | |
Typedefs | |
typedef void(* | ccl_memobj_destructor_callback )(cl_mem memobj, void *user_data) |
Prototype for memory object destructor callback functions. More... | |
typedef void(* | ccl_memobj_destructor_callback )(cl_mem memobj, void *user_data) |
Prototype for memory object destructor callback functions. More... | |
typedef struct ccl_memobj | CCLMemObj |
Base class for memory object wrappers, i.e., CCLBuffer and CCLImage. | |
Functions | |
CCLEvent * | ccl_memobj_enqueue_migrate (CCLMemObj **mos, cl_uint num_mos, CCLQueue *cq, cl_mem_migration_flags flags, CCLEventWaitList *evt_wait_lst, CCLErr **err) |
Enqueues a command to indicate which device a set of memory objects should be associated with. More... | |
CCLEvent * | ccl_memobj_enqueue_unmap (CCLMemObj *mo, CCLQueue *cq, void *mapped_ptr, CCLEventWaitList *evt_wait_lst, CCLErr **err) |
Enqueues a command to unmap a previously mapped region of a memory object. More... | |
cl_uint | ccl_memobj_get_opencl_version (CCLMemObj *mo, CCLErr **err) |
Get the OpenCL version of the platform associated with this memory object. More... | |
cl_bool | ccl_memobj_set_destructor_callback (CCLMemObj *mo, ccl_memobj_destructor_callback pfn_notify, void *user_data, CCLErr **err) |
Wrapper for OpenCL clSetMemObjectDestructorCallback() function. More... | |
The memory object wrapper module provides functionality for simple handling of generic OpenCL memory objects.
All the functions in this module are direct wrappers of the respective OpenCL memory object functions, with the exception of ccl_memobj_get_opencl_version(), which returns the OpenCL version of the platform associated with the memory object.
For specific buffer and image handling, see the buffer wrapper and image wrapper modules.
Information about memory objects can be fetched using the memory object info macros:
#define ccl_memobj_get_info | ( | mo, | |
param_name, | |||
err | |||
) |
Get a CCLWrapperInfo memory object information object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 110 of file ccl_memobj_wrapper.h.
#define ccl_memobj_get_info | ( | mo, | |
param_name, | |||
err | |||
) |
Get a CCLWrapperInfo memory object information object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 110 of file ccl_memobj_wrapper.h.
#define ccl_memobj_get_info_array | ( | mo, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns an array memory object information value.
Use with care. In case an error occurs, NULL is returned, which might be ambiguous if NULL is a valid return value. In this case, it is necessary to check the error object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get value of. |
[in] | param_type | Type of parameter (e.g. char*, size_t*, etc.). |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 150 of file ccl_memobj_wrapper.h.
#define ccl_memobj_get_info_array | ( | mo, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns an array memory object information value.
Use with care. In case an error occurs, NULL is returned, which might be ambiguous if NULL is a valid return value. In this case, it is necessary to check the error object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get value of. |
[in] | param_type | Type of parameter (e.g. char*, size_t*, etc.). |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 150 of file ccl_memobj_wrapper.h.
#define ccl_memobj_get_info_scalar | ( | mo, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns a scalar memory object information value.
Use with care. In case an error occurs, zero is returned, which might be ambiguous if zero is a valid return value. In this case, it is necessary to check the error object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get value of. |
[in] | param_type | Type of parameter (e.g. cl_uint, size_t, etc.). |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 130 of file ccl_memobj_wrapper.h.
#define ccl_memobj_get_info_scalar | ( | mo, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns a scalar memory object information value.
Use with care. In case an error occurs, zero is returned, which might be ambiguous if zero is a valid return value. In this case, it is necessary to check the error object.
[in] | mo | The memory object wrapper object. |
[in] | param_name | Name of information/parameter to get value of. |
[in] | param_type | Type of parameter (e.g. cl_uint, size_t, etc.). |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 130 of file ccl_memobj_wrapper.h.
#define ccl_memobj_ref | ( | mo | ) | ccl_wrapper_ref((CCLWrapper*) mo) |
Increase the reference count of the cl_mem wrapper object.
[in] | mo | The cl_mem wrapper object. |
Definition at line 159 of file ccl_memobj_wrapper.h.
#define ccl_memobj_ref | ( | mo | ) | ccl_wrapper_ref((CCLWrapper*) mo) |
Increase the reference count of the cl_mem wrapper object.
[in] | mo | The cl_mem wrapper object. |
Definition at line 159 of file ccl_memobj_wrapper.h.
#define ccl_memobj_unwrap | ( | mo | ) | ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) mo)) |
Get the OpenCL cl_mem object.
[in] | mo | The cl_mem wrapper object. |
Definition at line 168 of file ccl_memobj_wrapper.h.
#define ccl_memobj_unwrap | ( | mo | ) | ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) mo)) |
Get the OpenCL cl_mem object.
[in] | mo | The cl_mem wrapper object. |
Definition at line 168 of file ccl_memobj_wrapper.h.
typedef void( * ccl_memobj_destructor_callback)(cl_mem memobj, void *user_data) |
Prototype for memory object destructor callback functions.
[in] | memobj | The OpenCL memory object for which the callback function is associated. |
[in] | user_data | A pointer to user supplied data. |
Definition at line 72 of file ccl_memobj_wrapper.h.
typedef void( * ccl_memobj_destructor_callback)(cl_mem memobj, void *user_data) |
Prototype for memory object destructor callback functions.
[in] | memobj | The OpenCL memory object for which the callback function is associated. |
[in] | user_data | A pointer to user supplied data. |
Definition at line 72 of file ccl_memobj_wrapper.h.
CCLEvent * ccl_memobj_enqueue_migrate | ( | CCLMemObj ** | mos, |
cl_uint | num_mos, | ||
CCLQueue * | cq, | ||
cl_mem_migration_flags | flags, | ||
CCLEventWaitList * | evt_wait_lst, | ||
CCLErr ** | err | ||
) |
Enqueues a command to indicate which device a set of memory objects should be associated with.
Wrapper for OpenCL clEnqueueMigrateMemObjects() function.
[in] | mos | A pointer to a list of memory object wrappers. |
[in] | num_mos | The number of memory objects specified in mos . |
[in] | cq | A command queue wrapper object. |
[in] | flags | Migration options |
[in,out] | evt_wait_lst | List of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 310 of file ccl_memobj_wrapper.c.
CCLEvent * ccl_memobj_enqueue_unmap | ( | CCLMemObj * | mo, |
CCLQueue * | cq, | ||
void * | mapped_ptr, | ||
CCLEventWaitList * | evt_wait_lst, | ||
CCLErr ** | err | ||
) |
Enqueues a command to unmap a previously mapped region of a memory object.
This function wraps the clEnqueueUnmapMemObject() OpenCL function.
[in] | mo | A memory object wrapper object. |
[in] | cq | A command queue wrapper object. |
[in] | mapped_ptr | The host address returned by a previous call to ccl_buffer_enqueue_map() or ccl_image_enqueue_map() for mo . |
[in,out] | evt_wait_lst | List of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 142 of file ccl_memobj_wrapper.c.
Get the OpenCL version of the platform associated with this memory object.
The version is returned as an integer, in the following format:
[in] | mo | A memory object wrapper object. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 79 of file ccl_memobj_wrapper.c.
cl_bool ccl_memobj_set_destructor_callback | ( | CCLMemObj * | mo, |
ccl_memobj_destructor_callback | pfn_notify, | ||
void * | user_data, | ||
CCLErr ** | err | ||
) |
Wrapper for OpenCL clSetMemObjectDestructorCallback() function.
[in] | mo | A memory object wrapper object. |
[in] | pfn_notify | The callback function that can be registered by the application. |
[in] | user_data | A pointer to user supplied data. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
CL_TRUE
if device if operation completes successfully, CL_FALSE
otherwise. Definition at line 213 of file ccl_memobj_wrapper.c.