398 #if !defined(CL_HPP_USE_DX_INTEROP) && defined(USE_DX_INTEROP)
399 # pragma message("cl2.hpp: USE_DX_INTEROP is deprecated. Define CL_HPP_USE_DX_INTEROP instead")
400 # define CL_HPP_USE_DX_INTEROP
402 #if !defined(CL_HPP_USE_CL_DEVICE_FISSION) && defined(USE_CL_DEVICE_FISSION)
403 # pragma message("cl2.hpp: USE_CL_DEVICE_FISSION is deprecated. Define CL_HPP_USE_CL_DEVICE_FISSION instead")
404 # define CL_HPP_USE_CL_DEVICE_FISSION
406 #if !defined(CL_HPP_ENABLE_EXCEPTIONS) && defined(__CL_ENABLE_EXCEPTIONS)
407 # pragma message("cl2.hpp: __CL_ENABLE_EXCEPTIONS is deprecated. Define CL_HPP_ENABLE_EXCEPTIONS instead")
408 # define CL_HPP_ENABLE_EXCEPTIONS
410 #if !defined(CL_HPP_NO_STD_VECTOR) && defined(__NO_STD_VECTOR)
411 # pragma message("cl2.hpp: __NO_STD_VECTOR is deprecated. Define CL_HPP_NO_STD_VECTOR instead")
412 # define CL_HPP_NO_STD_VECTOR
414 #if !defined(CL_HPP_NO_STD_STRING) && defined(__NO_STD_STRING)
415 # pragma message("cl2.hpp: __NO_STD_STRING is deprecated. Define CL_HPP_NO_STD_STRING instead")
416 # define CL_HPP_NO_STD_STRING
418 #if defined(VECTOR_CLASS)
419 # pragma message("cl2.hpp: VECTOR_CLASS is deprecated. Alias cl::vector instead")
421 #if defined(STRING_CLASS)
422 # pragma message("cl2.hpp: STRING_CLASS is deprecated. Alias cl::string instead.")
424 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS) && defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
425 # pragma message("cl2.hpp: __CL_USER_OVERRIDE_ERROR_STRINGS is deprecated. Define CL_HPP_USER_OVERRIDE_ERROR_STRINGS instead")
426 # define CL_HPP_USER_OVERRIDE_ERROR_STRINGS
431 #if defined(__USE_DEV_VECTOR)
432 # pragma message("cl2.hpp: __USE_DEV_VECTOR is no longer supported. Expect compilation errors")
434 #if defined(__USE_DEV_STRING)
435 # pragma message("cl2.hpp: __USE_DEV_STRING is no longer supported. Expect compilation errors")
439 #if !defined(CL_HPP_TARGET_OPENCL_VERSION)
440 # pragma message("cl2.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 200 (OpenCL 2.0)")
441 # define CL_HPP_TARGET_OPENCL_VERSION 200
443 #if CL_HPP_TARGET_OPENCL_VERSION != 100 && CL_HPP_TARGET_OPENCL_VERSION != 110 && CL_HPP_TARGET_OPENCL_VERSION != 120 && CL_HPP_TARGET_OPENCL_VERSION != 200
444 # pragma message("cl2.hpp: CL_HPP_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120 or 200). It will be set to 200")
445 # undef CL_HPP_TARGET_OPENCL_VERSION
446 # define CL_HPP_TARGET_OPENCL_VERSION 200
449 #if !defined(CL_HPP_MINIMUM_OPENCL_VERSION)
450 # define CL_HPP_MINIMUM_OPENCL_VERSION 200
452 #if CL_HPP_MINIMUM_OPENCL_VERSION != 100 && CL_HPP_MINIMUM_OPENCL_VERSION != 110 && CL_HPP_MINIMUM_OPENCL_VERSION != 120 && CL_HPP_MINIMUM_OPENCL_VERSION != 200
453 # pragma message("cl2.hpp: CL_HPP_MINIMUM_OPENCL_VERSION is not a valid value (100, 110, 120 or 200). It will be set to 100")
454 # undef CL_HPP_MINIMUM_OPENCL_VERSION
455 # define CL_HPP_MINIMUM_OPENCL_VERSION 100
457 #if CL_HPP_MINIMUM_OPENCL_VERSION > CL_HPP_TARGET_OPENCL_VERSION
458 # error "CL_HPP_MINIMUM_OPENCL_VERSION must not be greater than CL_HPP_TARGET_OPENCL_VERSION"
461 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
462 # define CL_USE_DEPRECATED_OPENCL_1_0_APIS
464 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
465 # define CL_USE_DEPRECATED_OPENCL_1_1_APIS
467 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
468 # define CL_USE_DEPRECATED_OPENCL_1_2_APIS
470 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
471 # define CL_USE_DEPRECATED_OPENCL_2_0_APIS
478 #if defined(CL_HPP_USE_DX_INTEROP)
479 #include <CL/cl_d3d10.h>
480 #include <CL/cl_dx9_media_sharing.h>
484 #if defined(_MSC_VER)
492 #if (!defined(_MSC_VER) && __cplusplus < 201103L) || (defined(_MSC_VER) && _MSC_VER < 1700)
493 #error Visual studio 2013 or another C++11-supporting compiler required
497 #if defined(CL_HPP_USE_CL_DEVICE_FISSION) || defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
498 #include <CL/cl_ext.h>
501 #if defined(__APPLE__) || defined(__MACOSX)
502 #include <OpenCL/opencl.h>
504 #include <CL/opencl.h>
507 #if (__cplusplus >= 201103L)
508 #define CL_HPP_NOEXCEPT_ noexcept
510 #define CL_HPP_NOEXCEPT_
513 #if defined(_MSC_VER)
514 # define CL_HPP_DEFINE_STATIC_MEMBER_ __declspec(selectany)
516 # define CL_HPP_DEFINE_STATIC_MEMBER_ __attribute__((weak))
521 #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
522 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
523 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
524 #if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
525 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
526 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
528 #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
529 #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
530 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
531 #if !defined(CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED)
532 #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
533 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
535 #if !defined(CL_CALLBACK)
544 #include <functional>
548 #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
552 #else // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
556 #endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
559 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
561 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
563 #if !defined(CL_HPP_NO_STD_VECTOR)
566 template <
class T,
class Alloc = std::allocator<T> >
569 #endif // #if !defined(CL_HPP_NO_STD_VECTOR)
571 #if !defined(CL_HPP_NO_STD_STRING)
576 #endif // #if !defined(CL_HPP_NO_STD_STRING)
578 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
580 #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
585 template<
class T,
class D>
589 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
590 #if !defined(CL_HPP_NO_STD_ARRAY)
593 template <
class T,
size_type N >
596 #endif // #if !defined(CL_HPP_NO_STD_ARRAY)
600 #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
602 namespace compatibility {
617 for (
int i = 0; i < N; ++i) {
622 size_t(
const array<size_type, N> &rhs)
624 for (
int i = 0; i < N; ++i) {
634 const size_type& operator[](
int index)
const
643 operator const size_type* ()
const {
return data_; }
645 operator array<size_type, N>()
const
647 array<size_type, N> ret;
649 for (
int i = 0; i < N; ++i) {
658 using size_t = compatibility::size_t<N>;
660 #endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
678 #define CL_HPP_INIT_CL_EXT_FCN_PTR_(name) \
680 pfn_##name = (PFN_##name) \
681 clGetExtensionFunctionAddress(#name); \
686 #define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name) \
688 pfn_##name = (PFN_##name) \
689 clGetExtensionFunctionAddressForPlatform(platform, #name); \
698 class DeviceCommandQueue;
703 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
708 class Error :
public std::exception
712 const char * errStr_;
723 Error(cl_int err,
const char * errStr = NULL) : err_(err), errStr_(errStr)
732 virtual const char * what()
const throw ()
734 if (errStr_ == NULL) {
746 cl_int err(
void)
const {
return err_; }
748 #define CL_HPP_ERR_STR_(x) #x
750 #define CL_HPP_ERR_STR_(x) NULL
751 #endif // CL_HPP_ENABLE_EXCEPTIONS
756 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
757 static inline cl_int errHandler (
759 const char * errStr = NULL)
761 if (err != CL_SUCCESS) {
762 throw Error(err, errStr);
767 static inline cl_int errHandler (cl_int err,
const char * errStr = NULL)
772 #endif // CL_HPP_ENABLE_EXCEPTIONS
778 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
779 #define __GET_DEVICE_INFO_ERR CL_HPP_ERR_STR_(clGetDeviceInfo)
780 #define __GET_PLATFORM_INFO_ERR CL_HPP_ERR_STR_(clGetPlatformInfo)
781 #define __GET_DEVICE_IDS_ERR CL_HPP_ERR_STR_(clGetDeviceIDs)
782 #define __GET_PLATFORM_IDS_ERR CL_HPP_ERR_STR_(clGetPlatformIDs)
783 #define __GET_CONTEXT_INFO_ERR CL_HPP_ERR_STR_(clGetContextInfo)
784 #define __GET_EVENT_INFO_ERR CL_HPP_ERR_STR_(clGetEventInfo)
785 #define __GET_EVENT_PROFILE_INFO_ERR CL_HPP_ERR_STR_(clGetEventProfileInfo)
786 #define __GET_MEM_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetMemObjectInfo)
787 #define __GET_IMAGE_INFO_ERR CL_HPP_ERR_STR_(clGetImageInfo)
788 #define __GET_SAMPLER_INFO_ERR CL_HPP_ERR_STR_(clGetSamplerInfo)
789 #define __GET_KERNEL_INFO_ERR CL_HPP_ERR_STR_(clGetKernelInfo)
790 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
791 #define __GET_KERNEL_ARG_INFO_ERR CL_HPP_ERR_STR_(clGetKernelArgInfo)
792 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
793 #define __GET_KERNEL_WORK_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelWorkGroupInfo)
794 #define __GET_PROGRAM_INFO_ERR CL_HPP_ERR_STR_(clGetProgramInfo)
795 #define __GET_PROGRAM_BUILD_INFO_ERR CL_HPP_ERR_STR_(clGetProgramBuildInfo)
796 #define __GET_COMMAND_QUEUE_INFO_ERR CL_HPP_ERR_STR_(clGetCommandQueueInfo)
798 #define __CREATE_CONTEXT_ERR CL_HPP_ERR_STR_(clCreateContext)
799 #define __CREATE_CONTEXT_FROM_TYPE_ERR CL_HPP_ERR_STR_(clCreateContextFromType)
800 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR CL_HPP_ERR_STR_(clGetSupportedImageFormats)
802 #define __CREATE_BUFFER_ERR CL_HPP_ERR_STR_(clCreateBuffer)
803 #define __COPY_ERR CL_HPP_ERR_STR_(cl::copy)
804 #define __CREATE_SUBBUFFER_ERR CL_HPP_ERR_STR_(clCreateSubBuffer)
805 #define __CREATE_GL_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
806 #define __CREATE_GL_RENDER_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
807 #define __GET_GL_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetGLObjectInfo)
808 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
809 #define __CREATE_IMAGE_ERR CL_HPP_ERR_STR_(clCreateImage)
810 #define __CREATE_GL_TEXTURE_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture)
811 #define __IMAGE_DIMENSION_ERR CL_HPP_ERR_STR_(Incorrect image dimensions)
812 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
813 #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR CL_HPP_ERR_STR_(clSetMemObjectDestructorCallback)
815 #define __CREATE_USER_EVENT_ERR CL_HPP_ERR_STR_(clCreateUserEvent)
816 #define __SET_USER_EVENT_STATUS_ERR CL_HPP_ERR_STR_(clSetUserEventStatus)
817 #define __SET_EVENT_CALLBACK_ERR CL_HPP_ERR_STR_(clSetEventCallback)
818 #define __WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clWaitForEvents)
820 #define __CREATE_KERNEL_ERR CL_HPP_ERR_STR_(clCreateKernel)
821 #define __SET_KERNEL_ARGS_ERR CL_HPP_ERR_STR_(clSetKernelArg)
822 #define __CREATE_PROGRAM_WITH_SOURCE_ERR CL_HPP_ERR_STR_(clCreateProgramWithSource)
823 #define __CREATE_PROGRAM_WITH_BINARY_ERR CL_HPP_ERR_STR_(clCreateProgramWithBinary)
824 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
825 #define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR CL_HPP_ERR_STR_(clCreateProgramWithBuiltInKernels)
826 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
827 #define __BUILD_PROGRAM_ERR CL_HPP_ERR_STR_(clBuildProgram)
828 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
829 #define __COMPILE_PROGRAM_ERR CL_HPP_ERR_STR_(clCompileProgram)
830 #define __LINK_PROGRAM_ERR CL_HPP_ERR_STR_(clLinkProgram)
831 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
832 #define __CREATE_KERNELS_IN_PROGRAM_ERR CL_HPP_ERR_STR_(clCreateKernelsInProgram)
834 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
835 #define __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateCommandQueueWithProperties)
836 #define __CREATE_SAMPLER_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateSamplerWithProperties)
837 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
838 #define __SET_COMMAND_QUEUE_PROPERTY_ERR CL_HPP_ERR_STR_(clSetCommandQueueProperty)
839 #define __ENQUEUE_READ_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueReadBuffer)
840 #define __ENQUEUE_READ_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueReadBufferRect)
841 #define __ENQUEUE_WRITE_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueWriteBuffer)
842 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueWriteBufferRect)
843 #define __ENQEUE_COPY_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyBuffer)
844 #define __ENQEUE_COPY_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferRect)
845 #define __ENQUEUE_FILL_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueFillBuffer)
846 #define __ENQUEUE_READ_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueReadImage)
847 #define __ENQUEUE_WRITE_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueWriteImage)
848 #define __ENQUEUE_COPY_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyImage)
849 #define __ENQUEUE_FILL_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueFillImage)
850 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyImageToBuffer)
851 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferToImage)
852 #define __ENQUEUE_MAP_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueMapBuffer)
853 #define __ENQUEUE_MAP_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueMapImage)
854 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR CL_HPP_ERR_STR_(clEnqueueUnMapMemObject)
855 #define __ENQUEUE_NDRANGE_KERNEL_ERR CL_HPP_ERR_STR_(clEnqueueNDRangeKernel)
856 #define __ENQUEUE_NATIVE_KERNEL CL_HPP_ERR_STR_(clEnqueueNativeKernel)
857 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
858 #define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR CL_HPP_ERR_STR_(clEnqueueMigrateMemObjects)
859 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
861 #define __ENQUEUE_ACQUIRE_GL_ERR CL_HPP_ERR_STR_(clEnqueueAcquireGLObjects)
862 #define __ENQUEUE_RELEASE_GL_ERR CL_HPP_ERR_STR_(clEnqueueReleaseGLObjects)
864 #define __CREATE_PIPE_ERR CL_HPP_ERR_STR_(clCreatePipe)
865 #define __GET_PIPE_INFO_ERR CL_HPP_ERR_STR_(clGetPipeInfo)
868 #define __RETAIN_ERR CL_HPP_ERR_STR_(Retain Object)
869 #define __RELEASE_ERR CL_HPP_ERR_STR_(Release Object)
870 #define __FLUSH_ERR CL_HPP_ERR_STR_(clFlush)
871 #define __FINISH_ERR CL_HPP_ERR_STR_(clFinish)
872 #define __VECTOR_CAPACITY_ERR CL_HPP_ERR_STR_(Vector capacity error)
877 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
878 #define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevices)
880 #define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevicesEXT)
881 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
886 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
887 #define __ENQUEUE_MARKER_ERR CL_HPP_ERR_STR_(clEnqueueMarker)
888 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clEnqueueWaitForEvents)
889 #define __ENQUEUE_BARRIER_ERR CL_HPP_ERR_STR_(clEnqueueBarrier)
890 #define __UNLOAD_COMPILER_ERR CL_HPP_ERR_STR_(clUnloadCompiler)
891 #define __CREATE_GL_TEXTURE_2D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture2D)
892 #define __CREATE_GL_TEXTURE_3D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture3D)
893 #define __CREATE_IMAGE2D_ERR CL_HPP_ERR_STR_(clCreateImage2D)
894 #define __CREATE_IMAGE3D_ERR CL_HPP_ERR_STR_(clCreateImage3D)
895 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
900 #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
901 #define __CREATE_COMMAND_QUEUE_ERR CL_HPP_ERR_STR_(clCreateCommandQueue)
902 #define __ENQUEUE_TASK_ERR CL_HPP_ERR_STR_(clEnqueueTask)
903 #define __CREATE_SAMPLER_ERR CL_HPP_ERR_STR_(clCreateSampler)
904 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
909 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
910 #define __ENQUEUE_MARKER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueMarkerWithWaitList)
911 #define __ENQUEUE_BARRIER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueBarrierWithWaitList)
912 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
914 #endif // CL_HPP_USER_OVERRIDE_ERROR_STRINGS
924 template<
typename Functor,
typename T>
927 return f(name,
sizeof(T), param, NULL);
932 template <
typename Func>
935 if (name != CL_PROGRAM_BINARIES) {
936 return CL_INVALID_VALUE;
943 for (
size_type i = 0; i < numBinaries; ++i)
945 binariesPointers[i] = (*param)[i].data();
948 cl_int err = f(name, numBinaries *
sizeof(
unsigned char*), binariesPointers.data(), NULL);
950 if (err != CL_SUCCESS) {
960 template <
typename Func,
typename T>
964 cl_int err = f(name, 0, NULL, &required);
965 if (err != CL_SUCCESS) {
968 const size_type elements = required /
sizeof(T);
972 err = f(name, required, localData.data(), NULL);
973 if (err != CL_SUCCESS) {
977 *param = std::move(localData);
989 template <
typename Func,
typename T>
991 Func f, cl_uint name,
vector<T>* param,
int,
typename T::cl_type = 0)
994 cl_int err = f(name, 0, NULL, &required);
995 if (err != CL_SUCCESS) {
999 const size_type elements = required /
sizeof(
typename T::cl_type);
1002 err = f(name, required, value.data(), NULL);
1003 if (err != CL_SUCCESS) {
1009 param->resize(elements);
1013 for (
size_type i = 0; i < elements; i++) {
1014 (*param)[i] = T(value[i],
true);
1021 template <
typename Func>
1025 cl_int err = f(name, 0, NULL, &required);
1026 if (err != CL_SUCCESS) {
1034 err = f(name, required, value.data(), NULL);
1035 if (err != CL_SUCCESS) {
1039 param->assign(begin(value), prev(end(value)));
1049 template <
typename Func,
size_type N>
1053 cl_int err = f(name, 0, NULL, &required);
1054 if (err != CL_SUCCESS) {
1061 err = f(name, required, value.data(), NULL);
1062 if (err != CL_SUCCESS) {
1071 for (
size_type i = 0; i < elements; ++i) {
1072 (*param)[i] = value[i];
1086 template<
typename Func,
typename T>
1087 inline cl_int
getInfoHelper(Func f, cl_uint name, T* param,
int,
typename T::cl_type = 0)
1089 typename T::cl_type value;
1090 cl_int err = f(name,
sizeof(value), &value, NULL);
1091 if (err != CL_SUCCESS) {
1097 err = param->retain();
1098 if (err != CL_SUCCESS) {
1105 #define CL_HPP_PARAM_NAME_INFO_1_0_(F) \
1106 F(cl_platform_info, CL_PLATFORM_PROFILE, string) \
1107 F(cl_platform_info, CL_PLATFORM_VERSION, string) \
1108 F(cl_platform_info, CL_PLATFORM_NAME, string) \
1109 F(cl_platform_info, CL_PLATFORM_VENDOR, string) \
1110 F(cl_platform_info, CL_PLATFORM_EXTENSIONS, string) \
1112 F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
1113 F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
1114 F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
1115 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
1116 F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, size_type) \
1117 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, cl::vector<size_type>) \
1118 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
1119 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
1120 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
1121 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
1122 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
1123 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
1124 F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
1125 F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
1126 F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
1127 F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
1128 F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
1129 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, size_type) \
1130 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, size_type) \
1131 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, size_type) \
1132 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, size_type) \
1133 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, size_type) \
1134 F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
1135 F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, size_type) \
1136 F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
1137 F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
1138 F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
1139 F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
1140 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
1141 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
1142 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
1143 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
1144 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
1145 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
1146 F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
1147 F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
1148 F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
1149 F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, size_type) \
1150 F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
1151 F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
1152 F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
1153 F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
1154 F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
1155 F(cl_device_info, CL_DEVICE_NAME, string) \
1156 F(cl_device_info, CL_DEVICE_VENDOR, string) \
1157 F(cl_device_info, CL_DRIVER_VERSION, string) \
1158 F(cl_device_info, CL_DEVICE_PROFILE, string) \
1159 F(cl_device_info, CL_DEVICE_VERSION, string) \
1160 F(cl_device_info, CL_DEVICE_EXTENSIONS, string) \
1162 F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
1163 F(cl_context_info, CL_CONTEXT_DEVICES, cl::vector<Device>) \
1164 F(cl_context_info, CL_CONTEXT_PROPERTIES, cl::vector<cl_context_properties>) \
1166 F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
1167 F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
1168 F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
1169 F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
1171 F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
1172 F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
1173 F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
1174 F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
1176 F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
1177 F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
1178 F(cl_mem_info, CL_MEM_SIZE, size_type) \
1179 F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
1180 F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
1181 F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
1182 F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
1184 F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
1185 F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, size_type) \
1186 F(cl_image_info, CL_IMAGE_ROW_PITCH, size_type) \
1187 F(cl_image_info, CL_IMAGE_SLICE_PITCH, size_type) \
1188 F(cl_image_info, CL_IMAGE_WIDTH, size_type) \
1189 F(cl_image_info, CL_IMAGE_HEIGHT, size_type) \
1190 F(cl_image_info, CL_IMAGE_DEPTH, size_type) \
1192 F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
1193 F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
1194 F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_bool) \
1195 F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_addressing_mode) \
1196 F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_filter_mode) \
1198 F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
1199 F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
1200 F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
1201 F(cl_program_info, CL_PROGRAM_DEVICES, cl::vector<Device>) \
1202 F(cl_program_info, CL_PROGRAM_SOURCE, string) \
1203 F(cl_program_info, CL_PROGRAM_BINARY_SIZES, cl::vector<size_type>) \
1204 F(cl_program_info, CL_PROGRAM_BINARIES, cl::vector<cl::vector<unsigned char>>) \
1206 F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
1207 F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, string) \
1208 F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, string) \
1210 F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, string) \
1211 F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
1212 F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
1213 F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
1214 F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
1216 F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, size_type) \
1217 F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::detail::size_t_array) \
1218 F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
1220 F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
1221 F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
1222 F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
1223 F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
1226 #define CL_HPP_PARAM_NAME_INFO_1_1_(F) \
1227 F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
1228 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
1229 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
1230 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
1231 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
1232 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
1233 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
1234 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
1235 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
1236 F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
1237 F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
1238 F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, string) \
1240 F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
1241 F(cl_mem_info, CL_MEM_OFFSET, size_type) \
1243 F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, size_type) \
1244 F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
1246 F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
1248 #define CL_HPP_PARAM_NAME_INFO_1_2_(F) \
1249 F(cl_program_info, CL_PROGRAM_NUM_KERNELS, size_type) \
1250 F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, string) \
1252 F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
1254 F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, string) \
1256 F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
1257 F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
1258 F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, string) \
1259 F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, string) \
1260 F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier) \
1262 F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl::Device) \
1263 F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, cl::vector<cl_device_partition_property>) \
1264 F(cl_device_info, CL_DEVICE_PARTITION_TYPE, cl::vector<cl_device_partition_property>) \
1265 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
1266 F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, size_type) \
1267 F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
1268 F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, string) \
1270 F(cl_image_info, CL_IMAGE_ARRAY_SIZE, size_type) \
1271 F(cl_image_info, CL_IMAGE_NUM_MIP_LEVELS, cl_uint) \
1272 F(cl_image_info, CL_IMAGE_NUM_SAMPLES, cl_uint)
1274 #define CL_HPP_PARAM_NAME_INFO_2_0_(F) \
1275 F(cl_device_info, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, cl_command_queue_properties) \
1276 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, cl_command_queue_properties) \
1277 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, cl_uint) \
1278 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, cl_uint) \
1279 F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_QUEUES, cl_uint) \
1280 F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_EVENTS, cl_uint) \
1281 F(cl_device_info, CL_DEVICE_MAX_PIPE_ARGS, cl_uint) \
1282 F(cl_device_info, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS, cl_uint) \
1283 F(cl_device_info, CL_DEVICE_PIPE_MAX_PACKET_SIZE, cl_uint) \
1284 F(cl_device_info, CL_DEVICE_SVM_CAPABILITIES, cl_device_svm_capabilities) \
1285 F(cl_device_info, CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT, cl_uint) \
1286 F(cl_device_info, CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT, cl_uint) \
1287 F(cl_device_info, CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT, cl_uint) \
1288 F(cl_command_queue_info, CL_QUEUE_SIZE, cl_uint) \
1289 F(cl_mem_info, CL_MEM_USES_SVM_POINTER, cl_bool) \
1290 F(cl_program_build_info, CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE, size_type) \
1291 F(cl_pipe_info, CL_PIPE_PACKET_SIZE, cl_uint) \
1292 F(cl_pipe_info, CL_PIPE_MAX_PACKETS, cl_uint)
1294 #define CL_HPP_PARAM_NAME_DEVICE_FISSION_(F) \
1295 F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
1296 F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, cl::vector<cl_device_partition_property_ext>) \
1297 F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, cl::vector<cl_device_partition_property_ext>) \
1298 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
1299 F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, cl::vector<cl_device_partition_property_ext>)
1301 template <
typename enum_type, cl_
int Name>
1304 #define CL_HPP_DECLARE_PARAM_TRAITS_(token, param_name, T) \
1307 struct param_traits<detail:: token,param_name> \
1309 enum { value = param_name }; \
1310 typedef T param_type; \
1314 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
1316 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
1317 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1319 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
1320 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
1322 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
1326 #define CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(F) \
1327 F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties)
1329 #define CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(F) \
1330 F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool)
1332 #define CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(F) \
1333 F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer)
1337 #if CL_HPP_TARGET_OPENCL_VERSION > 100 && CL_HPP_MINIMUM_OPENCL_VERSION < 200 && CL_HPP_TARGET_OPENCL_VERSION < 200
1339 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 110
1340 #if CL_HPP_TARGET_OPENCL_VERSION > 110 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
1342 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1343 #if CL_HPP_TARGET_OPENCL_VERSION > 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
1345 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
1347 #if defined(CL_HPP_USE_CL_DEVICE_FISSION)
1349 #endif // CL_HPP_USE_CL_DEVICE_FISSION
1351 #ifdef CL_PLATFORM_ICD_SUFFIX_KHR
1355 #ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
1359 #ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
1362 #ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
1365 #ifdef CL_DEVICE_SIMD_WIDTH_AMD
1368 #ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
1371 #ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
1374 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
1377 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
1380 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
1383 #ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
1386 #ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
1390 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
1393 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
1396 #ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
1399 #ifdef CL_DEVICE_WARP_SIZE_NV
1402 #ifdef CL_DEVICE_GPU_OVERLAP_NV
1405 #ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
1408 #ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
1414 template <
typename Func,
typename T>
1421 template <
typename Func,
typename Arg0>
1427 {
return f_(
arg0_, param, size, value, size_ret); }
1430 template <
typename Func,
typename Arg0,
typename Arg1>
1436 {
return f_(
arg0_,
arg1_, param, size, value, size_ret); }
1439 template <
typename Func,
typename Arg0,
typename T>
1441 getInfo(Func f,
const Arg0& arg0, cl_uint name, T* param)
1447 template <
typename Func,
typename Arg0,
typename Arg1,
typename T>
1449 getInfo(Func f,
const Arg0& arg0,
const Arg1& arg1, cl_uint name, T* param)
1456 template<
typename T>
1457 struct ReferenceHandler
1460 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1477 { return ::clRetainDevice(device); }
1488 { return ::clReleaseDevice(device); }
1490 #else // CL_HPP_TARGET_OPENCL_VERSION >= 120
1495 struct ReferenceHandler<cl_device_id>
1498 static cl_int retain(cl_device_id)
1499 {
return CL_SUCCESS; }
1501 static cl_int release(cl_device_id)
1502 {
return CL_SUCCESS; }
1504 #endif // ! (CL_HPP_TARGET_OPENCL_VERSION >= 120)
1511 {
return CL_SUCCESS; }
1514 {
return CL_SUCCESS; }
1521 { return ::clRetainContext(context); }
1523 { return ::clReleaseContext(context); }
1530 { return ::clRetainCommandQueue(queue); }
1532 { return ::clReleaseCommandQueue(queue); }
1539 { return ::clRetainMemObject(memory); }
1541 { return ::clReleaseMemObject(memory); }
1548 { return ::clRetainSampler(sampler); }
1550 { return ::clReleaseSampler(sampler); }
1557 { return ::clRetainProgram(program); }
1559 { return ::clReleaseProgram(program); }
1566 { return ::clRetainKernel(kernel); }
1568 { return ::clReleaseKernel(kernel); }
1575 { return ::clRetainEvent(event); }
1577 { return ::clReleaseEvent(event); }
1581 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
1583 static cl_uint getVersion(
const vector<char> &versionInfo)
1585 int highVersion = 0;
1588 while(versionInfo[index] !=
'.' ) {
1590 highVersion += versionInfo[index]-
'0';
1594 while(versionInfo[index] !=
' ' && versionInfo[index] !=
'\0') {
1596 lowVersion += versionInfo[index]-
'0';
1599 return (highVersion << 16) | lowVersion;
1602 static cl_uint getPlatformVersion(cl_platform_id platform)
1605 clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
1607 vector<char> versionInfo(size);
1608 clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, versionInfo.data(), &size);
1609 return getVersion(versionInfo);
1612 static cl_uint getDevicePlatformVersion(cl_device_id device)
1614 cl_platform_id platform;
1615 clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
sizeof(platform), &platform, NULL);
1616 return getPlatformVersion(platform);
1619 static cl_uint getContextPlatformVersion(cl_context context)
1624 clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
1627 vector<cl_device_id> devices(size/
sizeof(cl_device_id));
1628 clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices.data(), NULL);
1629 return getDevicePlatformVersion(devices[0]);
1631 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
1633 template <
typename T>
1648 detail::errHandler(
retain(), __RETAIN_ERR);
1660 detail::errHandler(
retain(), __RETAIN_ERR);
1672 detail::errHandler(
release(), __RELEASE_ERR);
1674 detail::errHandler(
retain(), __RETAIN_ERR);
1682 detail::errHandler(
release(), __RELEASE_ERR);
1691 detail::errHandler(
release(), __RELEASE_ERR);
1706 template<
typename Func,
typename U>
1707 friend inline cl_int
getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1742 bool retVal =
false;
1743 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1744 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
1745 if (device != NULL) {
1746 int version = getDevicePlatformVersion(device);
1747 if(version > ((1 << 16) + 1)) {
1751 #else // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1753 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1754 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
1765 referenceCountable_(false)
1767 referenceCountable_ = isReferenceCountable(obj);
1770 detail::errHandler(
retain(), __RETAIN_ERR);
1782 referenceCountable_ = isReferenceCountable(
object_);
1783 detail::errHandler(
retain(), __RETAIN_ERR);
1789 referenceCountable_ = rhs.referenceCountable_;
1791 rhs.referenceCountable_ =
false;
1797 detail::errHandler(
release(), __RELEASE_ERR);
1799 referenceCountable_ = rhs.referenceCountable_;
1800 detail::errHandler(
retain(), __RETAIN_ERR);
1808 detail::errHandler(
release(), __RELEASE_ERR);
1810 referenceCountable_ = rhs.referenceCountable_;
1812 rhs.referenceCountable_ =
false;
1819 detail::errHandler(
release(), __RELEASE_ERR);
1821 referenceCountable_ = isReferenceCountable(
object_);
1834 template<
typename Func,
typename U>
1835 friend inline cl_int
getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1837 template<
typename Func,
typename U>
1842 if(
object_ !=
nullptr && referenceCountable_ ) {
1852 if (
object_ !=
nullptr && referenceCountable_) {
1861 template <
typename T>
1864 return lhs() == rhs();
1867 template <
typename T>
1878 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
1882 class BuildError :
public Error
1887 BuildError(cl_int err,
const char * errStr,
const BuildLogType &vec) : Error(err, errStr), buildLogs(vec)
1897 static inline cl_int buildErrHandler(
1899 const char * errStr,
1902 if (err != CL_SUCCESS) {
1903 throw BuildError(err, errStr, buildLogs);
1911 static inline cl_int buildErrHandler(
1913 const char * errStr,
1921 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
1937 image_channel_order = order;
1938 image_channel_data_type = type;
1945 this->image_channel_data_type = rhs.image_channel_data_type;
1946 this->image_channel_order = rhs.image_channel_order;
1962 static std::once_flag default_initialized_;
1964 static cl_int default_error_;
1971 static void makeDefault();
1978 static void makeDefaultProvided(
const Device &p) {
1983 #ifdef CL_HPP_UNIT_TEST_ENABLE
1990 static void unitTestClearDefault() {
1993 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2002 explicit Device(
const cl_device_id &device,
bool retainObject =
false) :
2010 cl_int *errResult = NULL)
2012 std::call_once(default_initialized_, makeDefault);
2013 detail::errHandler(default_error_);
2014 if (errResult != NULL) {
2015 *errResult = default_error_;
2029 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_device));
2030 detail::errHandler(default_error_);
2073 template <
typename T>
2074 cl_int
getInfo(cl_device_info name, T* param)
const
2076 return detail::errHandler(
2078 __GET_DEVICE_INFO_ERR);
2082 template <cl_
int name>
typename
2087 detail::cl_device_info, name>::param_type param;
2088 cl_int result =
getInfo(name, ¶m);
2098 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
2101 const cl_device_partition_property * properties,
2105 cl_int err = clCreateSubDevices(
object_, properties, 0, NULL, &n);
2106 if (err != CL_SUCCESS) {
2107 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2110 vector<cl_device_id> ids(n);
2111 err = clCreateSubDevices(
object_, properties, n, ids.data(), NULL);
2112 if (err != CL_SUCCESS) {
2113 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2119 devices->resize(ids.size());
2123 for (
size_type i = 0; i < ids.size(); i++) {
2126 (*devices)[i] =
Device(ids[i],
false);
2132 #elif defined(CL_HPP_USE_CL_DEVICE_FISSION)
2138 const cl_device_partition_property_ext * properties,
2139 vector<Device>* devices)
2141 typedef CL_API_ENTRY cl_int
2142 ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
2144 const cl_device_partition_property_ext * ,
2147 cl_uint * ) CL_EXT_SUFFIX__VERSION_1_1;
2149 static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
2153 cl_int err = pfn_clCreateSubDevicesEXT(
object_, properties, 0, NULL, &n);
2154 if (err != CL_SUCCESS) {
2155 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2158 vector<cl_device_id> ids(n);
2159 err = pfn_clCreateSubDevicesEXT(
object_, properties, n, ids.data(), NULL);
2160 if (err != CL_SUCCESS) {
2161 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2166 devices->resize(ids.size());
2170 for (
size_type i = 0; i < ids.size(); i++) {
2173 (*devices)[i] =
Device(ids[i],
false);
2178 #endif // defined(CL_HPP_USE_CL_DEVICE_FISSION)
2195 static std::once_flag default_initialized_;
2197 static cl_int default_error_;
2204 static void makeDefault() {
2208 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2216 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2217 if (err != CL_SUCCESS) {
2218 default_error_ = err;
2222 default_error_ = CL_INVALID_PLATFORM;
2227 err = ::clGetPlatformIDs(n, ids.data(), NULL);
2228 if (err != CL_SUCCESS) {
2229 default_error_ = err;
2235 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2236 catch (cl::Error &e) {
2237 default_error_ = e.err();
2247 static void makeDefaultProvided(
const Platform &p) {
2252 #ifdef CL_HPP_UNIT_TEST_ENABLE
2259 static void unitTestClearDefault() {
2262 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2274 explicit Platform(
const cl_platform_id &platform,
bool retainObject =
false) :
2288 cl_int *errResult = NULL)
2290 std::call_once(default_initialized_, makeDefault);
2291 detail::errHandler(default_error_);
2292 if (errResult != NULL) {
2293 *errResult = default_error_;
2307 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_platform));
2308 detail::errHandler(default_error_);
2313 cl_int
getInfo(cl_platform_info name,
string* param)
const
2315 return detail::errHandler(
2317 __GET_PLATFORM_INFO_ERR);
2321 template <cl_
int name>
typename
2326 detail::cl_platform_info, name>::param_type param;
2327 cl_int result =
getInfo(name, ¶m);
2339 cl_device_type type,
2343 if( devices == NULL ) {
2344 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2346 cl_int err = ::clGetDeviceIDs(
object_, type, 0, NULL, &n);
2347 if (err != CL_SUCCESS) {
2348 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2352 err = ::clGetDeviceIDs(
object_, type, n, ids.data(), NULL);
2353 if (err != CL_SUCCESS) {
2354 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2362 devices->resize(ids.size());
2366 for (
size_type i = 0; i < ids.size(); i++) {
2367 (*devices)[i] =
Device(ids[i],
true);
2373 #if defined(CL_HPP_USE_DX_INTEROP)
2398 cl_d3d10_device_source_khr d3d_device_source,
2400 cl_d3d10_device_set_khr d3d_device_set,
2403 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
2404 cl_platform_id platform,
2405 cl_d3d10_device_source_khr d3d_device_source,
2407 cl_d3d10_device_set_khr d3d_device_set,
2408 cl_uint num_entries,
2409 cl_device_id * devices,
2410 cl_uint* num_devices);
2412 if( devices == NULL ) {
2413 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2416 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
2420 cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
2428 if (err != CL_SUCCESS) {
2429 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2432 vector<cl_device_id> ids(n);
2433 err = pfn_clGetDeviceIDsFromD3D10KHR(
2441 if (err != CL_SUCCESS) {
2442 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2450 devices->resize(ids.size());
2454 for (
size_type i = 0; i < ids.size(); i++) {
2455 (*devices)[i] = Device(ids[i],
true);
2471 if( platforms == NULL ) {
2472 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2475 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2476 if (err != CL_SUCCESS) {
2477 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2481 err = ::clGetPlatformIDs(n, ids.data(), NULL);
2482 if (err != CL_SUCCESS) {
2483 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2487 platforms->resize(ids.size());
2490 for (
size_type i = 0; i < ids.size(); i++) {
2491 (*platforms)[i] =
Platform(ids[i]);
2507 *platform = default_platform;
2521 cl_int * errResult = NULL)
2528 return default_platform;
2531 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
2536 return ::clUnloadPlatformCompiler(
object_);
2538 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
2549 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
2559 return ::clUnloadCompiler();
2561 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
2575 static std::once_flag default_initialized_;
2577 static cl_int default_error_;
2584 static void makeDefault() {
2588 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2592 #if !defined(__APPLE__) && !defined(__MACOS)
2594 cl_platform_id defaultPlatform = p();
2595 cl_context_properties properties[3] = {
2596 CL_CONTEXT_PLATFORM, (cl_context_properties)defaultPlatform, 0
2598 #else // #if !defined(__APPLE__) && !defined(__MACOS)
2599 cl_context_properties *properties =
nullptr;
2600 #endif // #if !defined(__APPLE__) && !defined(__MACOS)
2603 CL_DEVICE_TYPE_DEFAULT,
2609 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2610 catch (cl::Error &e) {
2611 default_error_ = e.err();
2622 static void makeDefaultProvided(
const Context &c) {
2627 #ifdef CL_HPP_UNIT_TEST_ENABLE
2634 static void unitTestClearDefault() {
2637 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2645 cl_context_properties* properties = NULL,
2659 for(
size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
2660 deviceIDs[deviceIndex] = (devices[deviceIndex])();
2664 properties, (cl_uint) numDevices,
2666 notifyFptr, data, &
error);
2668 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2676 cl_context_properties* properties = NULL,
2687 cl_device_id deviceID = device();
2692 notifyFptr, data, &error);
2694 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2705 cl_device_type type,
2706 cl_context_properties* properties = NULL,
2717 #if !defined(__APPLE__) && !defined(__MACOS)
2718 cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
2720 if (properties == NULL) {
2724 if (error != CL_SUCCESS) {
2725 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2733 cl_context_properties platform_id = 0;
2734 for (
unsigned int i = 0; i < platforms.size(); i++) {
2738 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2742 error = platforms[i].getDevices(type, &devices);
2744 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2751 if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
2752 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2758 if (devices.size() > 0) {
2759 platform_id = (cl_context_properties)platforms[i]();
2764 if (platform_id == 0) {
2765 detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
2767 *err = CL_DEVICE_NOT_FOUND;
2772 prop[1] = platform_id;
2773 properties = &prop[0];
2776 object_ = ::clCreateContextFromType(
2777 properties, type, notifyFptr, data, &error);
2779 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2820 std::call_once(default_initialized_, makeDefault);
2821 detail::errHandler(default_error_);
2823 *err = default_error_;
2837 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_context));
2838 detail::errHandler(default_error_);
2850 explicit Context(
const cl_context& context,
bool retainObject =
false) :
2865 template <
typename T>
2866 cl_int
getInfo(cl_context_info name, T* param)
const
2868 return detail::errHandler(
2870 __GET_CONTEXT_INFO_ERR);
2874 template <cl_
int name>
typename
2879 detail::cl_context_info, name>::param_type param;
2880 cl_int result =
getInfo(name, ¶m);
2893 cl_mem_object_type type,
2902 cl_int err = ::clGetSupportedImageFormats(
2909 if (err != CL_SUCCESS) {
2910 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2913 if (numEntries > 0) {
2915 err = ::clGetSupportedImageFormats(
2920 (cl_image_format*)value.data(),
2922 if (err != CL_SUCCESS) {
2923 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2926 formats->assign(begin(value), end(value));
2937 inline void Device::makeDefault()
2942 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2949 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2951 if (error != CL_SUCCESS) {
2952 default_error_ =
error;
2955 default_ = context.
getInfo<CL_CONTEXT_DEVICES>()[0];
2956 default_error_ = CL_SUCCESS;
2959 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2960 catch (cl::Error &e) {
2961 default_error_ = e.err();
2992 explicit Event(
const cl_event& event,
bool retainObject =
false) :
3007 template <
typename T>
3008 cl_int
getInfo(cl_event_info name, T* param)
const
3010 return detail::errHandler(
3012 __GET_EVENT_INFO_ERR);
3016 template <cl_
int name>
typename
3021 detail::cl_event_info, name>::param_type param;
3022 cl_int result =
getInfo(name, ¶m);
3030 template <
typename T>
3034 &::clGetEventProfilingInfo,
object_, name, param),
3035 __GET_EVENT_PROFILE_INFO_ERR);
3039 template <cl_
int name>
typename
3044 detail::cl_profiling_info, name>::param_type param;
3045 cl_int result = getProfilingInfo(name, ¶m);
3058 return detail::errHandler(
3059 ::clWaitForEvents(1, &
object_),
3060 __WAIT_FOR_EVENTS_ERR);
3063 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3070 void (
CL_CALLBACK * pfn_notify)(cl_event, cl_int,
void *),
3071 void * user_data = NULL)
3073 return detail::errHandler(
3074 ::clSetEventCallback(
3079 __SET_EVENT_CALLBACK_ERR);
3081 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3090 return detail::errHandler(
3092 (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
3093 __WAIT_FOR_EVENTS_ERR);
3097 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3111 cl_int * err = NULL)
3114 object_ = ::clCreateUserEvent(
3118 detail::errHandler(error, __CREATE_USER_EVENT_ERR);
3133 return detail::errHandler(
3134 ::clSetUserEventStatus(
object_,status),
3135 __SET_USER_EVENT_STATUS_ERR);
3138 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3144 inline static cl_int
3145 WaitForEvents(
const vector<Event>& events)
3147 return detail::errHandler(
3149 (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
3150 __WAIT_FOR_EVENTS_ERR);
3178 explicit Memory(
const cl_mem& memory,
bool retainObject) :
3222 template <
typename T>
3225 return detail::errHandler(
3227 __GET_MEM_OBJECT_INFO_ERR);
3231 template <cl_
int name>
typename
3236 detail::cl_mem_info, name>::param_type param;
3237 cl_int result =
getInfo(name, ¶m);
3244 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3260 void * user_data = NULL)
3262 return detail::errHandler(
3263 ::clSetMemObjectDestructorCallback(
3267 __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
3269 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3275 template<
typename IteratorType >
3276 cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3277 template<
typename IteratorType >
3278 cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3279 template<
typename IteratorType >
3280 cl_int
copy(
const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3281 template<
typename IteratorType >
3282 cl_int
copy(
const CommandQueue &queue,
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3285 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
3298 template<
class Trait = detail::SVMTraitNull>
3304 return CL_MEM_READ_WRITE |
3305 Trait::getSVMMemFlags();
3309 template<
class Trait = detail::SVMTraitNull>
3315 return CL_MEM_READ_ONLY |
3316 Trait::getSVMMemFlags();
3320 template<
class Trait = detail::SVMTraitNull>
3326 return CL_MEM_WRITE_ONLY |
3327 Trait::getSVMMemFlags();
3331 template<
class Trait = SVMTraitReadWrite<>>
3337 return Trait::getSVMMemFlags();
3341 template<
class Trait = SVMTraitReadWrite<>>
3347 return CL_MEM_SVM_FINE_GRAIN_BUFFER |
3348 Trait::getSVMMemFlags();
3352 template<
class Trait = SVMTraitReadWrite<>>
3359 CL_MEM_SVM_FINE_GRAIN_BUFFER |
3360 CL_MEM_SVM_ATOMICS |
3361 Trait::getSVMMemFlags();
3366 template<
typename T>
3372 const vector<Event>* events = NULL,
3373 Event* event = NULL);
3386 template<
typename T,
class SVMTrait>
3400 template<
typename U>
3406 template<
typename U,
typename V>
3421 context_(other.context_)
3425 template<
typename U>
3427 context_(other.context_)
3437 return std::addressof(r);
3442 return std::addressof(r);
3459 SVMTrait::getSVMMemFlags(),
3464 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3466 std::bad_alloc excep;
3469 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3472 if (!(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) {
3473 cl_int err =
enqueueMapSVM(retValue, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, size*
sizeof(T));
3474 if (err != CL_SUCCESS) {
3475 std::bad_alloc excep;
3486 clSVMFree(context_(), p);
3495 size_type maxSize = std::numeric_limits<size_type>::max() /
sizeof(T);
3500 static_cast<size_type>(d.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>()));
3506 template<
class U,
class... Args >
3523 return (context_==rhs.context_);
3533 template<
class SVMTrait>
3540 template<
typename U>
3546 template<
typename U,
typename V>
3550 #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
3553 template<
class Alloc>
3567 Alloc tmpAlloc{ alloc_ };
3568 std::allocator_traits<Alloc>::destroy(tmpAlloc, std::addressof(*ptr));
3569 std::allocator_traits<Alloc>::deallocate(tmpAlloc, ptr, copies_);
3580 template <
class T,
class Alloc,
class... Args>
3583 Alloc alloc(alloc_);
3589 T* tmp = std::allocator_traits<Alloc>::allocate(alloc, copies);
3591 std::bad_alloc excep;
3595 std::allocator_traits<Alloc>::construct(
3597 std::addressof(*tmp),
3598 std::forward<Args>(args)...);
3602 catch (std::bad_alloc b)
3604 std::allocator_traits<Alloc>::deallocate(alloc, tmp, copies);
3609 template<
class T,
class SVMTrait,
class... Args >
3613 return cl::allocate_pointer<T>(alloc, args...);
3616 template<
class T,
class SVMTrait,
class... Args >
3620 return cl::allocate_pointer<T>(alloc, args...);
3622 #endif // #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
3627 template <
class T >
3633 template <
class T >
3639 template <
class T >
3642 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
3666 void* host_ptr = NULL,
3670 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3672 detail::errHandler(error, __CREATE_BUFFER_ERR);
3690 void* host_ptr = NULL,
3697 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3699 detail::errHandler(error, __CREATE_BUFFER_ERR);
3710 template<
typename IteratorType >
3712 IteratorType startIterator,
3713 IteratorType endIterator,
3715 bool useHostPtr =
false,
3718 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
3721 cl_mem_flags flags = 0;
3723 flags |= CL_MEM_READ_ONLY;
3726 flags |= CL_MEM_READ_WRITE;
3729 flags |= CL_MEM_USE_HOST_PTR;
3732 size_type size =
sizeof(DataType)*(endIterator - startIterator);
3737 object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
3739 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
3742 detail::errHandler(error, __CREATE_BUFFER_ERR);
3748 error =
cl::copy(startIterator, endIterator, *
this);
3749 detail::errHandler(error, __CREATE_BUFFER_ERR);
3761 template<
typename IteratorType >
3762 Buffer(
const Context &context, IteratorType startIterator, IteratorType endIterator,
3763 bool readOnly,
bool useHostPtr =
false, cl_int* err = NULL);
3769 template<
typename IteratorType >
3770 Buffer(
const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
3771 bool readOnly,
bool useHostPtr =
false, cl_int* err = NULL);
3783 explicit Buffer(
const cl_mem& buffer,
bool retainObject =
false) :
3784 Memory(buffer, retainObject) { }
3824 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3831 cl_buffer_create_type buffer_create_type,
3832 const void * buffer_create_info,
3833 cl_int * err = NULL)
3837 result.
object_ = ::clCreateSubBuffer(
3844 detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
3851 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3854 #if defined (CL_HPP_USE_DX_INTEROP)
3863 class BufferD3D10 :
public Buffer
3876 ID3D10Buffer* bufobj,
3877 cl_int * err = NULL) : pfn_clCreateFromD3D10BufferKHR(nullptr)
3879 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
3880 cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
3881 cl_int* errcode_ret);
3882 PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR;
3883 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
3884 vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
3885 cl_platform platform = -1;
3886 for(
int i = 0; i < props.size(); ++i ) {
3887 if( props[i] == CL_CONTEXT_PLATFORM ) {
3888 platform = props[i+1];
3892 #elif CL_HPP_TARGET_OPENCL_VERSION >= 110
3897 object_ = pfn_clCreateFromD3D10BufferKHR(
3903 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3910 BufferD3D10() : Buffer() { }
3919 explicit BufferD3D10(
const cl_mem& buffer,
bool retainObject =
false) :
3920 Buffer(buffer, retainObject) { }
3935 BufferD3D10(
const BufferD3D10& buf) :
3941 BufferD3D10&
operator = (
const BufferD3D10 &buf)
3950 BufferD3D10(BufferD3D10&& buf)
CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {}
3983 cl_int * err = NULL)
3986 object_ = ::clCreateFromGLBuffer(
3992 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
4008 explicit BufferGL(
const cl_mem& buffer,
bool retainObject =
false) :
4009 Buffer(buffer, retainObject) { }
4051 cl_gl_object_type *type,
4052 cl_GLuint * gl_object_name)
4054 return detail::errHandler(
4055 ::clGetGLObjectInfo(
object_,type,gl_object_name),
4056 __GET_GL_OBJECT_INFO_ERR);
4080 cl_int * err = NULL)
4083 object_ = ::clCreateFromGLRenderbuffer(
4089 detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
4106 Buffer(buffer, retainObject) { }
4148 cl_gl_object_type *type,
4149 cl_GLuint * gl_object_name)
4151 return detail::errHandler(
4152 ::clGetGLObjectInfo(
object_,type,gl_object_name),
4153 __GET_GL_OBJECT_INFO_ERR);
4176 explicit Image(
const cl_mem& image,
bool retainObject =
false) :
4177 Memory(image, retainObject) { }
4220 template <
typename T>
4223 return detail::errHandler(
4225 __GET_IMAGE_INFO_ERR);
4229 template <cl_
int name>
typename
4234 detail::cl_image_info, name>::param_type param;
4235 cl_int result = getImageInfo(name, ¶m);
4243 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4262 void* host_ptr = NULL,
4266 cl_image_desc desc =
4268 CL_MEM_OBJECT_IMAGE1D,
4270 0, 0, 0, 0, 0, 0, 0, 0
4280 detail::errHandler(error, __CREATE_IMAGE_ERR);
4296 explicit Image1D(
const cl_mem& image1D,
bool retainObject =
false) :
4297 Image(image1D, retainObject) { }
4354 cl_image_desc desc =
4356 CL_MEM_OBJECT_IMAGE1D_BUFFER,
4358 0, 0, 0, 0, 0, 0, 0,
4369 detail::errHandler(error, __CREATE_IMAGE_ERR);
4385 Image(image1D, retainObject) { }
4436 void* host_ptr = NULL,
4440 cl_image_desc desc =
4442 CL_MEM_OBJECT_IMAGE1D_ARRAY,
4457 detail::errHandler(error, __CREATE_IMAGE_ERR);
4472 explicit Image1DArray(
const cl_mem& imageArray,
bool retainObject =
false) :
4473 Image(imageArray, retainObject) { }
4511 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4534 void* host_ptr = NULL,
4538 bool useCreateImage;
4540 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
4543 cl_uint version = detail::getContextPlatformVersion(context());
4544 useCreateImage = (version >= 0x10002);
4546 #elif CL_HPP_TARGET_OPENCL_VERSION >= 120
4547 useCreateImage =
true;
4549 useCreateImage =
false;
4552 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4555 cl_image_desc desc =
4557 CL_MEM_OBJECT_IMAGE2D,
4572 detail::errHandler(error, __CREATE_IMAGE_ERR);
4577 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
4578 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
4579 if (!useCreateImage)
4582 context(), flags,&format, width, height, row_pitch, host_ptr, &error);
4584 detail::errHandler(error, __CREATE_IMAGE2D_ERR);
4589 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
4592 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
4601 const Buffer &sourceBuffer,
4605 cl_int* err =
nullptr)
4609 cl_image_desc desc =
4611 CL_MEM_OBJECT_IMAGE2D,
4628 detail::errHandler(error, __CREATE_IMAGE_ERR);
4629 if (err !=
nullptr) {
4633 #endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
4635 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
4650 cl_channel_order order,
4651 const Image &sourceImage,
4652 cl_int* err =
nullptr)
4663 cl_uint sourceNumMIPLevels =
4665 cl_uint sourceNumSamples =
4667 cl_image_format sourceFormat =
4672 sourceFormat.image_channel_order = order;
4673 cl_image_desc desc =
4675 CL_MEM_OBJECT_IMAGE2D,
4694 detail::errHandler(error, __CREATE_IMAGE_ERR);
4695 if (err !=
nullptr) {
4699 #endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
4711 explicit Image2D(
const cl_mem& image2D,
bool retainObject =
false) :
4712 Image(image2D, retainObject) { }
4755 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4779 cl_int * err = NULL)
4782 object_ = ::clCreateFromGLTexture2D(
4790 detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
4798 Image2DGL() : Image2D() { }
4807 explicit Image2DGL(
const cl_mem& image,
bool retainObject =
false) :
4808 Image2D(image, retainObject) { }
4823 Image2DGL(
const Image2DGL& img) : Image2D(img) {}
4849 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
4851 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4867 void* host_ptr = NULL,
4871 cl_image_desc desc =
4873 CL_MEM_OBJECT_IMAGE2D_ARRAY,
4890 detail::errHandler(error, __CREATE_IMAGE_ERR);
4905 explicit Image2DArray(
const cl_mem& imageArray,
bool retainObject =
false) :
Image(imageArray, retainObject) { }
4941 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4965 void* host_ptr = NULL,
4969 bool useCreateImage;
4971 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
4974 cl_uint version = detail::getContextPlatformVersion(context());
4975 useCreateImage = (version >= 0x10002);
4977 #elif CL_HPP_TARGET_OPENCL_VERSION >= 120
4978 useCreateImage =
true;
4980 useCreateImage =
false;
4983 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4986 cl_image_desc desc =
4988 CL_MEM_OBJECT_IMAGE3D,
5005 detail::errHandler(error, __CREATE_IMAGE_ERR);
5010 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5011 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
5012 if (!useCreateImage)
5015 context(), flags, &format, width, height, depth, row_pitch,
5016 slice_pitch, host_ptr, &error);
5018 detail::errHandler(error, __CREATE_IMAGE3D_ERR);
5023 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
5036 explicit Image3D(
const cl_mem& image3D,
bool retainObject =
false) :
5037 Image(image3D, retainObject) { }
5078 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
5087 class Image3DGL :
public Image3D
5101 cl_int * err = NULL)
5104 object_ = ::clCreateFromGLTexture3D(
5112 detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
5119 Image3DGL() : Image3D() { }
5128 explicit Image3DGL(
const cl_mem& image,
bool retainObject =
false) :
5129 Image3D(image, retainObject) { }
5144 Image3DGL(
const Image3DGL& img) : Image3D(img) {}
5169 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
5171 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5187 cl_int * err = NULL)
5190 object_ = ::clCreateFromGLTexture(
5198 detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
5213 explicit ImageGL(
const cl_mem& image,
bool retainObject =
false) :
5214 Image(image, retainObject) { }
5250 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5254 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5276 cl_uint packet_size,
5277 cl_uint max_packets,
5282 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
5283 object_ = ::clCreatePipe(context(), flags, packet_size, max_packets,
nullptr, &error);
5285 detail::errHandler(error, __CREATE_PIPE_ERR);
5300 cl_uint packet_size,
5301 cl_uint max_packets,
5308 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
5309 object_ = ::clCreatePipe(context(), flags, packet_size, max_packets,
nullptr, &error);
5311 detail::errHandler(error, __CREATE_PIPE_ERR);
5327 explicit Pipe(
const cl_mem& pipe,
bool retainObject =
false) :
5328 Memory(pipe, retainObject) { }
5369 template <
typename T>
5372 return detail::errHandler(
5374 __GET_PIPE_INFO_ERR);
5378 template <cl_
int name>
typename
5383 detail::cl_pipe_info, name>::param_type param;
5384 cl_int result =
getInfo(name, ¶m);
5391 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
5414 cl_bool normalized_coords,
5415 cl_addressing_mode addressing_mode,
5416 cl_filter_mode filter_mode,
5421 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5422 cl_sampler_properties sampler_properties[] = {
5423 CL_SAMPLER_NORMALIZED_COORDS, normalized_coords,
5424 CL_SAMPLER_ADDRESSING_MODE, addressing_mode,
5425 CL_SAMPLER_FILTER_MODE, filter_mode,
5427 object_ = ::clCreateSamplerWithProperties(
5432 detail::errHandler(error, __CREATE_SAMPLER_WITH_PROPERTIES_ERR);
5444 detail::errHandler(error, __CREATE_SAMPLER_ERR);
5459 explicit Sampler(
const cl_sampler& sampler,
bool retainObject =
false) :
5502 template <
typename T>
5503 cl_int
getInfo(cl_sampler_info name, T* param)
const
5505 return detail::errHandler(
5507 __GET_SAMPLER_INFO_ERR);
5511 template <cl_
int name>
typename
5516 detail::cl_sampler_info, name>::param_type param;
5517 cl_int result =
getInfo(name, ¶m);
5527 class DeviceCommandQueue;
5535 cl_uint dimensions_;
5607 static const NDRange NullRange;
5617 template <
typename T,
class Enable =
void>
5622 template <
typename T>
5626 static const T*
ptr(
const T& value) {
return &value; }
5631 template <
typename T>
5635 static const cl_mem*
ptr(
const T& value) {
return &(value()); }
5653 inline LocalSpaceArg
5671 inline Kernel(
const Program& program,
const char* name, cl_int* err = NULL);
5684 explicit Kernel(
const cl_kernel& kernel,
bool retainObject =
false) :
5726 template <
typename T>
5727 cl_int
getInfo(cl_kernel_info name, T* param)
const
5729 return detail::errHandler(
5731 __GET_KERNEL_INFO_ERR);
5734 template <cl_
int name>
typename
5739 detail::cl_kernel_info, name>::param_type param;
5740 cl_int result =
getInfo(name, ¶m);
5747 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5748 template <
typename T>
5749 cl_int
getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param)
const
5751 return detail::errHandler(
5753 __GET_KERNEL_ARG_INFO_ERR);
5756 template <cl_
int name>
typename
5761 detail::cl_kernel_arg_info, name>::param_type param;
5762 cl_int result = getArgInfo(argIndex, name, ¶m);
5768 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5770 template <
typename T>
5772 const Device& device, cl_kernel_work_group_info name, T* param)
const
5774 return detail::errHandler(
5776 &::clGetKernelWorkGroupInfo,
object_, device(), name, param),
5777 __GET_KERNEL_WORK_GROUP_INFO_ERR);
5780 template <cl_
int name>
typename
5785 detail::cl_kernel_work_group_info, name>::param_type param;
5786 cl_int result = getWorkGroupInfo(device, name, ¶m);
5793 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5794 #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
5797 typedef clGetKernelSubGroupInfoKHR_fn PFN_clGetKernelSubGroupInfoKHR;
5798 static PFN_clGetKernelSubGroupInfoKHR pfn_clGetKernelSubGroupInfoKHR = NULL;
5801 return detail::errHandler(
5802 pfn_clGetKernelSubGroupInfoKHR(
object_, dev(), name, range.
size(), range.
get(),
sizeof(
size_type), param,
nullptr),
5803 __GET_KERNEL_ARG_INFO_ERR);
5806 template <cl_
int name>
5810 cl_int result = getSubGroupInfo(dev, name, range, ¶m);
5816 #endif // #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
5817 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5819 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5822 template<
typename T,
class D>
5825 return detail::errHandler(
5826 ::clSetKernelArgSVMPointer(
object_, index, argPtr.get()),
5827 __SET_KERNEL_ARGS_ERR);
5832 template<
typename T,
class Alloc>
5835 return detail::errHandler(
5836 ::clSetKernelArgSVMPointer(
object_, index, argPtr.data()),
5837 __SET_KERNEL_ARGS_ERR);
5842 template<
typename T>
5843 typename std::enable_if<std::is_pointer<T>::value, cl_int>::type
5846 return detail::errHandler(
5847 ::clSetKernelArgSVMPointer(
object_, index, argPtr),
5848 __SET_KERNEL_ARGS_ERR);
5850 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5854 template <
typename T>
5855 typename std::enable_if<!std::is_pointer<T>::value, cl_int>::type
5858 return detail::errHandler(
5864 __SET_KERNEL_ARGS_ERR);
5869 return detail::errHandler(
5870 ::clSetKernelArg(
object_, index, size, argPtr),
5871 __SET_KERNEL_ARGS_ERR);
5874 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5881 return detail::errHandler(
5882 ::clSetKernelExecInfo(
5884 CL_KERNEL_EXEC_INFO_SVM_PTRS,
5885 sizeof(
void*)*pointerList.size(),
5886 pointerList.data()));
5893 template<
int ArrayLength>
5896 return detail::errHandler(
5897 ::clSetKernelExecInfo(
5899 CL_KERNEL_EXEC_INFO_SVM_PTRS,
5900 sizeof(
void*)*pointerList.size(),
5901 pointerList.data()));
5917 cl_bool svmEnabled_ = svmEnabled ? CL_TRUE : CL_FALSE;
5918 return detail::errHandler(
5919 ::clSetKernelExecInfo(
5921 CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM,
5928 template<
int index,
int ArrayLength,
class D,
typename T0,
typename... Ts>
5931 pointerList[index] =
static_cast<void*
>(t0.get());
5932 setSVMPointersHelper<index + 1, Ts...>(ts...);
5935 template<
int index,
int ArrayLength,
typename T0,
typename... Ts>
5936 typename std::enable_if<std::is_pointer<T0>::value,
void>::type
5939 pointerList[index] =
static_cast<void*
>(t0);
5940 setSVMPointersHelper<index + 1, Ts...>(ts...);
5943 template<
int index,
int ArrayLength,
typename T0,
class D>
5946 pointerList[index] =
static_cast<void*
>(t0.get());
5949 template<
int index,
int ArrayLength,
typename T0>
5950 typename std::enable_if<std::is_pointer<T0>::value,
void>::type
5953 pointerList[index] =
static_cast<void*
>(t0);
5956 template<
typename T0,
typename... Ts>
5959 std::array<
void*, 1 +
sizeof...(Ts)> pointerList;
5961 setSVMPointersHelper<0, 1 +
sizeof...(Ts)>(pointerList, t0, ts...);
5962 return detail::errHandler(
5963 ::clSetKernelExecInfo(
5965 CL_KERNEL_EXEC_INFO_SVM_PTRS,
5966 sizeof(
void*)*(1 +
sizeof...(Ts)),
5967 pointerList.data()));
5969 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5978 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
5981 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
5984 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
5987 const string& source,
5993 const char * strings = source.c_str();
5998 object_ = ::clCreateProgramWithSource(
5999 context(), (cl_uint)1, &strings, &length, &error);
6001 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6003 if (error == CL_SUCCESS && build) {
6005 error = ::clBuildProgram(
6009 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6017 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6027 const string& source,
6033 const char * strings = source.c_str();
6036 object_ = ::clCreateProgramWithSource(
6037 context(), (cl_uint)1, &strings, &length, &error);
6039 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6041 if (error == CL_SUCCESS && build) {
6042 error = ::clBuildProgram(
6046 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6054 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6079 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6080 strings[i] = sources[(int)i].data();
6081 lengths[i] = sources[(int)i].length();
6082 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6083 strings[i] = sources[(int)i].first;
6084 lengths[i] = sources[(int)i].second;
6085 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6088 object_ = ::clCreateProgramWithSource(
6089 context(), (cl_uint)n, strings.data(), lengths.data(), &
error);
6091 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6114 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6115 strings[i] = sources[(int)i].data();
6116 lengths[i] = sources[(int)i].length();
6117 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6118 strings[i] = sources[(int)i].first;
6119 lengths[i] = sources[(int)i].second;
6120 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6123 object_ = ::clCreateProgramWithSource(
6124 context(), (cl_uint)n, strings.data(), lengths.data(), &
error);
6126 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6160 const size_type numDevices = devices.size();
6163 if(binaries.size() != numDevices) {
6164 error = CL_INVALID_VALUE;
6165 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
6175 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6176 for (
size_type i = 0; i < numDevices; ++i) {
6177 images[i] = binaries[i].data();
6178 lengths[i] = binaries[(int)i].size();
6180 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6181 for (
size_type i = 0; i < numDevices; ++i) {
6182 images[i] = (
const unsigned char*)binaries[i].first;
6183 lengths[i] = binaries[(int)i].second;
6185 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6188 for(
size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6189 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6193 binaryStatus->resize(numDevices);
6196 object_ = ::clCreateProgramWithBinary(
6197 context(), (cl_uint) devices.size(),
6199 lengths.data(), images.data(), (binaryStatus != NULL && numDevices > 0)
6200 ? &binaryStatus->front()
6203 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
6210 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6218 const string& kernelNames,
6226 for(
size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6227 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6230 object_ = ::clCreateProgramWithBuiltInKernels(
6232 (cl_uint) devices.size(),
6234 kernelNames.c_str(),
6237 detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
6242 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6253 explicit Program(
const cl_program& program,
bool retainObject =
false) :
6292 const char* options = NULL,
6293 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6294 void* data = NULL)
const
6299 for(
size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6300 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6303 cl_int buildError = ::clBuildProgram(
6312 return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6316 const char* options = NULL,
6317 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6318 void* data = NULL)
const
6320 cl_int buildError = ::clBuildProgram(
6329 return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6332 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6334 const char* options = NULL,
6335 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6336 void* data = NULL)
const
6338 cl_int error = ::clCompileProgram(
6348 return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6350 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6352 template <
typename T>
6353 cl_int
getInfo(cl_program_info name, T* param)
const
6355 return detail::errHandler(
6357 __GET_PROGRAM_INFO_ERR);
6360 template <cl_
int name>
typename
6365 detail::cl_program_info, name>::param_type param;
6366 cl_int result =
getInfo(name, ¶m);
6373 template <
typename T>
6375 const Device& device, cl_program_build_info name, T* param)
const
6377 return detail::errHandler(
6379 &::clGetProgramBuildInfo,
object_, device(), name, param),
6380 __GET_PROGRAM_BUILD_INFO_ERR);
6383 template <cl_
int name>
typename
6388 detail::cl_program_build_info, name>::param_type param;
6389 cl_int result = getBuildInfo(device, name, ¶m);
6401 template <cl_
int name>
6405 cl_int result = CL_SUCCESS;
6407 auto devs = getInfo<CL_PROGRAM_DEVICES>(&result);
6412 if (result != CL_SUCCESS) {
6421 detail::cl_program_build_info, name>::param_type param;
6422 result = getBuildInfo(d, name, ¶m);
6426 if (result != CL_SUCCESS) {
6434 if (result != CL_SUCCESS) {
6443 cl_int err = ::clCreateKernelsInProgram(
object_, 0, NULL, &numKernels);
6444 if (err != CL_SUCCESS) {
6445 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
6450 err = ::clCreateKernelsInProgram(
6451 object_, numKernels, value.data(), NULL);
6452 if (err != CL_SUCCESS) {
6453 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
6457 kernels->resize(value.size());
6461 for (
size_type i = 0; i < value.size(); i++) {
6464 (*kernels)[i] =
Kernel(value[i],
false);
6471 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6475 const char* options = NULL,
6476 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6480 cl_int error_local = CL_SUCCESS;
6482 cl_program programs[2] = { input1(), input2() };
6485 if(error_local!=CL_SUCCESS) {
6486 detail::errHandler(error_local, __LINK_PROGRAM_ERR);
6489 cl_program prog = ::clLinkProgram(
6500 detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
6510 const char* options = NULL,
6511 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6515 cl_int error_local = CL_SUCCESS;
6519 for (
unsigned int i = 0; i < inputPrograms.size(); i++) {
6520 programs[i] = inputPrograms[i]();
6524 if(inputPrograms.size() > 0) {
6525 ctx = inputPrograms[0].
getInfo<CL_PROGRAM_CONTEXT>(&error_local);
6526 if(error_local!=CL_SUCCESS) {
6527 detail::errHandler(error_local, __LINK_PROGRAM_ERR);
6530 cl_program prog = ::clLinkProgram(
6535 (cl_uint)inputPrograms.size(),
6541 detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
6548 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6554 if (name != CL_PROGRAM_BINARIES) {
6555 return CL_INVALID_VALUE;
6565 param->resize(numBinaries);
6566 for (
size_type i = 0; i < numBinaries; ++i) {
6567 (*param)[i].resize(sizes[i]);
6570 return detail::errHandler(
6572 __GET_PROGRAM_INFO_ERR);
6583 cl_int result =
getInfo(CL_PROGRAM_BINARIES, &binariesVectors);
6587 return binariesVectors;
6594 object_ = ::clCreateKernel(program(), name, &error);
6595 detail::errHandler(error, __CREATE_KERNEL_ERR);
6607 OutOfOrder = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
6612 return static_cast<QueueProperties>(
static_cast<cl_command_queue_properties
>(lhs) | static_cast<cl_command_queue_properties>(rhs));
6621 static std::once_flag default_initialized_;
6623 static cl_int default_error_;
6630 static void makeDefault()
6635 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
6642 if (error != CL_SUCCESS) {
6643 default_error_ =
error;
6647 default_ =
CommandQueue(context, device, 0, &default_error_);
6650 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
6651 catch (cl::Error &e) {
6652 default_error_ = e.err();
6662 static void makeDefaultProvided(
const CommandQueue &c) {
6667 #ifdef CL_HPP_UNIT_TEST_ENABLE
6674 static void unitTestClearDefault() {
6677 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
6685 cl_command_queue_properties properties,
6691 detail::errHandler(error, __CREATE_CONTEXT_ERR);
6693 if (error != CL_SUCCESS) {
6701 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6702 cl_queue_properties queue_properties[] = {
6703 CL_QUEUE_PROPERTIES, properties, 0 };
6704 if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
6705 object_ = ::clCreateCommandQueueWithProperties(
6706 context(), device(), queue_properties, &error);
6709 error = CL_INVALID_QUEUE_PROPERTIES;
6712 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6717 object_ = ::clCreateCommandQueue(
6718 context(), device(), properties, &error);
6720 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6739 detail::errHandler(error, __CREATE_CONTEXT_ERR);
6741 if (error != CL_SUCCESS) {
6749 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6750 cl_queue_properties queue_properties[] = {
6751 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
6753 object_ = ::clCreateCommandQueueWithProperties(
6754 context(), device(), queue_properties, &error);
6757 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6762 object_ = ::clCreateCommandQueue(
6763 context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
6765 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6779 cl_command_queue_properties properties = 0,
6784 error = context.
getInfo(CL_CONTEXT_DEVICES, &devices);
6786 detail::errHandler(error, __CREATE_CONTEXT_ERR);
6788 if (error != CL_SUCCESS)
6796 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6797 cl_queue_properties queue_properties[] = {
6798 CL_QUEUE_PROPERTIES, properties, 0 };
6799 if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
6800 object_ = ::clCreateCommandQueueWithProperties(
6801 context(), devices[0](), queue_properties, &error);
6804 error = CL_INVALID_QUEUE_PROPERTIES;
6807 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6812 object_ = ::clCreateCommandQueue(
6813 context(), devices[0](), properties, &error);
6815 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6834 error = context.
getInfo(CL_CONTEXT_DEVICES, &devices);
6836 detail::errHandler(error, __CREATE_CONTEXT_ERR);
6838 if (error != CL_SUCCESS)
6846 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6847 cl_queue_properties queue_properties[] = {
6848 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
6849 object_ = ::clCreateCommandQueueWithProperties(
6850 context(), devices[0](), queue_properties, &error);
6852 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6857 object_ = ::clCreateCommandQueue(
6858 context(), devices[0](), static_cast<cl_command_queue_properties>(properties), &error);
6860 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6875 cl_command_queue_properties properties = 0,
6880 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6881 cl_queue_properties queue_properties[] = {
6882 CL_QUEUE_PROPERTIES, properties, 0 };
6883 object_ = ::clCreateCommandQueueWithProperties(
6884 context(), device(), queue_properties, &error);
6886 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6891 object_ = ::clCreateCommandQueue(
6892 context(), device(), properties, &error);
6894 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6913 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6914 cl_queue_properties queue_properties[] = {
6915 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
6916 object_ = ::clCreateCommandQueueWithProperties(
6917 context(), device(), queue_properties, &error);
6919 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6924 object_ = ::clCreateCommandQueue(
6925 context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
6927 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
6936 std::call_once(default_initialized_, makeDefault);
6937 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6938 detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
6939 #else // CL_HPP_TARGET_OPENCL_VERSION >= 200
6940 detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_ERR);
6941 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
6943 *err = default_error_;
6957 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_queue));
6958 detail::errHandler(default_error_);
6971 explicit CommandQueue(
const cl_command_queue& commandQueue,
bool retainObject =
false) :
7008 template <
typename T>
7009 cl_int
getInfo(cl_command_queue_info name, T* param)
const
7011 return detail::errHandler(
7013 &::clGetCommandQueueInfo,
object_, name, param),
7014 __GET_COMMAND_QUEUE_INFO_ERR);
7017 template <cl_
int name>
typename
7022 detail::cl_command_queue_info, name>::param_type param;
7023 cl_int result =
getInfo(name, ¶m);
7037 Event* event = NULL)
const
7040 cl_int err = detail::errHandler(
7041 ::clEnqueueReadBuffer(
7042 object_, buffer(), blocking, offset, size,
7044 (events != NULL) ? (cl_uint) events->size() : 0,
7045 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7046 (
event != NULL) ? &tmp : NULL),
7047 __ENQUEUE_READ_BUFFER_ERR);
7049 if (event != NULL && err == CL_SUCCESS)
7062 Event* event = NULL)
const
7065 cl_int err = detail::errHandler(
7066 ::clEnqueueWriteBuffer(
7067 object_, buffer(), blocking, offset, size,
7069 (events != NULL) ? (cl_uint) events->size() : 0,
7070 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7071 (
event != NULL) ? &tmp : NULL),
7072 __ENQUEUE_WRITE_BUFFER_ERR);
7074 if (event != NULL && err == CL_SUCCESS)
7087 Event* event = NULL)
const
7090 cl_int err = detail::errHandler(
7091 ::clEnqueueCopyBuffer(
7092 object_, src(), dst(), src_offset, dst_offset, size,
7093 (events != NULL) ? (cl_uint) events->size() : 0,
7094 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7095 (
event != NULL) ? &tmp : NULL),
7096 __ENQEUE_COPY_BUFFER_ERR);
7098 if (event != NULL && err == CL_SUCCESS)
7116 Event* event = NULL)
const
7119 cl_int err = detail::errHandler(
7120 ::clEnqueueReadBufferRect(
7124 buffer_offset.data(),
7132 (events != NULL) ? (cl_uint) events->size() : 0,
7133 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7134 (
event != NULL) ? &tmp : NULL),
7135 __ENQUEUE_READ_BUFFER_RECT_ERR);
7137 if (event != NULL && err == CL_SUCCESS)
7155 Event* event = NULL)
const
7158 cl_int err = detail::errHandler(
7159 ::clEnqueueWriteBufferRect(
7163 buffer_offset.data(),
7171 (events != NULL) ? (cl_uint) events->size() : 0,
7172 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7173 (
event != NULL) ? &tmp : NULL),
7174 __ENQUEUE_WRITE_BUFFER_RECT_ERR);
7176 if (event != NULL && err == CL_SUCCESS)
7193 Event* event = NULL)
const
7196 cl_int err = detail::errHandler(
7197 ::clEnqueueCopyBufferRect(
7208 (events != NULL) ? (cl_uint) events->size() : 0,
7209 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7210 (
event != NULL) ? &tmp : NULL),
7211 __ENQEUE_COPY_BUFFER_RECT_ERR);
7213 if (event != NULL && err == CL_SUCCESS)
7219 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
7231 template<
typename PatternType>
7234 PatternType pattern,
7238 Event* event = NULL)
const
7241 cl_int err = detail::errHandler(
7242 ::clEnqueueFillBuffer(
7245 static_cast<void*>(&pattern),
7246 sizeof(PatternType),
7249 (events != NULL) ? (cl_uint) events->size() : 0,
7250 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7251 (
event != NULL) ? &tmp : NULL),
7252 __ENQUEUE_FILL_BUFFER_ERR);
7254 if (event != NULL && err == CL_SUCCESS)
7259 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
7270 Event* event = NULL)
const
7273 cl_int err = detail::errHandler(
7274 ::clEnqueueReadImage(
7283 (events != NULL) ? (cl_uint) events->size() : 0,
7284 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7285 (
event != NULL) ? &tmp : NULL),
7286 __ENQUEUE_READ_IMAGE_ERR);
7288 if (event != NULL && err == CL_SUCCESS)
7303 Event* event = NULL)
const
7306 cl_int err = detail::errHandler(
7307 ::clEnqueueWriteImage(
7316 (events != NULL) ? (cl_uint) events->size() : 0,
7317 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7318 (
event != NULL) ? &tmp : NULL),
7319 __ENQUEUE_WRITE_IMAGE_ERR);
7321 if (event != NULL && err == CL_SUCCESS)
7334 Event* event = NULL)
const
7337 cl_int err = detail::errHandler(
7338 ::clEnqueueCopyImage(
7345 (events != NULL) ? (cl_uint) events->size() : 0,
7346 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7347 (
event != NULL) ? &tmp : NULL),
7348 __ENQUEUE_COPY_IMAGE_ERR);
7350 if (event != NULL && err == CL_SUCCESS)
7356 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
7366 cl_float4 fillColor,
7370 Event* event = NULL)
const
7373 cl_int err = detail::errHandler(
7374 ::clEnqueueFillImage(
7377 static_cast<void*>(&fillColor),
7380 (events != NULL) ? (cl_uint) events->size() : 0,
7381 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7382 (
event != NULL) ? &tmp : NULL),
7383 __ENQUEUE_FILL_IMAGE_ERR);
7385 if (event != NULL && err == CL_SUCCESS)
7404 Event* event = NULL)
const
7407 cl_int err = detail::errHandler(
7408 ::clEnqueueFillImage(
7411 static_cast<void*>(&fillColor),
7414 (events != NULL) ? (cl_uint) events->size() : 0,
7415 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7416 (
event != NULL) ? &tmp : NULL),
7417 __ENQUEUE_FILL_IMAGE_ERR);
7419 if (event != NULL && err == CL_SUCCESS)
7438 Event* event = NULL)
const
7441 cl_int err = detail::errHandler(
7442 ::clEnqueueFillImage(
7445 static_cast<void*>(&fillColor),
7448 (events != NULL) ? (cl_uint) events->size() : 0,
7449 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7450 (
event != NULL) ? &tmp : NULL),
7451 __ENQUEUE_FILL_IMAGE_ERR);
7453 if (event != NULL && err == CL_SUCCESS)
7458 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
7467 Event* event = NULL)
const
7470 cl_int err = detail::errHandler(
7471 ::clEnqueueCopyImageToBuffer(
7478 (events != NULL) ? (cl_uint) events->size() : 0,
7479 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7480 (
event != NULL) ? &tmp : NULL),
7481 __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
7483 if (event != NULL && err == CL_SUCCESS)
7496 Event* event = NULL)
const
7499 cl_int err = detail::errHandler(
7500 ::clEnqueueCopyBufferToImage(
7507 (events != NULL) ? (cl_uint) events->size() : 0,
7508 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7509 (
event != NULL) ? &tmp : NULL),
7510 __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
7512 if (event != NULL && err == CL_SUCCESS)
7525 Event* event = NULL,
7526 cl_int* err = NULL)
const
7530 void * result = ::clEnqueueMapBuffer(
7531 object_, buffer(), blocking, flags, offset, size,
7532 (events != NULL) ? (cl_uint) events->size() : 0,
7533 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7534 (
event != NULL) ? &tmp : NULL,
7537 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
7541 if (event != NULL && error == CL_SUCCESS)
7548 const Image& buffer,
7556 Event* event = NULL,
7557 cl_int* err = NULL)
const
7561 void * result = ::clEnqueueMapImage(
7562 object_, buffer(), blocking, flags,
7565 row_pitch, slice_pitch,
7566 (events != NULL) ? (cl_uint) events->size() : 0,
7567 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7568 (
event != NULL) ? &tmp : NULL,
7571 detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
7575 if (event != NULL && error == CL_SUCCESS)
7580 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7585 template<
typename T>
7592 Event* event = NULL)
const
7595 cl_int err = detail::errHandler(::clEnqueueSVMMap(
7596 object_, blocking, flags, static_cast<void*>(ptr), size,
7597 (events != NULL) ? (cl_uint)events->size() : 0,
7598 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7599 (
event != NULL) ? &tmp : NULL),
7600 __ENQUEUE_MAP_BUFFER_ERR);
7602 if (event != NULL && err == CL_SUCCESS)
7613 template<
typename T,
class D>
7620 Event* event = NULL)
const
7623 cl_int err = detail::errHandler(::clEnqueueSVMMap(
7624 object_, blocking, flags, static_cast<void*>(ptr.get()), size,
7625 (events != NULL) ? (cl_uint)events->size() : 0,
7626 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7627 (
event != NULL) ? &tmp : NULL),
7628 __ENQUEUE_MAP_BUFFER_ERR);
7630 if (event != NULL && err == CL_SUCCESS)
7640 template<
typename T,
class Alloc>
7646 Event* event = NULL)
const
7649 cl_int err = detail::errHandler(::clEnqueueSVMMap(
7650 object_, blocking, flags, static_cast<void*>(container.data()), container.size(),
7651 (events != NULL) ? (cl_uint)events->size() : 0,
7652 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7653 (
event != NULL) ? &tmp : NULL),
7654 __ENQUEUE_MAP_BUFFER_ERR);
7656 if (event != NULL && err == CL_SUCCESS)
7661 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7667 Event* event = NULL)
const
7670 cl_int err = detail::errHandler(
7671 ::clEnqueueUnmapMemObject(
7672 object_, memory(), mapped_ptr,
7673 (events != NULL) ? (cl_uint) events->size() : 0,
7674 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7675 (
event != NULL) ? &tmp : NULL),
7676 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
7678 if (event != NULL && err == CL_SUCCESS)
7685 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7690 template<
typename T>
7694 Event* event = NULL)
const
7697 cl_int err = detail::errHandler(
7698 ::clEnqueueSVMUnmap(
7699 object_, static_cast<void*>(ptr),
7700 (events != NULL) ? (cl_uint)events->size() : 0,
7701 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7702 (
event != NULL) ? &tmp : NULL),
7703 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
7705 if (event != NULL && err == CL_SUCCESS)
7715 template<
typename T,
class D>
7719 Event* event = NULL)
const
7722 cl_int err = detail::errHandler(
7723 ::clEnqueueSVMUnmap(
7724 object_, static_cast<void*>(ptr.get()),
7725 (events != NULL) ? (cl_uint)events->size() : 0,
7726 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7727 (
event != NULL) ? &tmp : NULL),
7728 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
7730 if (event != NULL && err == CL_SUCCESS)
7740 template<
typename T,
class Alloc>
7744 Event* event = NULL)
const
7747 cl_int err = detail::errHandler(
7748 ::clEnqueueSVMUnmap(
7749 object_, static_cast<void*>(container.data()),
7750 (events != NULL) ? (cl_uint)events->size() : 0,
7751 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
7752 (
event != NULL) ? &tmp : NULL),
7753 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
7755 if (event != NULL && err == CL_SUCCESS)
7760 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7762 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
7779 cl_int err = detail::errHandler(
7780 ::clEnqueueMarkerWithWaitList(
7782 (events != NULL) ? (cl_uint) events->size() : 0,
7783 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7784 (
event != NULL) ? &tmp : NULL),
7785 __ENQUEUE_MARKER_WAIT_LIST_ERR);
7787 if (event != NULL && err == CL_SUCCESS)
7809 cl_int err = detail::errHandler(
7810 ::clEnqueueBarrierWithWaitList(
7812 (events != NULL) ? (cl_uint) events->size() : 0,
7813 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7814 (
event != NULL) ? &tmp : NULL),
7815 __ENQUEUE_BARRIER_WAIT_LIST_ERR);
7817 if (event != NULL && err == CL_SUCCESS)
7829 cl_mem_migration_flags flags,
7838 for(
int i = 0; i < (int)memObjects.size(); ++i ) {
7839 localMemObjects[i] = memObjects[i]();
7843 cl_int err = detail::errHandler(
7844 ::clEnqueueMigrateMemObjects(
7846 (cl_uint)memObjects.size(),
7847 localMemObjects.data(),
7849 (events != NULL) ? (cl_uint) events->size() : 0,
7850 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7851 (
event != NULL) ? &tmp : NULL),
7852 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
7854 if (event != NULL && err == CL_SUCCESS)
7859 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
7865 const NDRange& local = NullRange,
7867 Event* event = NULL)
const
7870 cl_int err = detail::errHandler(
7871 ::clEnqueueNDRangeKernel(
7876 (events != NULL) ? (cl_uint) events->size() : 0,
7877 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7878 (
event != NULL) ? &tmp : NULL),
7879 __ENQUEUE_NDRANGE_KERNEL_ERR);
7881 if (event != NULL && err == CL_SUCCESS)
7887 #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
7894 cl_int err = detail::errHandler(
7897 (events != NULL) ? (cl_uint) events->size() : 0,
7898 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7899 (
event != NULL) ? &tmp : NULL),
7900 __ENQUEUE_TASK_ERR);
7902 if (event != NULL && err == CL_SUCCESS)
7907 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
7911 std::pair<void*, size_type> args,
7915 Event* event = NULL)
const
7918 if (mem_objects != NULL) {
7919 elements = mem_objects->size();
7922 for (
unsigned int i = 0; i < elements; i++) {
7923 mems[i] = ((*mem_objects)[i])();
7927 cl_int err = detail::errHandler(
7928 ::clEnqueueNativeKernel(
7929 object_, userFptr, args.first, args.second,
7930 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
7932 (mem_locs != NULL && mem_locs->size() > 0) ? (
const void **) &mem_locs->front() : NULL,
7933 (events != NULL) ? (cl_uint) events->size() : 0,
7934 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7935 (
event != NULL) ? &tmp : NULL),
7936 __ENQUEUE_NATIVE_KERNEL);
7938 if (event != NULL && err == CL_SUCCESS)
7947 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
7952 cl_int err = detail::errHandler(
7955 (event != NULL) ? &tmp : NULL),
7956 __ENQUEUE_MARKER_ERR);
7958 if (event != NULL && err == CL_SUCCESS)
7965 cl_int enqueueWaitForEvents(
const vector<Event>& events)
const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
7967 return detail::errHandler(
7968 ::clEnqueueWaitForEvents(
7970 (cl_uint) events.size(),
7971 events.size() > 0 ? (
const cl_event*) &events.front() : NULL),
7972 __ENQUEUE_WAIT_FOR_EVENTS_ERR);
7974 #endif // defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
7979 Event* event = NULL)
const
7982 cl_int err = detail::errHandler(
7983 ::clEnqueueAcquireGLObjects(
7985 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
7986 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
7987 (events != NULL) ? (cl_uint) events->size() : 0,
7988 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7989 (
event != NULL) ? &tmp : NULL),
7990 __ENQUEUE_ACQUIRE_GL_ERR);
7992 if (event != NULL && err == CL_SUCCESS)
8001 Event* event = NULL)
const
8004 cl_int err = detail::errHandler(
8005 ::clEnqueueReleaseGLObjects(
8007 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8008 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8009 (events != NULL) ? (cl_uint) events->size() : 0,
8010 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8011 (
event != NULL) ? &tmp : NULL),
8012 __ENQUEUE_RELEASE_GL_ERR);
8014 if (event != NULL && err == CL_SUCCESS)
8020 #if defined (CL_HPP_USE_DX_INTEROP)
8021 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
8022 cl_command_queue command_queue, cl_uint num_objects,
8023 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
8024 const cl_event* event_wait_list, cl_event* event);
8025 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
8026 cl_command_queue command_queue, cl_uint num_objects,
8027 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
8028 const cl_event* event_wait_list, cl_event* event);
8030 cl_int enqueueAcquireD3D10Objects(
8033 Event* event = NULL)
const
8035 static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
8036 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
8037 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
8038 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
8039 cl_platform_id platform = device.
getInfo<CL_DEVICE_PLATFORM>();
8042 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
8047 cl_int err = detail::errHandler(
8048 pfn_clEnqueueAcquireD3D10ObjectsKHR(
8050 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8051 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8052 (events != NULL) ? (cl_uint) events->size() : 0,
8053 (events != NULL) ? (cl_event*) &events->front() : NULL,
8054 (event != NULL) ? &tmp : NULL),
8055 __ENQUEUE_ACQUIRE_GL_ERR);
8057 if (event != NULL && err == CL_SUCCESS)
8063 cl_int enqueueReleaseD3D10Objects(
8066 Event* event = NULL)
const
8068 static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
8069 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
8070 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
8071 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
8072 cl_platform_id platform = device.
getInfo<CL_DEVICE_PLATFORM>();
8074 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
8075 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
8077 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
8080 cl_int err = detail::errHandler(
8081 pfn_clEnqueueReleaseD3D10ObjectsKHR(
8083 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8084 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8085 (events != NULL) ? (cl_uint) events->size() : 0,
8086 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8087 (event != NULL) ? &tmp : NULL),
8088 __ENQUEUE_RELEASE_GL_ERR);
8090 if (event != NULL && err == CL_SUCCESS)
8100 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
8102 cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
8104 return detail::errHandler(
8106 __ENQUEUE_BARRIER_ERR);
8108 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
8112 return detail::errHandler(::clFlush(
object_), __FLUSH_ERR);
8117 return detail::errHandler(::clFinish(
object_), __FINISH_ERR);
8126 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8135 return static_cast<DeviceQueueProperties>(
static_cast<cl_command_queue_properties
>(lhs) | static_cast<cl_command_queue_properties>(rhs));
8159 cl_command_queue_properties mergedProperties =
8160 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8162 cl_queue_properties queue_properties[] = {
8163 CL_QUEUE_PROPERTIES, mergedProperties, 0 };
8164 object_ = ::clCreateCommandQueueWithProperties(
8165 context(), device(), queue_properties, &error);
8167 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8184 cl_command_queue_properties mergedProperties =
8185 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8186 cl_queue_properties queue_properties[] = {
8187 CL_QUEUE_PROPERTIES, mergedProperties, 0 };
8188 object_ = ::clCreateCommandQueueWithProperties(
8189 context(), device(), queue_properties, &error);
8191 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8209 cl_command_queue_properties mergedProperties =
8210 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8211 cl_queue_properties queue_properties[] = {
8212 CL_QUEUE_PROPERTIES, mergedProperties,
8213 CL_QUEUE_SIZE, queueSize,
8215 object_ = ::clCreateCommandQueueWithProperties(
8216 context(), device(), queue_properties, &error);
8218 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8267 template <
typename T>
8268 cl_int
getInfo(cl_command_queue_info name, T* param)
const
8270 return detail::errHandler(
8272 &::clGetCommandQueueInfo,
object_, name, param),
8273 __GET_COMMAND_QUEUE_INFO_ERR);
8276 template <cl_
int name>
typename
8281 detail::cl_command_queue_info, name>::param_type param;
8282 cl_int result =
getInfo(name, ¶m);
8296 cl_int *err =
nullptr)
8302 cl_command_queue_properties properties =
8303 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
8304 cl_queue_properties queue_properties[] = {
8305 CL_QUEUE_PROPERTIES, properties,
8308 ::clCreateCommandQueueWithProperties(
8309 context(), device(), queue_properties, &error));
8311 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8326 const Context &context,
const Device &device, cl_int *err =
nullptr)
8330 cl_command_queue_properties properties =
8331 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
8332 cl_queue_properties queue_properties[] = {
8333 CL_QUEUE_PROPERTIES, properties,
8336 ::clCreateCommandQueueWithProperties(
8337 context(), device(), queue_properties, &error));
8339 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8354 const Context &context,
const Device &device, cl_uint queueSize, cl_int *err =
nullptr)
8358 cl_command_queue_properties properties =
8359 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
8360 cl_queue_properties queue_properties[] = {
8361 CL_QUEUE_PROPERTIES, properties,
8362 CL_QUEUE_SIZE, queueSize,
8365 ::clCreateCommandQueueWithProperties(
8366 context(), device(), queue_properties, &error));
8368 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8388 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8391 template<
typename IteratorType >
8394 IteratorType startIterator,
8395 IteratorType endIterator,
8400 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
8403 cl_mem_flags flags = 0;
8405 flags |= CL_MEM_READ_ONLY;
8408 flags |= CL_MEM_READ_WRITE;
8411 flags |= CL_MEM_USE_HOST_PTR;
8414 size_type size =
sizeof(DataType)*(endIterator - startIterator);
8417 object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
8419 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
8422 detail::errHandler(error, __CREATE_BUFFER_ERR);
8429 detail::errHandler(error, __CREATE_BUFFER_ERR);
8434 error =
cl::copy(queue, startIterator, endIterator, *
this);
8435 detail::errHandler(error, __CREATE_BUFFER_ERR);
8442 template<
typename IteratorType >
8445 IteratorType startIterator,
8446 IteratorType endIterator,
8451 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
8454 cl_mem_flags flags = 0;
8456 flags |= CL_MEM_READ_ONLY;
8459 flags |= CL_MEM_READ_WRITE;
8462 flags |= CL_MEM_USE_HOST_PTR;
8465 size_type size =
sizeof(DataType)*(endIterator - startIterator);
8470 object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
8473 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
8476 detail::errHandler(error, __CREATE_BUFFER_ERR);
8482 error =
cl::copy(queue, startIterator, endIterator, *
this);
8483 detail::errHandler(error, __CREATE_BUFFER_ERR);
8497 Event* event = NULL)
8502 if (error != CL_SUCCESS) {
8506 return queue.
enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
8516 Event* event = NULL)
8521 if (error != CL_SUCCESS) {
8535 Event* event = NULL,
8540 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8545 void * result = ::clEnqueueMapBuffer(
8546 queue(), buffer(), blocking, flags, offset, size,
8547 (events != NULL) ? (cl_uint) events->size() : 0,
8548 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8552 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8560 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8566 template<
typename T>
8577 if (error != CL_SUCCESS) {
8578 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8582 ptr, blocking, flags, size, events, event);
8590 template<
typename T,
class D>
8597 Event* event = NULL)
8601 if (error != CL_SUCCESS) {
8602 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8606 ptr, blocking, flags, size, events, event);
8614 template<
typename T,
class Alloc>
8620 Event* event = NULL)
8624 if (error != CL_SUCCESS) {
8625 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8629 container, blocking, flags, events, event);
8632 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8638 Event* event = NULL)
8642 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8643 if (error != CL_SUCCESS) {
8648 cl_int err = detail::errHandler(
8649 ::clEnqueueUnmapMemObject(
8650 queue(), memory(), mapped_ptr,
8651 (events != NULL) ? (cl_uint)events->size() : 0,
8652 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8653 (
event != NULL) ? &tmp : NULL),
8654 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8656 if (event != NULL && err == CL_SUCCESS)
8662 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8668 template<
typename T>
8672 Event* event = NULL)
8676 if (error != CL_SUCCESS) {
8677 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8681 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8690 template<
typename T,
class D>
8694 Event* event = NULL)
8698 if (error != CL_SUCCESS) {
8699 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8703 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8711 template<
typename T,
class Alloc>
8715 Event* event = NULL)
8719 if (error != CL_SUCCESS) {
8720 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8723 return detail::errHandler(queue.
enqueueUnmapSVM(container, events, event),
8724 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8727 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8736 Event* event = NULL)
8741 if (error != CL_SUCCESS) {
8745 return queue.
enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
8753 template<
typename IteratorType >
8754 inline cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer )
8758 if (error != CL_SUCCESS)
8761 return cl::copy(queue, startIterator, endIterator, buffer);
8769 template<
typename IteratorType >
8770 inline cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
8774 if (error != CL_SUCCESS)
8777 return cl::copy(queue, buffer, startIterator, endIterator);
8785 template<
typename IteratorType >
8788 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
8791 size_type length = endIterator-startIterator;
8792 size_type byteLength = length*
sizeof(DataType);
8795 static_cast<DataType*
>(queue.
enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
8797 if( error != CL_SUCCESS ) {
8800 #if defined(_MSC_VER)
8804 stdext::checked_array_iterator<DataType*>(
8807 std::copy(startIterator, endIterator, pointer);
8812 if( error != CL_SUCCESS ) {
8824 template<
typename IteratorType >
8827 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
8830 size_type length = endIterator-startIterator;
8831 size_type byteLength = length*
sizeof(DataType);
8834 static_cast<DataType*
>(queue.
enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
8836 if( error != CL_SUCCESS ) {
8839 std::copy(pointer, pointer + length, startIterator);
8843 if( error != CL_SUCCESS ) {
8851 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8855 template<
typename T,
class Alloc>
8858 return enqueueMapSVM(container, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE);
8864 template<
typename T,
class Alloc>
8870 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8872 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
8885 Event* event = NULL)
8890 if (error != CL_SUCCESS) {
8921 Event* event = NULL)
8926 if (error != CL_SUCCESS) {
8956 Event* event = NULL)
8961 if (error != CL_SUCCESS) {
8978 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
8989 Event* event = NULL)
8994 if (error != CL_SUCCESS) {
9019 Event* event = NULL)
9024 if (error != CL_SUCCESS) {
9047 Event* event = NULL)
9052 if (error != CL_SUCCESS) {
9073 Event* event = NULL)
9078 if (error != CL_SUCCESS) {
9099 Event* event = NULL)
9104 if (error != CL_SUCCESS) {
9124 if (error != CL_SUCCESS) {
9128 return queue.
flush();
9136 if (error != CL_SUCCESS) {
9153 template<
typename... Ts>
9190 events_.push_back(e);
9199 events_.push_back(e);
9208 events_.push_back(e);
9274 events_.push_back(e);
9283 events_.push_back(e);
9292 events_.push_back(e);
9334 template<
typename... Ts>
9340 template<
int index,
typename T0,
typename... T1s>
9341 void setArgs(T0&& t0, T1s&&... t1s)
9343 kernel_.
setArg(index, t0);
9344 setArgs<index + 1, T1s...>(std::forward<T1s>(t1s)...);
9347 template<
int index,
typename T0>
9348 void setArgs(T0&& t0)
9350 kernel_.setArg(index, t0);
9366 cl_int * err = NULL) :
9367 kernel_(program, name.c_str(), err)
9383 setArgs<0>(std::forward<Ts>(ts)...);
9408 setArgs<0>(std::forward<Ts>(ts)...);
9421 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9424 return kernel_.setSVMPointers(pointerList);
9427 template<
typename T0,
typename... T1s>
9430 return kernel_.setSVMPointers(t0, ts...);
9432 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9440 namespace compatibility {
9445 template<
typename... Ts>
9455 cl_int * err = NULL) :
9477 enqueueArgs, args...);
9485 #undef CL_HPP_ERR_STR_
9486 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
9487 #undef __GET_DEVICE_INFO_ERR
9488 #undef __GET_PLATFORM_INFO_ERR
9489 #undef __GET_DEVICE_IDS_ERR
9490 #undef __GET_CONTEXT_INFO_ERR
9491 #undef __GET_EVENT_INFO_ERR
9492 #undef __GET_EVENT_PROFILE_INFO_ERR
9493 #undef __GET_MEM_OBJECT_INFO_ERR
9494 #undef __GET_IMAGE_INFO_ERR
9495 #undef __GET_SAMPLER_INFO_ERR
9496 #undef __GET_KERNEL_INFO_ERR
9497 #undef __GET_KERNEL_ARG_INFO_ERR
9498 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
9499 #undef __GET_PROGRAM_INFO_ERR
9500 #undef __GET_PROGRAM_BUILD_INFO_ERR
9501 #undef __GET_COMMAND_QUEUE_INFO_ERR
9503 #undef __CREATE_CONTEXT_ERR
9504 #undef __CREATE_CONTEXT_FROM_TYPE_ERR
9505 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
9507 #undef __CREATE_BUFFER_ERR
9508 #undef __CREATE_SUBBUFFER_ERR
9509 #undef __CREATE_IMAGE2D_ERR
9510 #undef __CREATE_IMAGE3D_ERR
9511 #undef __CREATE_SAMPLER_ERR
9512 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
9514 #undef __CREATE_USER_EVENT_ERR
9515 #undef __SET_USER_EVENT_STATUS_ERR
9516 #undef __SET_EVENT_CALLBACK_ERR
9517 #undef __SET_PRINTF_CALLBACK_ERR
9519 #undef __WAIT_FOR_EVENTS_ERR
9521 #undef __CREATE_KERNEL_ERR
9522 #undef __SET_KERNEL_ARGS_ERR
9523 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
9524 #undef __CREATE_PROGRAM_WITH_BINARY_ERR
9525 #undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
9526 #undef __BUILD_PROGRAM_ERR
9527 #undef __CREATE_KERNELS_IN_PROGRAM_ERR
9529 #undef __CREATE_COMMAND_QUEUE_ERR
9530 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
9531 #undef __ENQUEUE_READ_BUFFER_ERR
9532 #undef __ENQUEUE_WRITE_BUFFER_ERR
9533 #undef __ENQUEUE_READ_BUFFER_RECT_ERR
9534 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
9535 #undef __ENQEUE_COPY_BUFFER_ERR
9536 #undef __ENQEUE_COPY_BUFFER_RECT_ERR
9537 #undef __ENQUEUE_READ_IMAGE_ERR
9538 #undef __ENQUEUE_WRITE_IMAGE_ERR
9539 #undef __ENQUEUE_COPY_IMAGE_ERR
9540 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
9541 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
9542 #undef __ENQUEUE_MAP_BUFFER_ERR
9543 #undef __ENQUEUE_MAP_IMAGE_ERR
9544 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
9545 #undef __ENQUEUE_NDRANGE_KERNEL_ERR
9546 #undef __ENQUEUE_TASK_ERR
9547 #undef __ENQUEUE_NATIVE_KERNEL
9549 #undef __UNLOAD_COMPILER_ERR
9550 #undef __CREATE_SUB_DEVICES_ERR
9552 #undef __CREATE_PIPE_ERR
9553 #undef __GET_PIPE_INFO_ERR
9555 #endif //CL_HPP_USER_OVERRIDE_ERROR_STRINGS
9558 #undef CL_HPP_INIT_CL_EXT_FCN_PTR_
9559 #undef CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_
9561 #if defined(CL_HPP_USE_CL_DEVICE_FISSION)
9562 #undef CL_HPP_PARAM_NAME_DEVICE_FISSION_
9563 #endif // CL_HPP_USE_CL_DEVICE_FISSION
9565 #undef CL_HPP_NOEXCEPT_
9566 #undef CL_HPP_DEFINE_STATIC_MEMBER_
KernelFunctor< Ts...> FunctorType
Definition: cl2.hpp:9448
EnqueueArgs(CommandQueue &queue, const vector< Event > &events, NDRange global)
Definition: cl2.hpp:9295
cl_int enqueueWriteBuffer(const Buffer &buffer, cl_bool blocking, size_type offset, size_type size, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7055
Memory()
Default constructor - initializes to NULL.
Definition: cl2.hpp:3165
Event type_(const EnqueueArgs &, Ts...)
Function signature of kernel functor with no event dependency.
Definition: cl2.hpp:9468
BufferRenderGL(const cl_mem &buffer, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4105
EnqueueArgs(NDRange global, NDRange local)
Definition: cl2.hpp:9166
CommandQueue(CommandQueue &&queue) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:6997
cl_int enqueueCopyImage(const Image &src, const Image &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:9040
Wrapper(Wrapper< cl_type > &&rhs) CL_HPP_NOEXCEPT_
Definition: cl2.hpp:1663
cl_int getInfoHelper(Functor f, cl_uint name, T *param, long)
Definition: cl2.hpp:925
bool operator!=(const Wrapper< T > &lhs, const Wrapper< T > &rhs)
Definition: cl2.hpp:1868
Image interface for arrays of 2D images.
Definition: cl2.hpp:4855
Image1DBuffer(const cl_mem &image1D, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4384
detail::param_traits< detail::cl_context_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetContextInfo() that returns by value.
Definition: cl2.hpp:2876
Image interface for arrays of 1D images.
Definition: cl2.hpp:4426
EnqueueArgs(NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9175
static cl_int retain(cl_sampler sampler)
Definition: cl2.hpp:1547
#define CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(F)
Definition: cl2.hpp:1326
cl_int enqueueCopyBufferRect(const Buffer &src, const Buffer &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, size_type src_row_pitch, size_type src_slice_pitch, size_type dst_row_pitch, size_type dst_slice_pitch, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7182
KernelFunctor(const Program &program, const string name, cl_int *err=NULL)
Definition: cl2.hpp:9363
#define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name)
Definition: cl2.hpp:686
value_type * pointer
Definition: cl2.hpp:3393
std::array< T, N > array
Definition: cl2.hpp:594
Wrapper(const cl_type &obj, bool retainObject)
Definition: cl2.hpp:1645
Context(const cl_context &context, bool retainObject=false)
Constructor from cl_context - takes ownership.
Definition: cl2.hpp:2850
Image & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl2.hpp:4183
Wrapper()
Definition: cl2.hpp:1759
Image3D(const Image3D &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5052
void * enqueueMapBuffer(const Buffer &buffer, cl_bool blocking, cl_map_flags flags, size_type offset, size_type size, const vector< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL)
Definition: cl2.hpp:8528
Program linkProgram(Program input1, Program input2, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Definition: cl2.hpp:6472
static DeviceCommandQueue makeDefault(const Context &context, const Device &device, cl_uint queueSize, cl_int *err=nullptr)
Definition: cl2.hpp:8353
friend cl_int getInfoHelper(Func, cl_uint, U *, int, typename U::cl_type)
cl_int enqueueReadImage(const Image &image, cl_bool blocking, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, size_type row_pitch, size_type slice_pitch, void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8980
Wrapper(const cl_type &obj, bool retainObject)
Definition: cl2.hpp:1763
std::unique_ptr< T, D > pointer
Definition: cl2.hpp:586
#define CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(F)
Definition: cl2.hpp:1329
cl_int getInfo(cl_command_queue_info name, T *param) const
Definition: cl2.hpp:8268
EnqueueArgs(CommandQueue &queue, const vector< Event > &events, NDRange global, NDRange local)
Definition: cl2.hpp:9305
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3302
EnqueueArgs(Event e, NDRange global)
Definition: cl2.hpp:9184
vector< T, cl::SVMAllocator< int, cl::SVMTraitCoarse<>>> coarse_svm_vector
Vector alias to simplify contruction of coarse-grained SVM containers.
Definition: cl2.hpp:3628
std::enable_if< std::is_pointer< T >::value, cl_int >::type setArg(cl_uint index, const T argPtr)
setArg overload taking a pointer type
Definition: cl2.hpp:5844
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3335
Image1DBuffer(const Image1DBuffer &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4396
static cl_int release(cl_kernel kernel)
Definition: cl2.hpp:1567
Image2D(const Context &context, cl_mem_flags flags, ImageFormat format, size_type width, size_type height, size_type row_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 2D Image in a specified context.
Definition: cl2.hpp:4527
EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local)
Definition: cl2.hpp:9250
static cl_int retain(cl_command_queue queue)
Definition: cl2.hpp:1529
cl_int enqueueCopyBufferToImage(const Buffer &src, const Image &dst, size_type src_offset, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:9092
Image1D(const Context &context, cl_mem_flags flags, ImageFormat format, size_type width, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 1D Image in a specified context.
Definition: cl2.hpp:4257
Image2D & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl2.hpp:4718
cl_int getBuildInfo(const Device &device, cl_program_build_info name, T *param) const
Definition: cl2.hpp:6374
cl_device_id cl_type
Definition: cl2.hpp:1734
cl_int getInfo(cl_mem_info name, T *param) const
Wrapper for clGetMemObjectInfo().
Definition: cl2.hpp:3223
value_type * pointer
Definition: cl2.hpp:3537
Image(Image &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4206
cl_int unmapSVM(cl::vector< T, Alloc > &container)
Definition: cl2.hpp:8865
detail::param_traits< detail::cl_device_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetDeviceInfo() that returns by value.
Definition: cl2.hpp:2084
Context(const Context &ctx)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:2788
Local address wrapper for use with Kernel::setArg.
Definition: cl2.hpp:5610
EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9202
CommandQueue(const Context &context, const Device &device, QueueProperties properties, cl_int *err=NULL)
Constructs a CommandQueue for a passed device and context Will return an CL_INVALID_QUEUE_PROPERTIES ...
Definition: cl2.hpp:6905
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type getWorkGroupInfo(const Device &device, cl_int *err=NULL) const
Definition: cl2.hpp:5782
static DeviceCommandQueue makeDefault(const Context &context, const Device &device, cl_int *err=nullptr)
Definition: cl2.hpp:8325
cl_int enqueueCopyImage(const Image &src, const Image &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7327
cl_int enqueueWriteImage(const Image &image, cl_bool blocking, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, size_type row_pitch, size_type slice_pitch, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7294
Program(const Context &context, const vector< Device > &devices, const Binaries &binaries, vector< cl_int > *binaryStatus=NULL, cl_int *err=NULL)
Definition: cl2.hpp:6151
static cl_int release(cl_mem memory)
Definition: cl2.hpp:1540
Buffer(IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr=false, cl_int *err=NULL)
Construct a Buffer from a host container via iterators. IteratorType must be random access...
Definition: cl2.hpp:3711
size_type size() const
Returns the size of the object in bytes based on the.
Definition: cl2.hpp:5590
#define CL_HPP_DECLARE_PARAM_TRAITS_(token, param_name, T)
Definition: cl2.hpp:1304
cl_int getInfo(cl_program_info name, T *param) const
Definition: cl2.hpp:6353
Class interface for cl_mem.
Definition: cl2.hpp:3161
Pipe(cl_uint packet_size, cl_uint max_packets, cl_int *err=NULL)
Constructs a Pipe in a the default context.
Definition: cl2.hpp:5299
cl_int enqueueCopyBuffer(const Buffer &src, const Buffer &dst, size_type src_offset, size_type dst_offset, size_type size, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7080
cl::pointer< T, detail::Deleter< SVMAllocator< T, SVMTrait > > > allocate_svm(Args...args)
Definition: cl2.hpp:3610
Device(const Device &dev)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:2047
BufferRenderGL(BufferRenderGL &&buf) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4135
cl_int getInfo(cl_sampler_info name, T *param) const
Wrapper for clGetSamplerInfo().
Definition: cl2.hpp:5503
bool referenceCountable_
Definition: cl2.hpp:1738
Image2DArray(Image2DArray &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4930
Memory(Memory &&mem) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:3209
detail::param_traits< detail::cl_pipe_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetMemObjectInfo() that returns by value.
Definition: cl2.hpp:5380
Context & operator=(const Context &ctx)
Copy assignment to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:2793
Image3D(Image3D &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5066
Program(const Context &context, const string &source, bool build=false, cl_int *err=NULL)
Definition: cl2.hpp:6025
cl_int createSubDevices(const cl_device_partition_property *properties, vector< Device > *devices)
Wrapper for clCreateSubDevices().
Definition: cl2.hpp:2100
cl_int getInfo(cl_pipe_info name, T *param) const
Wrapper for clGetMemObjectInfo().
Definition: cl2.hpp:5370
Context(const Device &device, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Definition: cl2.hpp:2674
BufferRenderGL()
Default constructor - initializes to NULL.
Definition: cl2.hpp:4096
detail::param_traits< detail::cl_program_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl2.hpp:6362
Image(const Image &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4192
#define CL_HPP_PARAM_NAME_INFO_2_0_(F)
Definition: cl2.hpp:1274
cl_int enqueueFillImage(const Image &image, cl_int4 fillColor, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7398
SVMAllocator< U, SVMTrait > other
Definition: cl2.hpp:3403
Image1DArray(const Image1DArray &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4485
Kernel(const Kernel &kernel)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5701
cl_int enqueueAcquireGLObjects(const vector< Memory > *mem_objects=NULL, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7976
CommandQueue(const Context &context, cl_command_queue_properties properties=0, cl_int *err=NULL)
Constructs a CommandQueue for an implementation defined device in the given context Will return an CL...
Definition: cl2.hpp:6777
const value_type & const_reference
Definition: cl2.hpp:3396
cl_int setSVMPointers(const T0 &t0, T1s...ts)
Definition: cl2.hpp:9428
Buffer createSubBuffer(cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void *buffer_create_info, cl_int *err=NULL)
Creates a new buffer object from this.
Definition: cl2.hpp:3829
Buffer(Buffer &&buf) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:3813
#define CL_HPP_NOEXCEPT_
Definition: cl2.hpp:510
static Device getDefault(cl_int *errResult=NULL)
Returns the first device on the default context.
Definition: cl2.hpp:2009
cl_int enqueueUnmapSVM(T *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8669
cl_int setArg(cl_uint index, size_type size, const void *argPtr)
Definition: cl2.hpp:5867
cl_int enqueueCopyImageToBuffer(const Image &src, const Buffer &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > ®ion, size_type dst_offset, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7460
static size_type size(const LocalSpaceArg &value)
Definition: cl2.hpp:5643
Sampler(const Sampler &sam)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5476
vector< std::pair< cl::Device, typename detail::param_traits< detail::cl_program_build_info, name >::param_type > > getBuildInfo(cl_int *err=NULL) const
Definition: cl2.hpp:6403
cl_int setSVMPointers(const vector< void * > &pointerList)
Definition: cl2.hpp:5879
cl_int setCallback(cl_int type, void(CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *), void *user_data=NULL)
Registers a user callback function for a specific command execution status.
Definition: cl2.hpp:3068
Event()
Default constructor - initializes to NULL.
Definition: cl2.hpp:2982
ImageGL(const cl_mem &image, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:5213
Image3D(const Context &context, cl_mem_flags flags, ImageFormat format, size_type width, size_type height, size_type depth, size_type row_pitch=0, size_type slice_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 3D Image in a specified context.
Definition: cl2.hpp:4956
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7663
Image2DArray(const Context &context, cl_mem_flags flags, ImageFormat format, size_type arraySize, size_type width, size_type height, size_type rowPitch, size_type slicePitch, void *host_ptr=NULL, cl_int *err=NULL)
Definition: cl2.hpp:4858
vector< string > Sources
Definition: cl2.hpp:5980
#define CL_HPP_PARAM_NAME_INFO_1_0_(F)
Definition: cl2.hpp:1105
Wrapper(const Wrapper< cl_type > &rhs)
Definition: cl2.hpp:1779
cl_int setArg(cl_uint index, const cl::vector< T, Alloc > &argPtr)
setArg overload taking a vector type.
Definition: cl2.hpp:5833
make_kernel(const Program &program, const string name, cl_int *err=NULL)
Definition: cl2.hpp:9452
EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9286
Image1D(const Image1D &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4312
BufferRenderGL(const BufferRenderGL &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4121
std::size_t size_type
Definition: cl2.hpp:3397
DeviceCommandQueue(DeviceQueueProperties properties, cl_int *err=NULL)
Definition: cl2.hpp:8153
Pipe(const Context &context, cl_uint packet_size, cl_uint max_packets, cl_int *err=NULL)
Constructs a Pipe in a specified context.
Definition: cl2.hpp:5274
cl_int enqueueUnmapSVM(cl::vector< T, Alloc > &container, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7741
Image3D()
Default constructor - initializes to NULL.
Definition: cl2.hpp:5027
CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)
Constructs a CommandQueue for a passed device and context Will return an CL_INVALID_QUEUE_PROPERTIES ...
Definition: cl2.hpp:6872
cl_int enqueueWriteBufferRect(const Buffer &buffer, cl_bool blocking, const array< size_type, 3 > &buffer_offset, const array< size_type, 3 > &host_offset, const array< size_type, 3 > ®ion, size_type buffer_row_pitch, size_type buffer_slice_pitch, size_type host_row_pitch, size_type host_slice_pitch, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7143
Kernel()
Default constructor - initializes to NULL.
Definition: cl2.hpp:5674
static cl_int release(cl_sampler sampler)
Definition: cl2.hpp:1549
bool operator==(const Wrapper< T > &lhs, const Wrapper< T > &rhs)
Definition: cl2.hpp:1862
static cl_int release(cl_program program)
Definition: cl2.hpp:1558
Sampler()
Default constructor - initializes to NULL.
Definition: cl2.hpp:5406
cl_int enqueueReadBufferRect(const Buffer &buffer, cl_bool blocking, const array< size_type, 3 > &buffer_offset, const array< size_type, 3 > &host_offset, const array< size_type, 3 > ®ion, size_type buffer_row_pitch, size_type buffer_slice_pitch, size_type host_row_pitch, size_type host_slice_pitch, void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8873
cl_int enqueueReleaseGLObjects(const vector< Memory > *mem_objects=NULL, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7998
Image1D(Image1D &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4326
Image1DBuffer()
Definition: cl2.hpp:4375
cl_int finish() const
Definition: cl2.hpp:8115
cl_int enqueueBarrierWithWaitList(const vector< Event > *events=0, Event *event=0)
Definition: cl2.hpp:7804
SVMAllocator()
Definition: cl2.hpp:3409
Program(Program &&program) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:6279
cl_int getObjectInfo(cl_gl_object_type *type, cl_GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition: cl2.hpp:4147
cl_int release() const
Definition: cl2.hpp:1719
cl_int getInfo(cl_event_info name, T *param) const
Wrapper for clGetEventInfo().
Definition: cl2.hpp:3008
cl_int enqueueMigrateMemObjects(const vector< Memory > &memObjects, cl_mem_migration_flags flags, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:7827
Image1DBuffer(const Context &context, cl_mem_flags flags, ImageFormat format, size_type width, const Buffer &buffer, cl_int *err=NULL)
Definition: cl2.hpp:4345
std::enable_if<!std::is_pointer< T >::value, cl_int >::type setArg(cl_uint index, const T &value)
setArg overload taking a POD type
Definition: cl2.hpp:5856
#define CL_HPP_PARAM_NAME_DEVICE_FISSION_(F)
Definition: cl2.hpp:1294
size_type max_size() const CL_HPP_NOEXCEPT_
Definition: cl2.hpp:3493
cl_int enqueueUnmapSVM(cl::pointer< T, D > &ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7716
Image1DArray(const cl_mem &imageArray, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4472
Func f_
Definition: cl2.hpp:1433
Class interface for cl_event.
Definition: cl2.hpp:2978
const value_type * const_pointer
Definition: cl2.hpp:3394
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3313
NDRange(size_type size0)
Constructs one-dimensional range.
Definition: cl2.hpp:5548
cl_int enqueueUnmapSVM(T *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7691
Deleter(const Alloc &alloc, size_type copies)
Definition: cl2.hpp:3562
Program(const Context &context, const Sources &sources, cl_int *err=NULL)
Definition: cl2.hpp:6101
static size_type size(const T &)
Definition: cl2.hpp:5634
cl_int getSupportedImageFormats(cl_mem_flags flags, cl_mem_object_type type, vector< ImageFormat > *formats) const
Gets a list of supported image formats.
Definition: cl2.hpp:2891
cl_int getImageInfo(cl_image_info name, T *param) const
Wrapper for clGetImageInfo().
Definition: cl2.hpp:4221
Buffer & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl2.hpp:3790
Image2DArray()
Definition: cl2.hpp:4896
cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T *param) const
Definition: cl2.hpp:5749
static size_type size(const cl::DeviceCommandQueue &)
Definition: cl2.hpp:8383
#define CL_HPP_INIT_CL_EXT_FCN_PTR_(name)
Definition: cl2.hpp:678
static cl_int retain(cl_program program)
Definition: cl2.hpp:1556
Class interface for Pipe Memory Objects.
Definition: cl2.hpp:5261
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
SVMAllocator< U, SVMTrait > other
Definition: cl2.hpp:3543
const_pointer address(const_reference r) CL_HPP_NOEXCEPT_
Definition: cl2.hpp:3440
FunctorType functor_
Definition: cl2.hpp:9450
QueueProperties
Definition: cl2.hpp:6603
Image2D(const Image2D &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4727
Buffer()
Default constructor - initializes to NULL.
Definition: cl2.hpp:3774
cl_int enqueueReadBuffer(const Buffer &buffer, cl_bool blocking, size_type offset, size_type size, void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7030
std::allocator_traits< Alloc >::pointer pointer
Definition: cl2.hpp:3560
DeviceCommandQueue(const Context &context, const Device &device, DeviceQueueProperties properties=DeviceQueueProperties::None, cl_int *err=NULL)
Definition: cl2.hpp:8176
cl_int createKernels(vector< Kernel > *kernels)
Definition: cl2.hpp:6440
cl_int compile(const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl2.hpp:6333
cl_int setArg(cl_uint index, const cl::pointer< T, D > &argPtr)
setArg overload taking a shared_ptr type
Definition: cl2.hpp:5823
static cl_int retain(cl_mem memory)
Definition: cl2.hpp:1538
cl_int operator()(cl_uint param, size_type size, void *value, size_type *size_ret)
Definition: cl2.hpp:1434
cl_int copy(IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer)
Definition: cl2.hpp:8754
const cl_type & operator()() const
Definition: cl2.hpp:1696
Context(const vector< Device > &devices, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including a list of specified devices.
Definition: cl2.hpp:2643
const Arg0 & arg0_
Definition: cl2.hpp:1424
Wrapper(Wrapper< cl_type > &&rhs) CL_HPP_NOEXCEPT_
Definition: cl2.hpp:1786
DeviceCommandQueue(const DeviceCommandQueue &queue)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:8242
Sampler(const cl_sampler &sampler, bool retainObject=false)
Constructor from cl_sampler - takes ownership.
Definition: cl2.hpp:5459
static cl_int retain(cl_kernel kernel)
Definition: cl2.hpp:1565
detail::param_traits< detail::cl_event_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetEventInfo() that returns by value.
Definition: cl2.hpp:3018
Kernel getKernel()
Definition: cl2.hpp:9434
Image()
Default constructor - initializes to NULL.
Definition: cl2.hpp:4167
static cl_int release(cl_device_id device)
Definition: cl2.hpp:1487
static const T * ptr(const T &value)
Definition: cl2.hpp:5626
cl_int enqueueFillBuffer(const Buffer &buffer, PatternType pattern, size_type offset, size_type size, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7232
Event(const cl_event &event, bool retainObject=false)
Constructor from cl_event - takes ownership.
Definition: cl2.hpp:2992
Program()
Definition: cl2.hpp:6244
cl_int getProfilingInfo(cl_profiling_info name, T *param) const
Wrapper for clGetEventProfilingInfo().
Definition: cl2.hpp:3031
EnqueueArgs(const vector< Event > &events, NDRange global)
Definition: cl2.hpp:9211
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetMemObjectInfo() that returns by value.
Definition: cl2.hpp:3233
ImageGL(const Context &context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, cl_int *err=NULL)
Definition: cl2.hpp:5181
DeviceCommandQueue(const Context &context, const Device &device, cl_uint queueSize, DeviceQueueProperties properties=DeviceQueueProperties::None, cl_int *err=NULL)
Definition: cl2.hpp:8200
NDRange(size_type size0, size_type size1)
Constructs two-dimensional range.
Definition: cl2.hpp:5557
cl_int enqueueMapSVM(T *ptr, cl_bool blocking, cl_map_flags flags, size_type size, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7586
Image2D()
Default constructor - initializes to NULL.
Definition: cl2.hpp:4702
Image3D(const cl_mem &image3D, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:5036
Image2D(Image2D &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4741
cl_int retain() const
Definition: cl2.hpp:1840
DeviceCommandQueue interface for device cl_command_queues.
Definition: cl2.hpp:8141
void setSVMPointersHelper(std::array< void *, ArrayLength > &pointerList, const pointer< T0, D > &t0, Ts...ts)
Definition: cl2.hpp:5929
cl_int flush(void)
Definition: cl2.hpp:9119
#define CL_HPP_PARAM_NAME_INFO_1_1_(F)
Definition: cl2.hpp:1226
#define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
Definition: cl2.hpp:532
Image1DArray(Image1DArray &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4499
Program(const string &source, bool build=false, cl_int *err=NULL)
Definition: cl2.hpp:5986
cl_int enqueueWriteBuffer(const Buffer &buffer, cl_bool blocking, size_type offset, size_type size, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8509
Pipe()
Default constructor - initializes to NULL.
Definition: cl2.hpp:5318
static const void * ptr(const LocalSpaceArg &)
Definition: cl2.hpp:5644
const cl_type get() const
Definition: cl2.hpp:1700
CommandQueue(const cl_command_queue &commandQueue, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:6971
Pipe(const Pipe &pipe)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5343
detail::param_traits< detail::cl_image_info, name >::param_type getImageInfo(cl_int *err=NULL) const
Wrapper for clGetImageInfo() that returns by value.
Definition: cl2.hpp:4231
Image1D()
Default constructor - initializes to NULL.
Definition: cl2.hpp:4287
EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local)
Definition: cl2.hpp:9277
Image1DArray()
Definition: cl2.hpp:4463
Buffer(const cl_mem &buffer, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:3783
EnqueueArgs(const vector< Event > &events, NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9231
static bool isReferenceCountable(cl_device_id device)
Definition: cl2.hpp:1740
size_type dimensions() const
Queries the number of dimensions in the range.
Definition: cl2.hpp:5583
EnqueueArgs(CommandQueue &queue, Event e, NDRange global)
Definition: cl2.hpp:9268
cl_int getWorkGroupInfo(const Device &device, cl_kernel_work_group_info name, T *param) const
Definition: cl2.hpp:5771
SVMAllocator(cl::Context context)
Definition: cl2.hpp:3414
detail::param_traits< detail::cl_kernel_arg_info, name >::param_type getArgInfo(cl_uint argIndex, cl_int *err=NULL) const
Definition: cl2.hpp:5758
Sampler(Sampler &&sam) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5490
EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9259
EnqueueArgs(const vector< Event > &events, NDRange global, NDRange local)
Definition: cl2.hpp:9221
static CommandQueue setDefault(const CommandQueue &default_queue)
Definition: cl2.hpp:6955
Program(const Context &context, const vector< Device > &devices, const string &kernelNames, cl_int *err=NULL)
Definition: cl2.hpp:6215
cl_int setSVMPointers(const T0 &t0, Ts...ts)
Definition: cl2.hpp:5957
void * enqueueMapImage(const Image &buffer, cl_bool blocking, cl_map_flags flags, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, size_type *row_pitch, size_type *slice_pitch, const vector< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL) const
Definition: cl2.hpp:7547
std::ptrdiff_t difference_type
Definition: cl2.hpp:3398
CommandQueue(const CommandQueue &queue)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:6983
cl_int enqueueMapSVM(cl::pointer< T, D > &ptr, cl_bool blocking, cl_map_flags flags, size_type size, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7614
vector< vector< unsigned char > > Binaries
Definition: cl2.hpp:5979
value_type & reference
Definition: cl2.hpp:3395
~Wrapper()
Definition: cl2.hpp:1774
size_type size_
Definition: cl2.hpp:5612
cl_int enqueueFillImage(const Image &image, cl_float4 fillColor, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7364
cl::pointer< T, detail::Deleter< Alloc > > allocate_pointer(const Alloc &alloc_, Args &&...args)
Definition: cl2.hpp:3581
Kernel(Kernel &&kernel) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5715
Image2D(const Context &context, ImageFormat format, const Buffer &sourceBuffer, size_type width, size_type height, size_type row_pitch=0, cl_int *err=nullptr)
Constructs a 2D Image from a buffer.
Definition: cl2.hpp:4598
CommandQueue()
Definition: cl2.hpp:6962
cl_int enqueueFillImage(const Image &image, cl_uint4 fillColor, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7432
cl_int enqueueCopyBufferToImage(const Buffer &src, const Image &dst, size_type src_offset, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7489
Program(const Sources &sources, cl_int *err=NULL)
Definition: cl2.hpp:6066
Device(const cl_device_id &device, bool retainObject=false)
Constructor from cl_device_id.
Definition: cl2.hpp:2002
NDRange()
Default constructor - resulting range has zero dimensions.
Definition: cl2.hpp:5539
BufferGL(const BufferGL &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4024
detail::param_traits< detail::cl_kernel_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl2.hpp:5736
Image3D & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl2.hpp:5043
void value_type
Definition: cl2.hpp:3536
CommandQueue(const Context &context, QueueProperties properties, cl_int *err=NULL)
Constructs a CommandQueue for an implementation defined device in the given context Will return an CL...
Definition: cl2.hpp:6827
cl_int setDestructorCallback(void(CL_CALLBACK *pfn_notify)(cl_mem, void *), void *user_data=NULL)
Registers a callback function to be called when the memory object is no longer needed.
Definition: cl2.hpp:3258
CommandQueue(cl_command_queue_properties properties, cl_int *err=NULL)
Constructs a CommandQueue based on passed properties. Will return an CL_INVALID_QUEUE_PROPERTIES erro...
Definition: cl2.hpp:6684
Buffer(const Context &context, cl_mem_flags flags, size_type size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in a specified context.
Definition: cl2.hpp:3662
#define CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(F)
Definition: cl2.hpp:1332
Event result_type
Return type of the functor.
Definition: cl2.hpp:9371
cl_int setSVMPointers(const std::array< void *, ArrayLength > &pointerList)
Definition: cl2.hpp:5894
Image2DArray(const cl_mem &imageArray, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4905
Buffer(const Buffer &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:3799
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3291
T value_type
Definition: cl2.hpp:3392
Image(const cl_mem &image, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4176
vector< T, cl::SVMAllocator< int, cl::SVMTraitAtomic<>>> atomic_svm_vector
Vector alias to simplify contruction of fine-grained SVM containers that support platform atomics...
Definition: cl2.hpp:3640
Memory(const Memory &mem)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:3195
Program(const Program &program)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:6265
cl_int getObjectInfo(cl_gl_object_type *type, cl_GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition: cl2.hpp:4050
static cl_int retain(cl_device_id device)
Definition: cl2.hpp:1476
void construct(U *p, Args &&...args)
Definition: cl2.hpp:3507
detail::param_traits< detail::cl_sampler_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetSamplerInfo() that returns by value.
Definition: cl2.hpp:5513
EnqueueArgs(Event e, NDRange global, NDRange local)
Definition: cl2.hpp:9193
size_t size_type
Definition: cl2.hpp:554
void operator()(pointer ptr) const
Definition: cl2.hpp:3566
Image2D(const Context &context, cl_channel_order order, const Image &sourceImage, cl_int *err=nullptr)
Constructs a 2D Image from an image.
Definition: cl2.hpp:4648
std::enable_if< std::is_pointer< T0 >::value, void >::type setSVMPointersHelper(std::array< void *, ArrayLength > &pointerList, T0 t0, Ts...ts)
Definition: cl2.hpp:5937
cl_int wait() const
Blocks the calling thread until this event completes.
Definition: cl2.hpp:3056
CommandQueue interface for cl_command_queue.
Definition: cl2.hpp:6618
Image2D(const cl_mem &image2D, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4711
cl_int getInfo(Func f, cl_uint name, T *param)
Definition: cl2.hpp:1416
Sampler(const Context &context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *err=NULL)
Constructs a Sampler in a specified context.
Definition: cl2.hpp:5412
#define CL_HPP_PARAM_NAME_INFO_1_2_(F)
Definition: cl2.hpp:1248
Image1D(const cl_mem &image1D, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4296
array< size_type, 3 > size_t_array
Definition: cl2.hpp:665
pointer allocate(size_type size, typename cl::SVMAllocator< void, SVMTrait >::const_pointer=0)
Definition: cl2.hpp:3451
Device & operator=(const cl_device_id &rhs)
Assignment operator from cl_device_id.
Definition: cl2.hpp:2038
static DeviceCommandQueue makeDefault(cl_int *err=nullptr)
Definition: cl2.hpp:8295
UserEvent()
Default constructor - initializes to NULL.
Definition: cl2.hpp:3125
size_type * get()
Definition: cl2.hpp:5595
EnqueueArgs(CommandQueue &queue, NDRange global)
Definition: cl2.hpp:9241
static const cl_command_queue * ptr(const cl::DeviceCommandQueue &value)
Definition: cl2.hpp:8384
DeviceCommandQueue(const cl_command_queue &commandQueue, bool retainObject=false)
Constructor from cl_command_queue - takes ownership.
Definition: cl2.hpp:8230
SVMAllocator(const SVMAllocator< U, SVMTrait > &other)
Definition: cl2.hpp:3426
cl_int operator()(cl_uint param, size_type size, void *value, size_type *size_ret)
Definition: cl2.hpp:1425
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8634
Wrapper()
Definition: cl2.hpp:1643
static cl_int release(cl_command_queue queue)
Definition: cl2.hpp:1531
cl_int enableFineGrainedSystemSVM(bool svmEnabled)
Enable fine-grained system SVM.
Definition: cl2.hpp:5915
cl_int enqueueReadBufferRect(const Buffer &buffer, cl_bool blocking, const array< size_type, 3 > &buffer_offset, const array< size_type, 3 > &host_offset, const array< size_type, 3 > ®ion, size_type buffer_row_pitch, size_type buffer_slice_pitch, size_type host_row_pitch, size_type host_slice_pitch, void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7104
Pipe(const cl_mem &pipe, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:5327
static CommandQueue getDefault(cl_int *err=NULL)
Definition: cl2.hpp:6934
Pipe(Pipe &&pipe) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5357
vector< T, cl::SVMAllocator< int, cl::SVMTraitFine<>>> fine_svm_vector
Vector alias to simplify contruction of fine-grained SVM containers.
Definition: cl2.hpp:3634
cl_int enqueueReadBuffer(const Buffer &buffer, cl_bool blocking, size_type offset, size_type size, void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8490
cl_int mapSVM(cl::vector< T, Alloc > &container)
Definition: cl2.hpp:8856
cl_int enqueueCopyImageToBuffer(const Image &src, const Buffer &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > ®ion, size_type dst_offset, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:9066
cl_int enqueueCopyBuffer(const Buffer &src, const Buffer &dst, size_type src_offset, size_type dst_offset, size_type size, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8729
EnqueueArgs(CommandQueue &queue, const vector< Event > &events, NDRange offset, NDRange global, NDRange local)
Definition: cl2.hpp:9315
Class interface for user events (a subset of cl_event's).
Definition: cl2.hpp:3102
bool operator==(SVMAllocator const &rhs)
Definition: cl2.hpp:3521
Program(const cl_program &program, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:6253
cl_int getInfo(cl_device_info name, T *param) const
Wrapper for clGetDeviceInfo().
Definition: cl2.hpp:2074
#define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
Definition: cl2.hpp:529
Kernel(const cl_kernel &kernel, bool retainObject=false)
Constructor from cl_kernel - takes ownership.
Definition: cl2.hpp:5684
Class interface for cl_sampler.
Definition: cl2.hpp:5402
static cl_int retain(cl_event event)
Definition: cl2.hpp:1574
ImageGL(const ImageGL &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5225
LocalSpaceArg Local(size_type size)
Helper function for generating LocalSpaceArg objects.
Definition: cl2.hpp:5654
detail::param_traits< detail::cl_program_build_info, name >::param_type getBuildInfo(const Device &device, cl_int *err=NULL) const
Definition: cl2.hpp:6385
Event result_type
Return type of the functor.
Definition: cl2.hpp:9465
Wrapper(const Wrapper< cl_type > &rhs)
Definition: cl2.hpp:1657
C++ base class for Image Memory objects.
Definition: cl2.hpp:4163
cl_int enqueueMapSVM(T *ptr, cl_bool blocking, cl_map_flags flags, size_type size, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8567
~SVMAllocator()
Definition: cl2.hpp:3431
cl_int release() const
Definition: cl2.hpp:1850
cl_int retain() const
Definition: cl2.hpp:1709
Wrapper< cl_type > & operator=(const Wrapper< cl_type > &rhs)
Definition: cl2.hpp:1669
cl_int enqueueReadImage(const Image &image, cl_bool blocking, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, size_type row_pitch, size_type slice_pitch, void *ptr, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7261
cl_int getInfo(cl_context_info name, T *param) const
Wrapper for clGetContextInfo().
Definition: cl2.hpp:2866
static cl_int release(cl_event event)
Definition: cl2.hpp:1576
Buffer(cl_mem_flags flags, size_type size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in the default context.
Definition: cl2.hpp:3687
static Context setDefault(const Context &default_context)
Definition: cl2.hpp:2835
BufferGL(BufferGL &&buf) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4038
cl_int flush() const
Definition: cl2.hpp:8110
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
Definition: cl2.hpp:522
Class interface for Buffer Memory Objects.
Definition: cl2.hpp:3651
void destroy(U *p)
Definition: cl2.hpp:3513
static Device setDefault(const Device &default_device)
Definition: cl2.hpp:2027
DeviceCommandQueue()
Definition: cl2.hpp:8148
Image1DBuffer(Image1DBuffer &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4410
static size_type size(const T &)
Definition: cl2.hpp:5625
void * enqueueMapBuffer(const Buffer &buffer, cl_bool blocking, cl_map_flags flags, size_type offset, size_type size, const vector< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL) const
Definition: cl2.hpp:7518
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3324
Class interface for specifying NDRange values.
Definition: cl2.hpp:5531
Class interface for 2D Image Memory objects.
Definition: cl2.hpp:4520
ImageGL(ImageGL &&img) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:5239
KernelFunctor(Kernel kernel)
Definition: cl2.hpp:9360
void deallocate(pointer p, size_type)
Definition: cl2.hpp:3484
Class interface for 1D Image Memory objects.
Definition: cl2.hpp:4250
#define CL_CALLBACK
Definition: cl2.hpp:536
cl_int getInfo(cl_kernel_info name, T *param) const
Definition: cl2.hpp:5727
Class interface for cl_kernel.
Definition: cl2.hpp:5668
NDRange(size_type size0, size_type size1, size_type size2)
Constructs three-dimensional range.
Definition: cl2.hpp:5566
const value_type * const_pointer
Definition: cl2.hpp:3538
static cl_int waitForEvents(const vector< Event > &events)
Blocks the calling thread until every event specified is complete.
Definition: cl2.hpp:3088
T cl_type
Definition: cl2.hpp:1637
Class interface for 3D Image Memory objects.
Definition: cl2.hpp:4949
Class interface for GL Render Buffer Memory Objects.
Definition: cl2.hpp:4068
detail::param_traits< detail::cl_profiling_info, name >::param_type getProfilingInfo(cl_int *err=NULL) const
Wrapper for clGetEventProfilingInfo() that returns by value.
Definition: cl2.hpp:3041
general image interface for GL interop. We abstract the 2D and 3D GL images into a single instance he...
Definition: cl2.hpp:5178
Func f_
Definition: cl2.hpp:1424
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
Definition: cl2.hpp:525
ImageGL()
Definition: cl2.hpp:5204
cl_int setStatus(cl_int status)
Sets the execution status of a user event object.
Definition: cl2.hpp:3131
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
#define CL_HPP_DEFINE_STATIC_MEMBER_
Definition: cl2.hpp:516
static const cl_mem * ptr(const T &value)
Definition: cl2.hpp:5635
void setSVMPointersHelper(std::array< void *, ArrayLength > &pointerList, const pointer< T0, D > &t0)
Definition: cl2.hpp:5944
DeviceQueueProperties
Definition: cl2.hpp:8127
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3356
Device()
Default constructor - initializes to NULL.
Definition: cl2.hpp:1996
Context()
Default constructor - initializes to NULL.
Definition: cl2.hpp:2843
cl_int enqueueWriteImage(const Image &image, cl_bool blocking, const array< size_type, 3 > &origin, const array< size_type, 3 > ®ion, size_type row_pitch, size_type slice_pitch, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:9010
Image2DArray(const Image2DArray &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:4916
~Wrapper()
Definition: cl2.hpp:1652
Class interface for cl_device_id.
Definition: cl2.hpp:1959
vector< std::pair< cl::Device, typename detail::param_traits< detail::cl_program_build_info, CL_PROGRAM_BUILD_LOG >::param_type >> BuildLogType
Definition: cl2.hpp:1877
Context(Context &&ctx) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:2802
cl_int build(const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl2.hpp:6315
EnqueueArgs(NDRange global)
Definition: cl2.hpp:9157
Image1DArray(const Context &context, cl_mem_flags flags, ImageFormat format, size_type arraySize, size_type width, size_type rowPitch, void *host_ptr=NULL, cl_int *err=NULL)
Definition: cl2.hpp:4429
static Context getDefault(cl_int *err=NULL)
Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
Definition: cl2.hpp:2818
Context(cl_device_type type, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including all or a subset of devices of a specified type.
Definition: cl2.hpp:2704
cl_int enqueueNDRangeKernel(const Kernel &kernel, const NDRange &offset, const NDRange &global, const NDRange &local=NullRange, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7861
Memory(const cl_mem &memory, bool retainObject)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:3178
cl_int enqueueNativeKernel(void(CL_CALLBACK *userFptr)(void *), std::pair< void *, size_type > args, const vector< Memory > *mem_objects=NULL, const vector< const void * > *mem_locs=NULL, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7909
Device(Device &&dev) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:2061
BufferRenderGL(const Context &context, cl_mem_flags flags, cl_GLuint bufobj, cl_int *err=NULL)
Constructs a BufferRenderGL in a specified context, from a given GL Renderbuffer. ...
Definition: cl2.hpp:4076
QueueProperties operator|(QueueProperties lhs, QueueProperties rhs)
Definition: cl2.hpp:6610
BufferGL()
Default constructor - initializes to NULL.
Definition: cl2.hpp:3999
UserEvent(const Context &context, cl_int *err=NULL)
Constructs a user event on a given context.
Definition: cl2.hpp:3109
CommandQueue(QueueProperties properties, cl_int *err=NULL)
Constructs a CommandQueue based on passed properties. Will return an CL_INVALID_QUEUE_PROPERTIES erro...
Definition: cl2.hpp:6732
Image interface for 1D buffer images.
Definition: cl2.hpp:4342
std::enable_if< std::is_pointer< T0 >::value, void >::type setSVMPointersHelper(std::array< void *, ArrayLength > &pointerList, T0 t0)
Definition: cl2.hpp:5951
Program interface that implements cl_program.
Definition: cl2.hpp:5975
detail::param_traits< detail::cl_command_queue_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl2.hpp:7019
bool operator!=(SVMAllocator const &a)
Definition: cl2.hpp:3526
cl_int getInfo(cl_command_queue_info name, T *param) const
Definition: cl2.hpp:7009
pointer address(reference r) CL_HPP_NOEXCEPT_
Definition: cl2.hpp:3435
static cl_int retain(cl_context context)
Definition: cl2.hpp:1520
cl_int finish(void)
Definition: cl2.hpp:9131
static cl_svm_mem_flags getSVMMemFlags()
Definition: cl2.hpp:3345
Event operator()(const EnqueueArgs &enqueueArgs, Ts...args)
Definition: cl2.hpp:9472
cl_int enqueueMapSVM(cl::vector< T, Alloc > &container, cl_bool blocking, cl_map_flags flags, const vector< Event > *events=NULL, Event *event=NULL) const
Definition: cl2.hpp:7641
make_kernel(const Kernel kernel)
Definition: cl2.hpp:9459
detail::param_traits< detail::cl_command_queue_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl2.hpp:8278
Class interface for GL Buffer Memory Objects.
Definition: cl2.hpp:3971
DeviceCommandQueue(DeviceCommandQueue &&queue) CL_HPP_NOEXCEPT_
Move constructor to forward move to the superclass correctly. Required for MSVC.
Definition: cl2.hpp:8256
cl_int enqueueMarkerWithWaitList(const vector< Event > *events=0, Event *event=0)
Definition: cl2.hpp:7774
cl_int copy(const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator)
Definition: cl2.hpp:8825
Class interface for cl_context.
Definition: cl2.hpp:2571
cl_int setSVMPointers(const vector< void * > &pointerList)
Definition: cl2.hpp:9422
SVMAllocator(const SVMAllocator &other)
Definition: cl2.hpp:3420
BufferGL(const Context &context, cl_mem_flags flags, cl_GLuint bufobj, cl_int *err=NULL)
Constructs a BufferGL in a specified context, from a given GL buffer.
Definition: cl2.hpp:3979
cl_int enqueueWriteBufferRect(const Buffer &buffer, cl_bool blocking, const array< size_type, 3 > &buffer_offset, const array< size_type, 3 > &host_offset, const array< size_type, 3 > ®ion, size_type buffer_row_pitch, size_type buffer_slice_pitch, size_type host_row_pitch, size_type host_slice_pitch, const void *ptr, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8909
const Arg1 & arg1_
Definition: cl2.hpp:1433
static cl_int release(cl_context context)
Definition: cl2.hpp:1522
const Arg0 & arg0_
Definition: cl2.hpp:1433
cl_type object_
Definition: cl2.hpp:1640
Memory & operator=(const cl_mem &rhs)
Assignment operator from cl_mem - takes ownership.
Definition: cl2.hpp:3186
cl_int build(const vector< Device > &devices, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl2.hpp:6290
std::string string
Definition: cl2.hpp:574
BufferGL(const cl_mem &buffer, bool retainObject=false)
Constructor from cl_mem - takes ownership.
Definition: cl2.hpp:4008
cl_type object_
Definition: cl2.hpp:1737
cl_int enqueueCopyBufferRect(const Buffer &src, const Buffer &dst, const array< size_type, 3 > &src_origin, const array< size_type, 3 > &dst_origin, const array< size_type, 3 > ®ion, size_type src_row_pitch, size_type src_slice_pitch, size_type dst_row_pitch, size_type dst_slice_pitch, const vector< Event > *events=NULL, Event *event=NULL)
Definition: cl2.hpp:8945