1 #ifndef VIENNACL_OCL_ERROR_HPP_
2 #define VIENNACL_OCL_ERROR_HPP_
36 #ifdef VIENNACL_BUILD_INFO
37 #define VIENNACL_DEBUG_ALL
42 #include <OpenCL/cl.h>
52 #define VIENNACL_BUG_REPORT_STRING \
53 "\nIf you think that this is a bug in ViennaCL, please report it at viennacl-support@lists.sourceforge.net and supply at least the following information:\n"\
54 " * Operating System\n"\
55 " * Which OpenCL implementation (AMD, NVIDIA, etc.)\n"\
56 " * ViennaCL version\n"\
57 "Many thanks in advance!";\
95 virtual const char* what()
const throw()
97 return "ViennaCL: FATAL ERROR: CL_DEVICE_NOT_FOUND \n ViennaCL could not find a suitable device. Please check whether an OpenCL implementation is properly installed and a suitable device available."
105 virtual const char* what()
const throw()
107 return "ViennaCL: FATAL ERROR: CL_DEVICE_NOT_AVAILABLE \n ViennaCL could not use the compute device because it is not available."
115 virtual const char* what()
const throw()
117 return "ViennaCL: FATAL ERROR: CL_COMPILER_NOT_AVAILABLE \n Your OpenCL framework does not provide an OpenCL compiler. Unfortunately, ViennaCL cannot be used without such a compiler."
125 virtual const char* what()
const throw()
127 return "ViennaCL: FATAL ERROR: CL_MEM_OBJECT_ALLOCATION_FAILURE \n ViennaCL could not allocate memory on the device. Most likely the device simply ran out of memory."
135 virtual const char* what()
const throw()
137 return "ViennaCL: FATAL ERROR: CL_OUT_OF_RESOURCES \n ViennaCL tried to launch a compute kernel, but the device does not provide enough resources. Try changing the global and local work item sizes."
145 virtual const char* what()
const throw()
147 return "ViennaCL: FATAL ERROR: CL_OUT_OF_HOST_MEMORY \n The host ran out of memory (usually CPU RAM). Please try again on smaller problems."
155 virtual const char* what()
const throw()
157 return "ViennaCL: FATAL ERROR: CL_PROFILING_INFO_NOT_AVAILABLE."
165 virtual const char* what()
const throw()
167 return "ViennaCL: FATAL ERROR: CL_MEM_COPY_OVERLAP."
175 virtual const char* what()
const throw()
177 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_MISMATCH."
185 virtual const char* what()
const throw()
187 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_NOT_SUPPORTED."
195 virtual const char* what()
const throw()
197 return "ViennaCL: FATAL ERROR: CL_BUILD_PROGRAM_FAILURE \n The OpenCL compiler encountered an error during the compilation of ViennaCL sources. This is most likely a bug in ViennaCL."
205 virtual const char* what()
const throw()
207 return "ViennaCL: FATAL ERROR: CL_MAP_FAILURE."
215 virtual const char* what()
const throw()
217 return "ViennaCL: FATAL ERROR: CL_INVALID_VALUE."
225 virtual const char* what()
const throw()
227 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE_TYPE."
235 virtual const char* what()
const throw()
237 return "ViennaCL: FATAL ERROR: CL_INVALID_PLATFORM."
245 virtual const char* what()
const throw()
247 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE."
255 virtual const char* what()
const throw()
257 return "ViennaCL: FATAL ERROR: CL_INVALID_CONTEXT."
265 virtual const char* what()
const throw()
267 return "ViennaCL: FATAL ERROR: CL_INVALID_QUEUE_PROPERTIES."
275 virtual const char* what()
const throw()
277 return "ViennaCL: FATAL ERROR: CL_INVALID_COMMAND_QUEUE."
285 virtual const char* what()
const throw()
287 return "ViennaCL: FATAL ERROR: CL_INVALID_HOST_PTR."
295 virtual const char* what()
const throw()
297 return "ViennaCL: FATAL ERROR: CL_INVALID_MEM_OBJECT."
305 virtual const char* what()
const throw()
307 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR."
315 virtual const char* what()
const throw()
317 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_SIZE."
325 virtual const char* what()
const throw()
327 return "ViennaCL: FATAL ERROR: CL_INVALID_SAMPLER."
335 virtual const char* what()
const throw()
337 return "ViennaCL: FATAL ERROR: CL_INVALID_BINARY."
345 virtual const char* what()
const throw()
347 return "ViennaCL: FATAL ERROR: CL_INVALID_BUILD_OPTIONS."
355 virtual const char* what()
const throw()
357 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM."
365 virtual const char* what()
const throw()
367 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM_EXECUTABLE."
375 virtual const char* what()
const throw()
377 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL_NAME \n The supplied kernel name is invalid. If you have written your own OpenCL kernel, please check that the correct kernel name is used in the initalization of the kernel object."
385 virtual const char* what()
const throw()
387 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL_DEFINITION."
395 virtual const char* what()
const throw()
397 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL \n The supplied kernel argument is invalid."
405 virtual const char* what()
const throw()
407 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_INDEX."
415 virtual const char* what()
const throw()
417 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_VALUE."
425 virtual const char* what()
const throw()
427 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_SIZE."
435 virtual const char* what()
const throw()
437 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL_ARGS \n The supplied kernel arguments do not fit the kernel parameter list. If you have written your own OpenCL kernel, please check that the correct kernel arguments are set in the appropriate order."
445 virtual const char* what()
const throw()
447 return "ViennaCL: FATAL ERROR: CL_INVALID_WORK_DIMENSION"
455 virtual const char* what()
const throw()
457 return "ViennaCL: FATAL ERROR: CL_INVALID_WORK_GROUP_SIZE \n The supplied work group size is invalid. If you have set this value manually, please reconsider your choice."
465 virtual const char* what()
const throw()
467 return "ViennaCL: FATAL ERROR: CL_INVALID_WORK_ITEM_SIZE \n The work item size is invalid. If you have set this value manually, please reconsider your choice."
475 virtual const char* what()
const throw()
477 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_OFFSET."
485 virtual const char* what()
const throw()
487 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT_WAIT_LIST."
495 virtual const char* what()
const throw()
497 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT."
505 virtual const char* what()
const throw()
507 return "ViennaCL: FATAL ERROR: CL_INVALID_OPERATION."
515 virtual const char* what()
const throw()
517 return "ViennaCL: FATAL ERROR: CL_INVALID_GL_OBJECT."
525 virtual const char* what()
const throw()
527 return "ViennaCL: FATAL ERROR: CL_INVALID_BUFFER_SIZE."
535 virtual const char* what()
const throw()
537 return "ViennaCL: FATAL ERROR: CL_INVALID_MIP_LEVEL."
545 virtual const char* what()
const throw()
547 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_WORK_SIZE."
555 virtual const char* what()
const throw()
557 return "ViennaCL: FATAL ERROR: CL_INVALID_PROPERTY."
565 virtual const char* what()
const throw()
567 return "ViennaCL: FATAL ERROR: ViennaCL encountered an unknown OpenCL error. In some cases, this might be due to an invalid global work size, but it can also be due to several compilation errors."
575 virtual const char* what()
const throw()
577 return "ViennaCL: FATAL ERROR: You requested to create a ViennaCL type using double precision. However, double precision is not supported by your device."
644 #ifdef CL_INVALID_PROPERTY
660 #ifdef VIENNACL_DEBUG_ALL
670 if (err != CL_SUCCESS)
672 #ifdef VIENNACL_DEBUG_ALL
673 std::cerr <<
"ViennaCL: Error " << err <<
" in function " << func <<
" ( "<< file <<
":" << line <<
" ) " << std::endl;
681 #define VIENNACL_ERR_CHECK(err) viennacl::ocl::error_checker<void>::checkError(err, __FILE__, __FUNCTION__, __LINE__);
Exception thrown if an invalid device type is specified.
queue_not_found(std::string const &what_arg)
An error reporting class. Template argument is used to avoid problems with external linkage...
Exception thrown if the image size provided is invalid (e.g. zero).
Exception thrown if the OpenCL just-in-time compiler is not available.
Exception thrown if a memory object cannot be allocated. Usually the requested memory buffer is simpl...
Exception thrown if the number of work groups is invalid (usually this means that more than 256/512/7...
Exception thrown if the provided pointer to host memory is invalid.
Exception thrown if invalid build options are passed to the OpenCL just-in-time compiler.
Exception thrown if the source buffer overlaps the destination buffer when copying from device memory...
Exception thrown if the selected compute device is not available (maybe locked by another process)...
Exception thrown if the kernel argument provided has an invalid value.
Exception thrown if the host cannot provide enough memory for the datastructures in the OpenCL backen...
#define VIENNACL_BUG_REPORT_STRING
Exception thrown if the provided OpenGL (not OpenCL) object is invalid.
Exception thrown if the kernel argument index is invalid, e.g. an arg index larger than the number of...
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Exception thrown if there is no built program exectuable available for the device.
Exception thrown if the provided miplevel is greater than zero, but the OpenGL implementation does no...
Exception thrown if the kernel definition (number of arguments, argument types, etc.) is not the same for all devices for which the program has been built.
Exception thrown if an OpenCL program object handle is invalid (e.g. not initialized).
Exception thrown if interoperability of OpenCL with other frameworks collide.
program_not_found(std::string const &what_arg)
Exception thrown if the compute device is out of resources (either global memory, registers...
Exception thrown if the user wants to use double precision arithmetics, but the device does not suppo...
Exception thrown if an invalid OpenCL device is provided to an OpenCL function.
Exception thrown if the provided buffer size is invalid (e.g. zero)
static void checkError(cl_int err, const char *, const char *, int)
Checks whether an OpenCL error has occured.
Exception thrown if the provided event object (of type cl_event) is invalid.
Exception thrown if the arguments to an OpenCL kernel have an invalid size e.g. not sizeof(cl_mem))...
Exception thrown if the kernel arguments are invalid and/or do not fit the kernel parameter list...
Exception thrown if an invalid OpenCL memory object (of type cl_mem) is passed to an OpenCL funciton...
Exception thrown if an invalid OpenCL context is provided to an OpenCL function.
kernel_not_found(std::string const &what_arg)
Exception thrown if the total number of work items is invalid (for example, not divisible by the numb...
Exception thrown if the work dimension is invalid (usually this means that the work dimension was set...
Exception thrown if the provided kernel name is invalid (e.g. not part of the program provided)...
static void raise_exception(cl_int err)
Trows exceptions that reflect OpenCL error codes.
Exception thrown if an invalid OpenCL command queue is provided to an OpenCL function.
Exception thrown if the provided kernel object (of type cl_kernel) is invalid (e.g. not initialized, from different context, or corrupted).
Exception thrown in the case that a requested compute device was not found.
Exception thrown if the provided offset for get_global_id() in OpenCL kernels is invalid.
Exception thrown if an invalid property is provided to a function (vague value).
Exception thrown if the OpenCL context does not have CL_QUEUE_PROFILING_ENABLE set, if the execution is not complete, or the event object is a user event object.
Exception thrown if the provided event wait list is invalid.
Exception thrown if the OpenCL program cannot be built, usually due to a syntax error in the OpenCL c...
Exception thrown if the number of work items per work group invalid (usually this means that more tha...
Exception thrown if the OpenCL binary (generated from the jit-compiler or loaded from some other loca...
Exception thrown if an invalid sampler is provided for an image.
Exception thrown if the mapping of device memory to the host memory space failed. ...
Exception thrown if the returned error cannot be resolved to some defined error constant. Might result from invalid sources, invalid memory operations, etc.
Exception thrown if invalid OpenCL command queue properties are provided when creating a command queu...
Exception thrown is an invalid value is provided to an OpenCL function.