29 #ifndef _CCL_CONTEXT_WRAPPER_H_
30 #define _CCL_CONTEXT_WRAPPER_H_
126 const char* errinfo,
const void* private_info,
size_t cb,
142 #define ccl_context_new_from_filters(filters, err) \
143 ccl_context_new_from_filters_full( \
144 NULL, (filters), NULL, NULL, (err))
158 #define ccl_context_new_from_devices(num_devices, devices, err) \
159 ccl_context_new_from_devices_full( \
160 NULL, (num_devices), (devices), NULL, NULL, (err))
172 #define ccl_context_new_cpu(err) \
173 ccl_context_new_from_indep_filter( \
174 ccl_devsel_indep_type_cpu, NULL, (err))
186 #define ccl_context_new_gpu(err) \
187 ccl_context_new_from_indep_filter( \
188 ccl_devsel_indep_type_gpu, NULL, (err))
200 #define ccl_context_new_accel(err) \
201 ccl_context_new_from_indep_filter( \
202 ccl_devsel_indep_type_accel, NULL, (err))
214 #define ccl_context_new_any(err) \
215 ccl_context_new_from_indep_filter(NULL, NULL, (err))
232 #define ccl_context_new_from_indep_filter(filter, data, err) \
233 ccl_context_new_from_filter(CCL_DEVSEL_INDEP, (filter), (data), (err))
251 #define ccl_context_new_from_dep_filter(filter, data, err) \
252 ccl_context_new_from_filter(CCL_DEVSEL_DEP, (filter), (data), (err))
265 #define ccl_context_new_from_device_index(data, err) \
266 ccl_context_new_from_dep_filter(ccl_devsel_dep_index, (data), (err))
277 #define ccl_context_new_from_menu_full(data, err) \
278 ccl_context_new_from_dep_filter(ccl_devsel_dep_menu, (data), (err))
287 #define ccl_context_new_from_menu(err) \
288 ccl_context_new_from_dep_filter(ccl_devsel_dep_menu, NULL, (err))
301 const cl_context_properties* properties, cl_uint num_devices,
303 void* user_data,
CCLErr** err);
309 void* filter,
void* data,
CCLErr** err);
327 CCLContext* ctx, cl_mem_flags flags, cl_mem_object_type image_type,
328 cl_uint* num_image_formats,
CCLErr** err);
355 #define ccl_context_get_info(ctx, param_name, err) \
356 ccl_wrapper_get_info((CCLWrapper*) ctx, NULL, param_name, 0, \
357 CCL_INFO_CONTEXT, CL_FALSE, err)
375 #define ccl_context_get_info_scalar(ctx, param_name, param_type, err) \
376 *((param_type*) ccl_wrapper_get_info_value((CCLWrapper*) ctx, \
377 NULL, param_name, sizeof(param_type), \
378 CCL_INFO_CONTEXT, CL_FALSE, err))
396 #define ccl_context_get_info_array(ctx, param_name, param_type, err) \
397 (param_type) ccl_wrapper_get_info_value((CCLWrapper*) ctx, \
398 NULL, param_name, sizeof(param_type), \
399 CCL_INFO_CONTEXT, CL_FALSE, err)
405 #define ccl_context_ref(ctx) \
406 ccl_wrapper_ref((CCLWrapper*) ctx)
414 #define ccl_context_unref(ctx) \
415 ccl_context_destroy(ctx)
423 #define ccl_context_unwrap(ctx) \
424 ((cl_context) ccl_wrapper_unwrap((CCLWrapper*) ctx))
void ccl_context_destroy(CCLContext *ctx)
Decrements the reference count of the context wrapper object.
Classes and functions for filtering and selecting OpenCL contexts and associated devices.
CCLDevice *const * ccl_context_get_all_devices(CCLContext *ctx, CCLErr **err)
Get all device wrappers in context.
CCLPlatform * ccl_context_get_platform(CCLContext *ctx, CCLErr **err)
Get the platform associated with the context devices.
Definition of a wrapper class and its methods for OpenCL device objects.
const cl_image_format * ccl_context_get_supported_image_formats(CCLContext *ctx, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint *num_image_formats, CCLErr **err)
Get the list of image formats supported by a given context.
CCLContext * ccl_context_new_from_devices_full(const cl_context_properties *properties, cl_uint num_devices, CCLDevice *const *devices, ccl_context_callback pfn_notify, void *user_data, CCLErr **err)
Creates a context wrapper given an array of CCLDevice wrappers and the remaining parameters required ...
CCLContext * ccl_context_new_from_filter(CCLDevSelFilterType ftype, void *filter, void *data, CCLErr **err)
Creates a context wrapper using one device filter specified in the function parameters.
The context wrapper class.
CCLDevice * ccl_context_get_device(CCLContext *ctx, cl_uint index, CCLErr **err)
Get CCLDevice wrapper at given index.
CCLContext * ccl_context_new_wrap(cl_context context)
Get the context wrapper for the given OpenCL context.
cl_uint ccl_context_get_opencl_version(CCLContext *ctx, CCLErr **err)
Get the OpenCL version of the platform associated with this context.
void(* ccl_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data)
A callback function used by the OpenCL implementation to report information on errors during context ...
GPtrArray * CCLDevSelFilters
A set of independent and dependent device filters.
Header for normalizing OpenCL versions within cf4ocl.
enum ccl_devsel_filter_type CCLDevSelFilterType
Filter type.
GError CCLErr
Error handling class.
Common cf4ocl definitions.
cl_uint ccl_context_get_num_devices(CCLContext *ctx, CCLErr **err)
Return number of devices in context.
Convert OpenCL error codes to readable strings (function header).
CCLContext * ccl_context_new_from_filters_full(const cl_context_properties *properties, CCLDevSelFilters *filters, ccl_context_callback pfn_notify, void *user_data, CCLErr **err)
Create a new context wrapper object selecting devices using the given set of filters.