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
Go to the documentation of this file.
1 /*
2  * This file is part of cf4ocl (C Framework for OpenCL).
3  *
4  * cf4ocl is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * cf4ocl is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with cf4ocl. If not, see
16  * <http://www.gnu.org/licenses/>.
17  * */
18 
29 #ifndef _CCL_COMMON_H_
30 #define _CCL_COMMON_H_
31 
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <glib.h>
35 #include <glib/gprintf.h>
36 #include "ccl_oclversions.h"
37 #include "ccl_export.h"
38 
40 #define CCL_VERSION_MAJOR 2
41 
43 #define CCL_VERSION_MINOR 1
44 
46 #define CCL_VERSION_PATCH 0
47 
49 #define CCL_VERSION_TWEAK ""
50 
52 #define CCL_VERSION_STRING "v2.1.0"
53 
55 #define CCL_VERSION_STRING_FULL "v2.1.0+1.0000000"
56 
59 #define CCL_VERSION_STRING_FINAL "v2.1.0"
60 
66 #if defined CL_VERSION_2_2
67  #define CCL_OPENCL_VERSION "2.2"
68 #elif defined CL_VERSION_2_1
69  #define CCL_OPENCL_VERSION "2.1"
70 #elif defined CL_VERSION_2_0
71  #define CCL_OPENCL_VERSION "2.0"
72 #elif defined CL_VERSION_1_2
73  #define CCL_OPENCL_VERSION "1.2"
74 #elif defined CL_VERSION_1_1
75  #define CCL_OPENCL_VERSION "1.1"
76 #elif defined CL_VERSION_1_0
77  #define CCL_OPENCL_VERSION "1.0"
78 #else
79  #error "OpenCL version is not defined"
80 #endif
81 
83 #define CCL_COMPILER "GNU"
84 
86 #define CCL_UNUSED(x) (void)(x)
87 
91 typedef enum ccl_class {
92 
114  CCL_NONE = 10
115 
116 } CCLClass;
117 
124 typedef enum ccl_info {
125 
160 
161 } CCLInfo;
162 
166 typedef struct ccl_wrapper CCLWrapper;
167 
176 
184 typedef struct ccl_memobj CCLMemObj;
185 
192 typedef struct ccl_buffer CCLBuffer;
193 
200 typedef struct ccl_context CCLContext;
201 
208 typedef struct ccl_device CCLDevice;
209 
216 typedef struct ccl_event CCLEvent;
217 
224 typedef struct ccl_image CCLImage;
225 
232 typedef struct ccl_kernel CCLKernel;
233 
240 typedef struct ccl_platform CCLPlatform;
241 
248 typedef struct ccl_program CCLProgram;
249 
256 typedef struct ccl_sampler CCLSampler;
257 
264 typedef struct ccl_queue CCLQueue;
265 
273 
291 typedef GError CCLErr;
292 
296 typedef enum ccl_error_code {
316 } CCLErrorCode;
317 
320 #define CCL_ERROR ccl_error_quark()
321 
324 #define CCL_OCL_ERROR ccl_ocl_error_quark()
325 
326 /* Print executable version. */
327 CCL_EXPORT
328 void ccl_common_version_print(const char* exec_name);
329 
330 /* Frees a `NULL`-terminated array of strings, as well as each string it
331  * contains. */
332 CCL_EXPORT
333 void ccl_strv_clear(char** str_array);
334 
335 /* If `err` or `*err` is `NULL`, does nothing. Otherwise, releases memory
336  * occupied by `*err` and sets `*err` to `NULL`. */
337 CCL_EXPORT
338 void ccl_err_clear(CCLErr** err);
339 
340 /* Resolves to error category identifying string, in this case an error in
341  * _cf4ocl_. */
342 CCL_EXPORT
343 GQuark ccl_error_quark(void);
344 
345 /* Resolves to error category identifying string, in this case an error in the
346  * OpenCL library. */
347 CCL_EXPORT
348 GQuark ccl_ocl_error_quark(void);
349 
350 #endif
Invalid data passed to a function or returned from function.
Definition: ccl_common.h:304
GQuark ccl_ocl_error_quark(void)
Resolves to error category identifying string, in this case an error in the OpenCL library...
Definition: ccl_common.c:97
Request information about device objects.
Definition: ccl_common.h:129
void ccl_strv_clear(char **str_array)
Frees a NULL-terminated array of strings, as well as each string it contains.
Definition: ccl_common.c:57
Device object.
Definition: ccl_common.h:98
Request information about event profiling.
Definition: ccl_common.h:133
Request information about platform objects.
Definition: ccl_common.h:147
enum ccl_info CCLInfo
Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrap...
Image wrapper class.
Any other errors.
Definition: ccl_common.h:315
Request information about queue objects.
Definition: ccl_common.h:155
Buffer wrapper class.
Request information about pipe objects.
Definition: ccl_common.h:157
Enumeration termination marker.
Definition: ccl_common.h:159
The context wrapper class.
Base class for memory object wrappers, i.e., CCLBuffer and CCLImage.
Command queue wrapper class.
enum ccl_class CCLClass
Class or type of wrapped OpenCL object.
Kernel object.
Definition: ccl_common.h:104
GQuark ccl_error_quark(void)
Resolves to error category identifying string, in this case an error in cf4ocl.
Definition: ccl_common.c:85
Context object.
Definition: ccl_common.h:96
void ccl_common_version_print(const char *exec_name)
Print executable version.
Definition: ccl_common.c:37
Unable to open file.
Definition: ccl_common.h:300
Image object.
Definition: ccl_common.h:102
Queue object.
Definition: ccl_common.h:112
Base class for wrappers which contain devices, i.e., CCLPlatform, CCLProgram and CCLContext.
Platform object.
Definition: ccl_common.h:106
The requested OpenCL device was not found.
Definition: ccl_common.h:308
enum ccl_error_code CCLErrorCode
Error codes.
Event wrapper class.
Base class for all OpenCL wrappers.
Class which represents the OpenCL platforms available in the system.
Definition: ccl_platforms.c:37
Event object.
Definition: ccl_common.h:100
Request information about program builds.
Definition: ccl_common.h:151
Request information about sampler objects.
Definition: ccl_common.h:153
Invalid function arguments.
Definition: ccl_common.h:302
Request information about kernel work-groups.
Definition: ccl_common.h:141
Buffer object.
Definition: ccl_common.h:94
Request information about image objects.
Definition: ccl_common.h:135
Request information about kernel sub-groups.
Definition: ccl_common.h:143
Sampler wrapper class.
Object information is unavailable.
Definition: ccl_common.h:313
Header for normalizing OpenCL versions within cf4ocl.
Program wrapper class.
void ccl_err_clear(CCLErr **err)
Releases a CCLErr object and set is to NULL.
Definition: ccl_common.c:73
Request information about kernel objects.
Definition: ccl_common.h:137
ccl_info
Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrap...
Definition: ccl_common.h:124
Sampler object.
Definition: ccl_common.h:110
Request information about memory objects.
Definition: ccl_common.h:145
Kernel wrapper class.
ccl_error_code
Error codes.
Definition: ccl_common.h:296
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
Request information about event objects.
Definition: ccl_common.h:131
Request information about kernel arguments.
Definition: ccl_common.h:139
No object, enumeration termination marker.
Definition: ccl_common.h:114
Successful operation.
Definition: ccl_common.h:298
Request information about program objects.
Definition: ccl_common.h:149
Error writing to a stream.
Definition: ccl_common.h:306
ccl_class
Class or type of wrapped OpenCL object.
Definition: ccl_common.h:91
Program object.
Definition: ccl_common.h:108
Device wrapper class.
The platform wrapper class.
Request information about context objects.
Definition: ccl_common.h:127
The operation is not supported by the version of the selected OpenCL platform.
Definition: ccl_common.h:311