cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ccl_common.h File Reference

Common cf4ocl definitions. More...

Include dependency graph for ccl_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CCL_COMPILER   "GNU"
 Compiler used to compile cf4ocl. More...
 
#define CCL_ERROR   ccl_error_quark()
 Resolves to error category identifying string, in this case an error in cf4ocl. More...
 
#define CCL_OCL_ERROR   ccl_ocl_error_quark()
 Resolves to error category identifying string, in this case an error in the OpenCL library. More...
 
#define CCL_OPENCL_VERSION   "2.1"
 Version of OpenCL headers used to compile cf4ocl.
 
#define CCL_UNUSED(x)   (void)(x)
 Macro to avoid warning in unused variables. More...
 
#define CCL_VERSION_MAJOR   2
 Major cf4ocl version digit. More...
 
#define CCL_VERSION_MINOR   1
 Minor cf4ocl version digit. More...
 
#define CCL_VERSION_PATCH   0
 Patch/micro cf4ocl version digit. More...
 
#define CCL_VERSION_STRING   "v2.1.0"
 cf4ocl version string in vx.x.x format. More...
 
#define CCL_VERSION_STRING_FINAL   "v2.1.0"
 Final cf4ocl version string, either CCL_VERSION_STRING for stable versions or cf4ocl2_VERSION_STRING_FULL for development versions. More...
 
#define CCL_VERSION_STRING_FULL   "v2.1.0+1.0000000"
 Full cf4ocl version string, includes commit SHA, etc. More...
 
#define CCL_VERSION_TWEAK   ""
 Tweak cf4ocl version string. More...
 

Typedefs

typedef struct ccl_buffer CCLBuffer
 Buffer wrapper class.
 
typedef enum ccl_class CCLClass
 Class or type of wrapped OpenCL object.
 
typedef struct ccl_context CCLContext
 Context wrapper class.
 
typedef struct ccl_dev_container CCLDevContainer
 Base class for wrappers which contain devices, i.e., CCLPlatform, CCLProgram and CCLContext. More...
 
typedef struct ccl_device CCLDevice
 Device wrapper class.
 
typedef GError CCLErr
 Error handling class. More...
 
typedef enum ccl_error_code CCLErrorCode
 Error codes.
 
typedef struct ccl_event CCLEvent
 Event wrapper class.
 
typedef struct ccl_image CCLImage
 Image wrapper class.
 
typedef enum ccl_info CCLInfo
 Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrapper_get_info_size(). More...
 
typedef struct ccl_kernel CCLKernel
 Kernel wrapper class.
 
typedef struct ccl_memobj CCLMemObj
 Base class for memory object wrappers, i.e., CCLBuffer and CCLImage.
 
typedef struct ccl_platform CCLPlatform
 Platform wrapper class.
 
typedef struct ccl_platforms CCLPlatforms
 Class which represents the OpenCL platforms available in the system.
 
typedef struct ccl_program CCLProgram
 Program wrapper class.
 
typedef struct ccl_queue CCLQueue
 Command queue wrapper class.
 
typedef struct ccl_sampler CCLSampler
 Sampler wrapper class.
 
typedef struct ccl_wrapper CCLWrapper
 Base class for all OpenCL wrappers.
 

Enumerations

enum  ccl_class {
  CCL_BUFFER = 0, CCL_CONTEXT = 1, CCL_DEVICE = 2, CCL_EVENT = 3,
  CCL_IMAGE = 4, CCL_KERNEL = 5, CCL_PLATFORM = 6, CCL_PROGRAM = 7,
  CCL_SAMPLER = 8, CCL_QUEUE = 9, CCL_NONE = 10
}
 Class or type of wrapped OpenCL object. More...
 
enum  ccl_error_code {
  CCL_SUCCESS = 0, CCL_ERROR_OPENFILE = 1, CCL_ERROR_ARGS = 2, CCL_ERROR_INVALID_DATA = 3,
  CCL_ERROR_STREAM_WRITE = 4, CCL_ERROR_DEVICE_NOT_FOUND = 5, CCL_ERROR_UNSUPPORTED_OCL = 6, CCL_ERROR_INFO_UNAVAILABLE_OCL = 7,
  CCL_ERROR_OTHER = 15
}
 Error codes. More...
 
enum  ccl_info {
  CCL_INFO_CONTEXT = 0, CCL_INFO_DEVICE = 1, CCL_INFO_EVENT = 2, CCL_INFO_EVENT_PROFILING = 3,
  CCL_INFO_IMAGE = 4, CCL_INFO_KERNEL = 5, CCL_INFO_KERNEL_ARG = 6, CCL_INFO_KERNEL_WORKGROUP = 7,
  CCL_INFO_KERNEL_SUBGROUP = 8, CCL_INFO_MEMOBJ = 9, CCL_INFO_PLATFORM = 10, CCL_INFO_PROGRAM = 11,
  CCL_INFO_PROGRAM_BUILD = 12, CCL_INFO_SAMPLER = 13, CCL_INFO_QUEUE = 14, CCL_INFO_PIPE = 15,
  CCL_INFO_END = 16
}
 Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrapper_get_info_size(). More...
 

Functions

void ccl_common_version_print (const char *exec_name)
 Print executable version. More...
 
void ccl_err_clear (CCLErr **err)
 Releases a CCLErr object and set is to NULL. More...
 
GQuark ccl_error_quark (void)
 Resolves to error category identifying string, in this case an error in cf4ocl. More...
 
GQuark ccl_ocl_error_quark (void)
 Resolves to error category identifying string, in this case an error in the OpenCL library. More...
 
void ccl_strv_clear (char **str_array)
 Frees a NULL-terminated array of strings, as well as each string it contains. More...
 

Detailed Description

Common cf4ocl definitions.

Author
Nuno Fachada
Date
2016

Definition in file ccl_common.h.

Macro Definition Documentation

#define CCL_COMPILER   "GNU"

Compiler used to compile cf4ocl.

Definition at line 83 of file ccl_common.h.

#define CCL_ERROR   ccl_error_quark()

Resolves to error category identifying string, in this case an error in cf4ocl.

Definition at line 320 of file ccl_common.h.

#define CCL_OCL_ERROR   ccl_ocl_error_quark()

Resolves to error category identifying string, in this case an error in the OpenCL library.

Definition at line 324 of file ccl_common.h.

#define CCL_UNUSED (   x)    (void)(x)

Macro to avoid warning in unused variables.

Definition at line 86 of file ccl_common.h.

#define CCL_VERSION_MAJOR   2

Major cf4ocl version digit.

Definition at line 40 of file ccl_common.h.

#define CCL_VERSION_MINOR   1

Minor cf4ocl version digit.

Definition at line 43 of file ccl_common.h.

#define CCL_VERSION_PATCH   0

Patch/micro cf4ocl version digit.

Definition at line 46 of file ccl_common.h.

#define CCL_VERSION_STRING   "v2.1.0"

cf4ocl version string in vx.x.x format.

Definition at line 52 of file ccl_common.h.

#define CCL_VERSION_STRING_FINAL   "v2.1.0"

Final cf4ocl version string, either CCL_VERSION_STRING for stable versions or cf4ocl2_VERSION_STRING_FULL for development versions.

Definition at line 59 of file ccl_common.h.

#define CCL_VERSION_STRING_FULL   "v2.1.0+1.0000000"

Full cf4ocl version string, includes commit SHA, etc.

Definition at line 55 of file ccl_common.h.

#define CCL_VERSION_TWEAK   ""

Tweak cf4ocl version string.

Definition at line 49 of file ccl_common.h.

Typedef Documentation

Base class for wrappers which contain devices, i.e., CCLPlatform, CCLProgram and CCLContext.

This class extends CCLWrapper.

Definition at line 175 of file ccl_common.h.

typedef GError CCLErr

Error handling class.

This class is a wrapper for the GError structure from GLib, and has the following fields:

GQuark domain;
int code;
char* message;
See also
Error handling in cf4ocl.
The GLib and OpenCL dependencies.

Definition at line 291 of file ccl_common.h.

typedef enum ccl_info CCLInfo

Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrapper_get_info_size().

This enumeration is used by the ccl_*_get_info() macros and should rarely be used in client code.

Enumeration Type Documentation

enum ccl_class

Class or type of wrapped OpenCL object.

Enumerator
CCL_BUFFER 

Buffer object.

CCL_CONTEXT 

Context object.

CCL_DEVICE 

Device object.

CCL_EVENT 

Event object.

CCL_IMAGE 

Image object.

CCL_KERNEL 

Kernel object.

CCL_PLATFORM 

Platform object.

CCL_PROGRAM 

Program object.

CCL_SAMPLER 

Sampler object.

CCL_QUEUE 

Queue object.

CCL_NONE 

No object, enumeration termination marker.

Definition at line 91 of file ccl_common.h.

Error codes.

Enumerator
CCL_SUCCESS 

Successful operation.

CCL_ERROR_OPENFILE 

Unable to open file.

CCL_ERROR_ARGS 

Invalid function arguments.

CCL_ERROR_INVALID_DATA 

Invalid data passed to a function or returned from function.

CCL_ERROR_STREAM_WRITE 

Error writing to a stream.

CCL_ERROR_DEVICE_NOT_FOUND 

The requested OpenCL device was not found.

CCL_ERROR_UNSUPPORTED_OCL 

The operation is not supported by the version of the selected OpenCL platform.

CCL_ERROR_INFO_UNAVAILABLE_OCL 

Object information is unavailable.

CCL_ERROR_OTHER 

Any other errors.

Definition at line 296 of file ccl_common.h.

enum ccl_info

Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrapper_get_info_size().

This enumeration is used by the ccl_*_get_info() macros and should rarely be used in client code.

Enumerator
CCL_INFO_CONTEXT 

Request information about context objects.

CCL_INFO_DEVICE 

Request information about device objects.

CCL_INFO_EVENT 

Request information about event objects.

CCL_INFO_EVENT_PROFILING 

Request information about event profiling.

CCL_INFO_IMAGE 

Request information about image objects.

CCL_INFO_KERNEL 

Request information about kernel objects.

CCL_INFO_KERNEL_ARG 

Request information about kernel arguments.

CCL_INFO_KERNEL_WORKGROUP 

Request information about kernel work-groups.

CCL_INFO_KERNEL_SUBGROUP 

Request information about kernel sub-groups.

CCL_INFO_MEMOBJ 

Request information about memory objects.

CCL_INFO_PLATFORM 

Request information about platform objects.

CCL_INFO_PROGRAM 

Request information about program objects.

CCL_INFO_PROGRAM_BUILD 

Request information about program builds.

CCL_INFO_SAMPLER 

Request information about sampler objects.

CCL_INFO_QUEUE 

Request information about queue objects.

CCL_INFO_PIPE 

Request information about pipe objects.

CCL_INFO_END 

Enumeration termination marker.

Definition at line 124 of file ccl_common.h.

Function Documentation

void ccl_common_version_print ( const char *  exec_name)

Print executable version.

Parameters
[in]exec_nameExecutable name.

Definition at line 37 of file ccl_common.c.

void ccl_err_clear ( CCLErr **  err)

Releases a CCLErr object and set is to NULL.

If err or *err is NULL, does nothing. Otherwise, releases memory occupied by *err and sets *err to NULL.

Parameters
[in]errA CCLErr return location.
See also
Error handling in cf4ocl.
The GLib and OpenCL dependencies.

Definition at line 73 of file ccl_common.c.

GQuark ccl_error_quark ( void  )

Resolves to error category identifying string, in this case an error in cf4ocl.

Returns
A GQuark structure defined by category identifying string, which identifies the error as a cf4ocl generated error.

Definition at line 85 of file ccl_common.c.

GQuark ccl_ocl_error_quark ( void  )

Resolves to error category identifying string, in this case an error in the OpenCL library.

Returns
A GQuark structure defined by category identifying string, which identifies the error as an error in the OpenCL library.

Definition at line 97 of file ccl_common.c.

void ccl_strv_clear ( char **  str_array)

Frees a NULL-terminated array of strings, as well as each string it contains.

Parameters
[in]str_arrayA NULL-terminated array of strings to free.
See also
The GLib and OpenCL dependencies.

Definition at line 57 of file ccl_common.c.