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_memobj_wrapper.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 
30 #ifndef _CCL_MEMOBJ_WRAPPER_H_
31 #define _CCL_MEMOBJ_WRAPPER_H_
32 
33 #include "ccl_oclversions.h"
34 #include "ccl_abstract_wrapper.h"
35 #include "ccl_event_wrapper.h"
36 #include "ccl_queue_wrapper.h"
37 
72 typedef void (CL_CALLBACK *ccl_memobj_destructor_callback)(
73  cl_mem memobj, void *user_data);
74 
75 /* Get the OpenCL version of the platform associated with this memory
76  * object. */
77 CCL_EXPORT
79 
80 /* Enqueues a command to unmap a previously mapped region of a memory
81  * object. */
82 CCL_EXPORT
84  void* mapped_ptr, CCLEventWaitList* evt_wait_lst, CCLErr** err);
85 
86 /* Wrapper for OpenCL clSetMemObjectDestructorCallback() function. */
87 CCL_EXPORT
90  void *user_data, CCLErr** err);
91 
92 /* Enqueues a command to indicate which device a set of memory objects
93  * should be associated with. */
94 CCL_EXPORT
95 CCLEvent* ccl_memobj_enqueue_migrate(CCLMemObj** mos, cl_uint num_mos,
96  CCLQueue* cq, cl_mem_migration_flags flags,
97  CCLEventWaitList* evt_wait_lst, CCLErr** err);
98 
110 #define ccl_memobj_get_info(mo, param_name, err) \
111  ccl_wrapper_get_info((CCLWrapper*) mo, NULL, param_name, 0, \
112  CCL_INFO_MEMOBJ, CL_FALSE, err)
113 
130 #define ccl_memobj_get_info_scalar(mo, param_name, param_type, err) \
131  *((param_type*) ccl_wrapper_get_info_value((CCLWrapper*) mo, \
132  NULL, param_name, sizeof(param_type), CCL_INFO_MEMOBJ, CL_FALSE, err))
133 
150 #define ccl_memobj_get_info_array(mo, param_name, param_type, err) \
151  (param_type) ccl_wrapper_get_info_value((CCLWrapper*) mo, \
152  NULL, param_name, sizeof(param_type), CCL_INFO_MEMOBJ, CL_FALSE, err)
153 
159 #define ccl_memobj_ref(mo) \
160  ccl_wrapper_ref((CCLWrapper*) mo)
161 
168 #define ccl_memobj_unwrap(mo) \
169  ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) mo))
170 
173 #endif
void(* ccl_memobj_destructor_callback)(cl_mem memobj, void *user_data)
Prototype for memory object destructor callback functions.
GPtrArray * CCLEventWaitList
A list of event objects on which enqueued commands can wait.
Definition of a wrapper class and its methods for OpenCL event objects.
Base class for memory object wrappers, i.e., CCLBuffer and CCLImage.
Command queue wrapper class.
Event wrapper class.
Definition of an abstract wrapper class and its methods for OpenCL objects.
cl_uint ccl_memobj_get_opencl_version(CCLMemObj *mo, CCLErr **err)
Get the OpenCL version of the platform associated with this memory object.
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.
Header for normalizing OpenCL versions within cf4ocl.
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
Definition of a wrapper class and its methods for OpenCL queue objects.
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...
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.