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_event_wrapper.c
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 #include "ccl_event_wrapper.h"
31 #include "ccl_queue_wrapper.h"
32 #include "_ccl_abstract_wrapper.h"
33 #include "_ccl_defs.h"
34 
40 struct ccl_event {
41 
46  CCLWrapper base;
47 
52  const char* name;
53 
54 };
55 
76 CCL_EXPORT
77 CCLEvent* ccl_event_new_wrap(cl_event event) {
78 
79  CCLEvent* evt = (CCLEvent*) ccl_wrapper_new(
80  CCL_EVENT, (void*) event, sizeof(CCLEvent));
81 
82  return evt;
83 
84 }
85 
94 CCL_EXPORT
96 
97  ccl_wrapper_unref((CCLWrapper*) evt, sizeof(CCLEvent),
98  NULL, (ccl_wrapper_release_cl_object) clReleaseEvent, NULL);
99 
100 }
101 
113 CCL_EXPORT
114 void ccl_event_set_name(CCLEvent* evt, const char* name) {
115 
116  /* Make sure evt wrapper object is not NULL. */
117  g_return_if_fail(evt != NULL);
118 
119  /* Set event name. */
120  evt->name = name;
121 
122 }
123 
136 CCL_EXPORT
137 const char* ccl_event_get_name(CCLEvent* evt) {
138 
139  /* Make sure evt wrapper object is not NULL. */
140  g_return_val_if_fail(evt != NULL, NULL);
141 
142  /* Return event name. */
143  return evt->name;
144 
145 }
146 
160 CCL_EXPORT
162 
163  /* Make sure evt wrapper object is not NULL. */
164  g_return_val_if_fail(evt != NULL, NULL);
165 
166  /* Final name to return. */
167  const char* final_name;
168 
169  /* Check if name is not NULL. */
170  if (evt->name != NULL) {
171 
172  /* Name is not NULL, use it as final name. */
173  final_name = evt->name;
174 
175  } else {
176 
177  /* Name is NULL, determine a final name based on type of
178  * command which produced the event. */
179 
180  CCLErr* err_internal = NULL;
181 
182  cl_command_type ct =
183  ccl_event_get_command_type(evt, &err_internal);
184 
185  if (err_internal != NULL) {
186  g_warning("Unable to determine final event name due to" \
187  "the following error: %s", err_internal->message);
188  g_error_free(err_internal);
189  return NULL;
190  }
191 
192  switch (ct) {
193  case CL_COMMAND_NDRANGE_KERNEL:
194  final_name = "NDRANGE_KERNEL";
195  break;
196  case CL_COMMAND_NATIVE_KERNEL:
197  final_name = "NATIVE_KERNEL";
198  break;
199  case CL_COMMAND_READ_BUFFER:
200  final_name = "READ_BUFFER";
201  break;
202  case CL_COMMAND_WRITE_BUFFER:
203  final_name = "WRITE_BUFFER";
204  break;
205  case CL_COMMAND_COPY_BUFFER:
206  final_name = "COPY_BUFFER";
207  break;
208  case CL_COMMAND_READ_IMAGE:
209  final_name = "READ_IMAGE";
210  break;
211  case CL_COMMAND_WRITE_IMAGE:
212  final_name = "WRITE_IMAGE";
213  break;
214  case CL_COMMAND_COPY_IMAGE:
215  final_name = "COPY_IMAGE";
216  break;
217  case CL_COMMAND_COPY_BUFFER_TO_IMAGE:
218  final_name = "COPY_BUFFER_TO_IMAGE";
219  break;
220  case CL_COMMAND_COPY_IMAGE_TO_BUFFER:
221  final_name = "COPY_IMAGE_TO_BUFFER";
222  break;
223  case CL_COMMAND_MAP_BUFFER:
224  final_name = "MAP_BUFFER";
225  break;
226  case CL_COMMAND_MAP_IMAGE:
227  final_name = "MAP_IMAGE";
228  break;
229  case CL_COMMAND_UNMAP_MEM_OBJECT:
230  final_name = "UNMAP_MEM_OBJECT";
231  break;
232  case CL_COMMAND_MARKER:
233  final_name = "MARKER";
234  break;
235  case CL_COMMAND_ACQUIRE_GL_OBJECTS:
236  final_name = "ACQUIRE_GL_OBJECTS";
237  break;
238  case CL_COMMAND_RELEASE_GL_OBJECTS:
239  final_name = "RELEASE_GL_OBJECTS";
240  break;
241  case CL_COMMAND_READ_BUFFER_RECT:
242  final_name = "READ_BUFFER_RECT";
243  break;
244  case CL_COMMAND_WRITE_BUFFER_RECT:
245  final_name = "WRITE_BUFFER_RECT";
246  break;
247  case CL_COMMAND_COPY_BUFFER_RECT:
248  final_name = "COPY_BUFFER_RECT";
249  break;
250  case CL_COMMAND_USER:
251  /* This is here just for completeness, as a user
252  * event can't be profiled. */
253  final_name = "USER";
254  break;
255  case CL_COMMAND_BARRIER:
256  final_name = "BARRIER";
257  break;
258  case CL_COMMAND_MIGRATE_MEM_OBJECTS:
259  final_name = "MIGRATE_MEM_OBJECTS";
260  break;
261  case CL_COMMAND_FILL_BUFFER:
262  final_name = "FILL_BUFFER";
263  break;
264  case CL_COMMAND_FILL_IMAGE:
265  final_name = "FILL_IMAGE";
266  break;
267  case CL_COMMAND_SVM_FREE:
268  final_name = "SVM_FREE";
269  break;
270  case CL_COMMAND_SVM_MEMCPY:
271  final_name = "SVM_MEMCPY";
272  break;
273  case CL_COMMAND_SVM_MEMFILL:
274  final_name = "SVM_MEMFILL";
275  break;
276  case CL_COMMAND_SVM_MAP:
277  final_name = "SVM_MAP";
278  break;
279  case CL_COMMAND_SVM_UNMAP:
280  final_name = "SVM_UNMAP";
281  break;
282  case CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR:
283  final_name = "GL_FENCE_SYNC_OBJECT_KHR";
284  break;
285  case CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR:
286  final_name = "ACQUIRE_D3D10_OBJECTS_KHR";
287  break;
288  case CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR:
289  final_name = "RELEASE_D3D10_OBJECTS_KHR";
290  break;
291  case CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR:
292  final_name = "ACQUIRE_DX9_MEDIA_SURFACES_KHR";
293  break;
294  case CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR:
295  final_name = "RELEASE_DX9_MEDIA_SURFACES_KHR";
296  break;
297  case CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR:
298  final_name = "ACQUIRE_D3D11_OBJECTS_KHR";
299  break;
300  case CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR:
301  final_name = "RELEASE_D3D11_OBJECTS_KHR";
302  break;
303  case CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR:
304  final_name = "ACQUIRE_EGL_OBJECTS_KHR";
305  break;
306  case CL_COMMAND_RELEASE_EGL_OBJECTS_KHR:
307  final_name = "RELEASE_EGL_OBJECTS_KHR";
308  break;
309  case CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR:
310  final_name = "EGL_FENCE_SYNC_OBJECT_KHR";
311  break;
312  default:
313  final_name = "UNKNOWN";
314  g_warning("Unknown event command type: 0x%x", ct);
315  break;
316  }
317 
318  }
319 
320  /* Return final name. */
321  return final_name;
322 }
323 
335 CCL_EXPORT
337  CCLEvent* evt, CCLErr** err) {
338 
339  /* Make sure err is NULL or it is not set. */
340  g_return_val_if_fail(err == NULL || *err == NULL, 0);
341 
342  /* Make sure evt wrapper object is not NULL. */
343  g_return_val_if_fail(evt != NULL, 0);
344 
345  /* The command type to return. */
346  cl_command_type ct;
347 
348  /* Determine the command type. */
349  CCLWrapperInfo* info =
350  ccl_event_get_info(evt, CL_EVENT_COMMAND_TYPE, err);
351 
352  if (info == NULL) {
353  /* Some error ocurred, return 0. */
354  ct = 0;
355  } else {
356  /* Get the command type. */
357  ct = *((cl_command_type*) info->value);
358  }
359 
360  /* Return the command type. */
361  return ct;
362 }
363 
383 CCL_EXPORT
385 
386  /* Make sure number evt is not NULL. */
387  g_return_val_if_fail(evt != NULL, 0);
388  /* Make sure err is NULL or it is not set. */
389  g_return_val_if_fail(err == NULL || *err == NULL, 0);
390 
391  /* OpenCL version. */
392  cl_uint ocl_ver;
393 
394 #ifdef CL_VERSION_1_1
395  /* Get version from event if OpenCL >= 1.1 because CL_EVENT_CONTEXT
396  * isn't defined for version 1.0. */
397 
398  cl_context context;
399  CCLContext* ctx;
400  CCLErr* err_internal = NULL;
401 
402  context = ccl_event_get_info_scalar(
403  evt, CL_EVENT_CONTEXT, cl_context, &err_internal);
404  ccl_if_err_propagate_goto(err, err_internal, error_handler);
405 
406  /* Get context wrapper. */
407  ctx = ccl_context_new_wrap(context);
408 
409  /* Get OpenCL version. */
410  ocl_ver = ccl_context_get_opencl_version(ctx, &err_internal);
411  ccl_if_err_propagate_goto(err, err_internal, error_handler);
412 
413  /* Unref. the context wrapper. */
414  ccl_context_unref(ctx);
415 
416  /* If we got here, everything is OK. */
417  g_assert(err == NULL || *err == NULL);
418  goto finish;
419 
420 error_handler:
421 
422  /* If we got here there was an error, verify that it is so. */
423  g_assert(err == NULL || *err != NULL);
424  ocl_ver = 0;
425 
426 finish:
427 
428 #else
429 
430  /* It's version 1.0. */
431  ocl_ver = 100;
432 
433 #endif
434 
435  /* Return event wrapper. */
436  return ocl_ver;
437 
438 }
439 
459 CCL_EXPORT
461  cl_int command_exec_callback_type, ccl_event_callback pfn_notify,
462  void *user_data, CCLErr** err) {
463 
464  /* Make sure evt is not NULL. */
465  g_return_val_if_fail(evt != NULL, CL_FALSE);
466  /* Make sure err is NULL or it is not set. */
467  g_return_val_if_fail(err == NULL || *err == NULL, CL_FALSE);
468 
469  /* OpenCL function return status. */
470  cl_int ocl_status;
471  /* This function return status. */
472  cl_bool ret_status;
473  /* OpenCL version of the underlying platform. */
474  double ocl_ver;
475  /* Internal error handling object. */
476  CCLErr* err_internal = NULL;
477 
478 #ifndef CL_VERSION_1_1
479 
480  CCL_UNUSED(command_exec_callback_type);
481  CCL_UNUSED(pfn_notify);
482  CCL_UNUSED(user_data);
483  CCL_UNUSED(ocl_status);
484  CCL_UNUSED(ocl_ver);
485  CCL_UNUSED(err_internal);
486 
487  /* If cf4ocl was not compiled with support for OpenCL >= 1.1, always throw
488  * error. */
489  ccl_if_err_create_goto(*err, CCL_ERROR, TRUE,
490  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
491  "%s: Event callbacks require cf4ocl to be deployed with "
492  "support for OpenCL version 1.1 or newer.",
493  CCL_STRD);
494 
495 #else
496 
497  /* Check that context platform is >= OpenCL 1.1 */
498  ocl_ver = ccl_event_get_opencl_version(evt, &err_internal);
499  ccl_if_err_propagate_goto(err, err_internal, error_handler);
500 
501  /* If OpenCL version is not >= 1.1, throw error. */
502  ccl_if_err_create_goto(*err, CCL_ERROR, ocl_ver < 110,
503  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
504  "%s: set event callback requires OpenCL version 1.1 or newer.",
505  CCL_STRD);
506 
507  /* Set event callback.*/
508  ocl_status = clSetEventCallback(ccl_event_unwrap(evt),
509  command_exec_callback_type, pfn_notify, user_data);
511  CL_SUCCESS != ocl_status, ocl_status, error_handler,
512  "%s: unable to set event callback (OpenCL error %d: %s).",
513  CCL_STRD, ocl_status, ccl_err(ocl_status));
514 
515 #endif
516 
517  /* If we got here, everything is OK. */
518  g_assert(err == NULL || *err == NULL);
519  ret_status = CL_TRUE;
520  goto finish;
521 
522 error_handler:
523 
524  /* If we got here there was an error, verify that it is so. */
525  g_assert(err == NULL || *err != NULL);
526 
527  ret_status = CL_FALSE;
528 
529 finish:
530 
531  /* Return status. */
532  return ret_status;
533 
534 }
535 
551 CCL_EXPORT
553 
554  /* Make sure err is NULL or it is not set. */
555  g_return_val_if_fail(err == NULL || *err == NULL, NULL);
556 
557  /* Make sure ctx is not NULL. */
558  g_return_val_if_fail(ctx != NULL, NULL);
559 
560  /* OpenCL status. */
561  cl_int ocl_status;
562  /* Event wrapper object. */
563  CCLEvent* evt = NULL;
564  /* OpenCL event object. */
565  cl_event event;
566  /* OpenCL version of the underlying platform. */
567  double ocl_ver;
568  /* Internal error handling object. */
569  CCLErr* err_internal = NULL;
570 
571 #ifndef CL_VERSION_1_1
572 
573  CCL_UNUSED(ocl_status);
574  CCL_UNUSED(event);
575  CCL_UNUSED(ocl_ver);
576  CCL_UNUSED(err_internal);
577 
578  /* If cf4ocl was not compiled with support for OpenCL >= 1.1, always throw
579  * error. */
580  ccl_if_err_create_goto(*err, CCL_ERROR, TRUE,
581  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
582  "%s: User events require cf4ocl to be deployed with "
583  "support for OpenCL version 1.1 or newer.",
584  CCL_STRD);
585 
586 #else
587 
588  /* Check that context platform is >= OpenCL 1.1 */
589  ocl_ver = ccl_context_get_opencl_version(ctx, &err_internal);
590  ccl_if_err_propagate_goto(err, err_internal, error_handler);
591 
592  /* If OpenCL version is not >= 1.1, throw error. */
593  ccl_if_err_create_goto(*err, CCL_ERROR, ocl_ver < 110,
594  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
595  "%s: User events require OpenCL version 1.1 or newer.",
596  CCL_STRD);
597 
598  /* Create user event. */
599  event = clCreateUserEvent(ccl_context_unwrap(ctx), &ocl_status);
601  CL_SUCCESS != ocl_status, ocl_status, error_handler,
602  "%s: error creating user event (OpenCL error %d: %s).",
603  CCL_STRD, ocl_status, ccl_err(ocl_status));
604 
605  /* Wrap event. */
606  evt = ccl_event_new_wrap(event);
607 
608 #endif
609 
610  /* If we got here, everything is OK. */
611  g_assert(err == NULL || *err == NULL);
612  goto finish;
613 
614 error_handler:
615  /* If we got here there was an error, verify that it is so. */
616  g_assert(err == NULL || *err != NULL);
617 
618 finish:
619 
620  /* Return event wrapper. */
621  return evt;
622 
623 }
624 
640 CCL_EXPORT
642  CCLEvent* evt, cl_int execution_status, CCLErr** err) {
643 
644  /* Make sure err is NULL or it is not set. */
645  g_return_val_if_fail(err == NULL || *err == NULL, CL_FALSE);
646 
647  /* Make sure evt is not NULL. */
648  g_return_val_if_fail(evt != NULL, CL_FALSE);
649 
650  /* OpenCL status. */
651  cl_int ocl_status;
652  /* Function return status. */
653  cl_bool ret_status;
654  /* OpenCL version of the underlying platform. */
655  double ocl_ver;
656  /* Internal error handling object. */
657  CCLErr* err_internal = NULL;
658 
659 #ifndef CL_VERSION_1_1
660 
661  CCL_UNUSED(execution_status);
662  CCL_UNUSED(ocl_status);
663  CCL_UNUSED(ocl_ver);
664  CCL_UNUSED(err_internal);
665 
666  /* If cf4ocl was not compiled with support for OpenCL >= 1.1, always throw
667  * error. */
668  ccl_if_err_create_goto(*err, CCL_ERROR, TRUE,
669  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
670  "%s: User events require cf4ocl to be deployed with "
671  "support for OpenCL version 1.1 or newer.",
672  CCL_STRD);
673 
674 #else
675 
676  /* Check that context platform is >= OpenCL 1.1 */
677  ocl_ver = ccl_event_get_opencl_version(evt, &err_internal);
678  ccl_if_err_propagate_goto(err, err_internal, error_handler);
679 
680  /* If OpenCL version is not >= 1.1, throw error. */
681  ccl_if_err_create_goto(*err, CCL_ERROR, ocl_ver < 110,
682  CCL_ERROR_UNSUPPORTED_OCL, error_handler,
683  "%s: User events require OpenCL version 1.1 or newer.",
684  CCL_STRD);
685 
686  /* Set status. */
687  ocl_status = clSetUserEventStatus(
688  ccl_event_unwrap(evt), execution_status);
690  CL_SUCCESS != ocl_status, ocl_status, error_handler,
691  "%s: error setting user event status (OpenCL error %d: %s).",
692  CCL_STRD, ocl_status, ccl_err(ocl_status));
693 
694 #endif
695 
696  /* If we got here, everything is OK. */
697  g_assert(err == NULL || *err == NULL);
698  ret_status = CL_TRUE;
699  goto finish;
700 
701 error_handler:
702  /* If we got here there was an error, verify that it is so. */
703  g_assert(err == NULL || *err != NULL);
704  ret_status = CL_FALSE;
705 
706 finish:
707 
708  /* Return status. */
709  return ret_status;
710 
711 }
712 
721 CCL_EXPORT
723  CCLEventWaitList* evt_wait_lst, ...) {
724 
725  /* Check that evt_wait_lst is not NULL. */
726  g_return_val_if_fail(evt_wait_lst != NULL, NULL);
727 
728  /* Variable argument list. */
729  va_list al;
730 
731  /* Current event wrapper object. */
732  CCLEvent* evt;
733 
734  /* Initialize list if required. */
735  if (*evt_wait_lst == NULL)
736  *evt_wait_lst = g_ptr_array_new();
737 
738  /* Initialize variable argument list. */
739  va_start(al, evt_wait_lst);
740 
741  /* Get arguments (i.e. event wrapper objects). */
742  while ((evt = va_arg(al, CCLEvent*)) != NULL) {
743 
744  /* Add event wrapper to array. */
745  g_ptr_array_add(*evt_wait_lst, ccl_event_unwrap(evt));
746 
747  }
748 
749  /* Finalize variable argument list. */
750  va_end(al);
751 
752  /* Signal bug if no events have been given. */
753  g_return_val_if_fail((*evt_wait_lst)->len > 0, NULL);
754 
755  /* Return event wait list. */
756  return evt_wait_lst;
757 
758 }
759 
767 CCL_EXPORT
769  CCLEventWaitList* evt_wait_lst, CCLEvent** evts) {
770 
771  /* Check that evt_wait_lst is not NULL. */
772  g_return_val_if_fail(evt_wait_lst != NULL, NULL);
773 
774  /* Check that events array is not NULL. */
775  g_return_val_if_fail(evts != NULL, NULL);
776 
777  /* Check that events array contains events. */
778  g_return_val_if_fail(evts[0] != NULL, NULL);
779 
780  /* Initialize list if required. */
781  if (*evt_wait_lst == NULL)
782  *evt_wait_lst = g_ptr_array_new();
783 
784  /* Cycle through array of event wrapper objects. */
785  for (guint i = 0; evts[i] != NULL; ++i) {
786 
787  /* Add wrapped cl_event to array. */
788  g_ptr_array_add(*evt_wait_lst, ccl_event_unwrap(evts[i]));
789 
790  }
791 
792  /* Return event wait list. */
793  return evt_wait_lst;
794 
795 }
796 
806 CCL_EXPORT
808 
809  if ((evt_wait_lst != NULL) && (*evt_wait_lst != NULL)) {
810  g_ptr_array_free(*evt_wait_lst, TRUE);
811  *evt_wait_lst = NULL;
812  }
813 }
814 
828 CCL_EXPORT
829 cl_bool ccl_event_wait(CCLEventWaitList* evt_wait_lst, CCLErr** err) {
830 
831  /* Make sure err is NULL or it is not set. */
832  g_return_val_if_fail(err == NULL || *err == NULL, CL_FALSE);
833 
834  /* OpenCL status. */
835  cl_int ocl_status;
836  /* Function return status. */
837  cl_bool ret_status;
838 
839  /* OpenCL wait for events. */
840  ocl_status = clWaitForEvents(
841  ccl_event_wait_list_get_num_events(evt_wait_lst),
842  ccl_event_wait_list_get_clevents(evt_wait_lst));
844  CL_SUCCESS != ocl_status, ocl_status, error_handler,
845  "%s: error while waiting for events (OpenCL error %d: %s).",
846  CCL_STRD, ocl_status, ccl_err(ocl_status));
847 
848  /* Clear event wait list. */
849  ccl_event_wait_list_clear(evt_wait_lst);
850 
851  /* If we got here, everything is OK. */
852  g_assert(err == NULL || *err == NULL);
853  ret_status = CL_TRUE;
854  goto finish;
855 
856 error_handler:
857  /* If we got here there was an error, verify that it is so. */
858  g_assert(err == NULL || *err != NULL);
859  ret_status = CL_FALSE;
860 
861 finish:
862 
863  /* Return status. */
864  return ret_status;
865 
866 }
867 
void ccl_event_set_name(CCLEvent *evt, const char *name)
Set event name for profiling purposes.
const char * ccl_event_get_final_name(CCLEvent *evt)
Get the final event name for profiling purposes.
#define CCL_OCL_ERROR
Resolves to error category identifying string, in this case an error in the OpenCL library...
Definition: ccl_common.h:324
cl_bool ccl_event_set_callback(CCLEvent *evt, cl_int command_exec_callback_type, ccl_event_callback pfn_notify, void *user_data, CCLErr **err)
Wrapper for OpenCL clSetEventCallback() function.
CCLEvent * ccl_user_event_new(CCLContext *ctx, CCLErr **err)
Create a new user event.
#define ccl_if_err_create_goto(err, quark, error_condition, error_code, label, msg,...)
If error is detected (error_code != no_error_code), create an error object (CCLErr) and go to the spe...
Definition: _ccl_defs.h:91
#define ccl_context_unwrap(ctx)
Get the OpenCL context object.
GPtrArray * CCLEventWaitList
A list of event objects on which enqueued commands can wait.
Useful definitions used internally by cf4ocl.
#define ccl_event_get_info(evt, param_name, err)
Get a CCLWrapperInfo event information object.
void ccl_event_destroy(CCLEvent *evt)
Decrements the reference count of the event wrapper object.
Definition of a wrapper class and its methods for OpenCL event objects.
The context wrapper class.
#define ccl_if_err_propagate_goto(err_dest, err_src, label)
Same as ccl_if_err_goto(), but rethrows error in a source CCLErr object to a new destination CCLErr o...
Definition: _ccl_defs.h:120
const char * ccl_err(int code)
Convert OpenCL error code to a readable string.
Definition: ccl_errors.c:118
cl_uint ccl_event_get_opencl_version(CCLEvent *evt, CCLErr **err)
Get the OpenCL version of the platform associated with this event object.
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.
struct ccl_event CCLEvent
Event wrapper class.
Definition: ccl_common.h:216
#define CCL_ERROR
Resolves to error category identifying string, in this case an error in cf4ocl.
Definition: ccl_common.h:320
cl_command_type ccl_event_get_command_type(CCLEvent *evt, CCLErr **err)
Get the command type which fired the given event.
Event wrapper class.
Base class for all OpenCL wrappers.
#define ccl_event_get_info_scalar(evt, param_name, param_type, err)
Macro which returns a scalar event information value.
cl_bool ccl_user_event_set_status(CCLEvent *evt, cl_int execution_status, CCLErr **err)
Sets the execution status of a user event object.
#define ccl_context_unref(ctx)
Alias to ccl_context_destroy().
#define CCL_UNUSED(x)
Macro to avoid warning in unused variables.
Definition: ccl_common.h:86
Event object.
Definition: ccl_common.h:100
const char * ccl_event_get_name(CCLEvent *evt)
Get the event name for profiling purposes.
CCLEventWaitList * ccl_event_wait_list_add(CCLEventWaitList *evt_wait_lst,...)
Add event wrapper objects to an event wait list (variable argument list version). ...
#define ccl_event_unwrap(evt)
Get the OpenCL event object.
void * value
Object information.
CCLEventWaitList * ccl_event_wait_list_add_v(CCLEventWaitList *evt_wait_lst, CCLEvent **evts)
Add event wrapper objects to an event wait list (array version).
Class which represents information about a wrapped OpenCL object.
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
Definition of a wrapper class and its methods for OpenCL queue objects.
CCLEvent * ccl_event_new_wrap(cl_event event)
Get the event wrapper for the given OpenCL event.
cl_bool ccl_event_wait(CCLEventWaitList *evt_wait_lst, CCLErr **err)
Waits on the host thread for commands identified by events in the wait list to complete.
The operation is not supported by the version of the selected OpenCL platform.
Definition: ccl_common.h:311
void ccl_event_wait_list_clear(CCLEventWaitList *evt_wait_lst)
Clears an event wait list.
void(* ccl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data)
Prototype for user event callback functions.