cf4ocl (C Framework for OpenCL)
v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
|
The platform wrapper module provides functionality for simple handling of OpenCL platform objects. More...
Macros | |
#define | ccl_platform_get_info(platf, param_name, err) |
Get a CCLWrapperInfo platform information object. More... | |
#define | ccl_platform_get_info(platf, param_name, err) |
Get a CCLWrapperInfo platform information object. More... | |
#define | ccl_platform_get_info_array(platf, param_name, param_type, err) |
Macro which returns an array platform information value. More... | |
#define | ccl_platform_get_info_array(platf, param_name, param_type, err) |
Macro which returns an array platform information value. More... | |
#define | ccl_platform_get_info_scalar(platf, param_name, param_type, err) |
Macro which returns a scalar platform information value. More... | |
#define | ccl_platform_get_info_scalar(platf, param_name, param_type, err) |
Macro which returns a scalar platform information value. More... | |
#define | ccl_platform_get_info_string(platf, param_name, err) ccl_platform_get_info_array(platf, param_name, char*, err) |
Helper macro which gets a platform information string. More... | |
#define | ccl_platform_get_info_string(platf, param_name, err) ccl_platform_get_info_array(platf, param_name, char*, err) |
Helper macro which gets a platform information string. More... | |
#define | ccl_platform_ref(platform) ccl_wrapper_ref((CCLWrapper*) platform) |
Increase the reference count of the platform wrapper object. More... | |
#define | ccl_platform_ref(platform) ccl_wrapper_ref((CCLWrapper*) platform) |
Increase the reference count of the platform wrapper object. More... | |
#define | ccl_platform_unref(platform) ccl_platform_destroy(platform) |
Alias to ccl_platform_destroy(). More... | |
#define | ccl_platform_unref(platform) ccl_platform_destroy(platform) |
Alias to ccl_platform_destroy(). More... | |
#define | ccl_platform_unwrap(platform) ((cl_platform_id) ccl_wrapper_unwrap((CCLWrapper*) platform)) |
Get the OpenCL platform object. More... | |
#define | ccl_platform_unwrap(platform) ((cl_platform_id) ccl_wrapper_unwrap((CCLWrapper*) platform)) |
Get the OpenCL platform object. More... | |
Typedefs | |
typedef struct ccl_platform | CCLPlatform |
Platform wrapper class. | |
Functions | |
void | ccl_platform_destroy (CCLPlatform *platf) |
Decrements the reference count of the platform wrapper object. More... | |
CCLDevice *const * | ccl_platform_get_all_devices (CCLPlatform *platf, CCLErr **err) |
Get all device wrappers in platform. More... | |
CCLDevice * | ccl_platform_get_device (CCLPlatform *platf, cl_uint index, CCLErr **err) |
Get CCLDevice wrapper at given index. More... | |
cl_uint | ccl_platform_get_num_devices (CCLPlatform *platf, CCLErr **err) |
Return number of devices in platform. More... | |
cl_uint | ccl_platform_get_opencl_version (CCLPlatform *platf, CCLErr **err) |
Get the OpenCL version of this platform. More... | |
CCLPlatform * | ccl_platform_new_from_device (CCLDevice *dev, CCLErr **err) |
Get the platform wrapper for the given device wrapper. More... | |
CCLPlatform * | ccl_platform_new_wrap (cl_platform_id platform) |
Get the platform wrapper for the given OpenCL platform. More... | |
The platform wrapper module provides functionality for simple handling of OpenCL platform objects.
Platform wrappers can be obtained in two ways:
The provided functions allow to get the device wrappers associated with the given platform wrapper, as well as to obtain the supported OpenCL version of the underlying OpenCL platform object.
Information about platform objects can be fetched using the platform info macros:
However, because the platform info return type is always char*
, cf4ocl provides an additional helper macro for platform wrappers, ccl_platform_get_info_string(), which is simpler to use.
The CCLPlatform* class extends the CCLDevContainer* class; as such, it provides methods for handling a list of devices associated with the platform:
Usage example:
#define ccl_platform_get_info | ( | platf, | |
param_name, | |||
err | |||
) |
Get a CCLWrapperInfo platform information object.
[in] | platf | The platform 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 136 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info | ( | platf, | |
param_name, | |||
err | |||
) |
Get a CCLWrapperInfo platform information object.
[in] | platf | The platform 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 136 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_array | ( | platf, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns an array platform 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] | platf | The platform 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 177 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_array | ( | platf, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns an array platform 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] | platf | The platform 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 177 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_scalar | ( | platf, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns a scalar platform 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] | platf | The platform 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 156 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_scalar | ( | platf, | |
param_name, | |||
param_type, | |||
err | |||
) |
Macro which returns a scalar platform 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] | platf | The platform 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 156 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_string | ( | platf, | |
param_name, | |||
err | |||
) | ccl_platform_get_info_array(platf, param_name, char*, err) |
Helper macro which gets a platform information string.
This macro simply wraps the ccl_platform_get_info_array() macro, because (as of OpenCL 2.0) all platform information return types are char*.
[in] | platf | The platform 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 195 of file ccl_platform_wrapper.h.
#define ccl_platform_get_info_string | ( | platf, | |
param_name, | |||
err | |||
) | ccl_platform_get_info_array(platf, param_name, char*, err) |
Helper macro which gets a platform information string.
This macro simply wraps the ccl_platform_get_info_array() macro, because (as of OpenCL 2.0) all platform information return types are char*.
[in] | platf | The platform 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 195 of file ccl_platform_wrapper.h.
#define ccl_platform_ref | ( | platform | ) | ccl_wrapper_ref((CCLWrapper*) platform) |
Increase the reference count of the platform wrapper object.
[in] | platform | The platform wrapper object. |
Definition at line 203 of file ccl_platform_wrapper.h.
#define ccl_platform_ref | ( | platform | ) | ccl_wrapper_ref((CCLWrapper*) platform) |
Increase the reference count of the platform wrapper object.
[in] | platform | The platform wrapper object. |
Definition at line 203 of file ccl_platform_wrapper.h.
#define ccl_platform_unref | ( | platform | ) | ccl_platform_destroy(platform) |
Alias to ccl_platform_destroy().
[in] | platform | Platform wrapper object to destroy if reference count is 1, otherwise just decrement the reference count. |
Definition at line 212 of file ccl_platform_wrapper.h.
#define ccl_platform_unref | ( | platform | ) | ccl_platform_destroy(platform) |
Alias to ccl_platform_destroy().
[in] | platform | Platform wrapper object to destroy if reference count is 1, otherwise just decrement the reference count. |
Definition at line 212 of file ccl_platform_wrapper.h.
#define ccl_platform_unwrap | ( | platform | ) | ((cl_platform_id) ccl_wrapper_unwrap((CCLWrapper*) platform)) |
Get the OpenCL platform object.
[in] | platform | The platform wrapper object. |
Definition at line 220 of file ccl_platform_wrapper.h.
#define ccl_platform_unwrap | ( | platform | ) | ((cl_platform_id) ccl_wrapper_unwrap((CCLWrapper*) platform)) |
Get the OpenCL platform object.
[in] | platform | The platform wrapper object. |
Definition at line 220 of file ccl_platform_wrapper.h.
void ccl_platform_destroy | ( | CCLPlatform * | platf | ) |
Decrements the reference count of the platform wrapper object.
If it reaches 0, the platform wrapper object is destroyed.
[in] | platf | The platform wrapper object. |
Definition at line 210 of file ccl_platform_wrapper.c.
CCLDevice *const * ccl_platform_get_all_devices | ( | CCLPlatform * | platf, |
CCLErr ** | err | ||
) |
Get all device wrappers in platform.
This function returns the internal array containing the platform device wrappers. As such, clients should not modify the returned array (e.g. they should not free it directly).
[in] | platf | The platform wrapper object. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
NULL
if an error occurs. Definition at line 275 of file ccl_platform_wrapper.c.
CCLDevice * ccl_platform_get_device | ( | CCLPlatform * | platf, |
cl_uint | index, | ||
CCLErr ** | err | ||
) |
Get CCLDevice wrapper at given index.
[in] | platf | The platform wrapper object. |
[in] | index | Index of device in platform. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
NULL
if an error occurs. Definition at line 295 of file ccl_platform_wrapper.c.
cl_uint ccl_platform_get_num_devices | ( | CCLPlatform * | platf, |
CCLErr ** | err | ||
) |
Return number of devices in platform.
[in] | platf | The platform wrapper object. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 315 of file ccl_platform_wrapper.c.
cl_uint ccl_platform_get_opencl_version | ( | CCLPlatform * | platf, |
CCLErr ** | err | ||
) |
Get the OpenCL version of this platform.
The version is returned as an integer, in the following format:
[in] | platf | The platform wrapper object. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 237 of file ccl_platform_wrapper.c.
CCLPlatform * ccl_platform_new_from_device | ( | CCLDevice * | dev, |
CCLErr ** | err | ||
) |
Get the platform wrapper for the given device wrapper.
[in] | dev | The device wrapper from where to get a platform wrapper. |
[out] | err | Return location for a CCLErr object, or NULL if error reporting is to be ignored. |
Definition at line 164 of file ccl_platform_wrapper.c.
CCLPlatform * ccl_platform_new_wrap | ( | cl_platform_id | platform | ) |
Get the platform wrapper for the given OpenCL platform.
If the wrapper doesn't exist, its created with a reference count of 1. Otherwise, the existing wrapper is returned and its reference count is incremented by 1.
This function will rarely be called from client code, except when clients wish to create the OpenCL platform directly (using the clGetPlatformIDs() function) and then wrap the OpenCL platform in a CCLPlatform wrapper object.
[in] | platform | The OpenCL platform to be wrapped. |
Definition at line 144 of file ccl_platform_wrapper.c.