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>
51 #define VIENNACL_BUG_REPORT_STRING \
52 "\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"\
53 " * Operating System\n"\
54 " * Which OpenCL implementation (AMD, NVIDIA, etc.)\n"\
55 " * ViennaCL version\n"\
56 "Many thanks in advance!";\
70 virtual const char* what()
const throw()
72 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."
80 virtual const char* what()
const throw()
82 return "ViennaCL: FATAL ERROR: CL_DEVICE_NOT_AVAILABLE \n ViennaCL could not use the compute device because it is not available."
90 virtual const char* what()
const throw()
92 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."
100 virtual const char* what()
const throw()
102 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."
110 virtual const char* what()
const throw()
112 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."
120 virtual const char* what()
const throw()
122 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."
130 virtual const char* what()
const throw()
132 return "ViennaCL: FATAL ERROR: CL_PROFILING_INFO_NOT_AVAILABLE."
140 virtual const char* what()
const throw()
142 return "ViennaCL: FATAL ERROR: CL_MEM_COPY_OVERLAP."
150 virtual const char* what()
const throw()
152 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_MISMATCH."
160 virtual const char* what()
const throw()
162 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_NOT_SUPPORTED."
170 virtual const char* what()
const throw()
172 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."
180 virtual const char* what()
const throw()
182 return "ViennaCL: FATAL ERROR: CL_MAP_FAILURE."
190 virtual const char* what()
const throw()
192 return "ViennaCL: FATAL ERROR: CL_INVALID_VALUE."
200 virtual const char* what()
const throw()
202 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE_TYPE."
210 virtual const char* what()
const throw()
212 return "ViennaCL: FATAL ERROR: CL_INVALID_PLATFORM."
220 virtual const char* what()
const throw()
222 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE."
230 virtual const char* what()
const throw()
232 return "ViennaCL: FATAL ERROR: CL_INVALID_CONTEXT."
240 virtual const char* what()
const throw()
242 return "ViennaCL: FATAL ERROR: CL_INVALID_QUEUE_PROPERTIES."
250 virtual const char* what()
const throw()
252 return "ViennaCL: FATAL ERROR: CL_INVALID_COMMAND_QUEUE."
260 virtual const char* what()
const throw()
262 return "ViennaCL: FATAL ERROR: CL_INVALID_HOST_PTR."
270 virtual const char* what()
const throw()
272 return "ViennaCL: FATAL ERROR: CL_INVALID_MEM_OBJECT."
280 virtual const char* what()
const throw()
282 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR."
290 virtual const char* what()
const throw()
292 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_SIZE."
300 virtual const char* what()
const throw()
302 return "ViennaCL: FATAL ERROR: CL_INVALID_SAMPLER."
310 virtual const char* what()
const throw()
312 return "ViennaCL: FATAL ERROR: CL_INVALID_BINARY."
320 virtual const char* what()
const throw()
322 return "ViennaCL: FATAL ERROR: CL_INVALID_BUILD_OPTIONS."
330 virtual const char* what()
const throw()
332 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM."
340 virtual const char* what()
const throw()
342 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM_EXECUTABLE."
350 virtual const char* what()
const throw()
352 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."
360 virtual const char* what()
const throw()
362 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL_DEFINITION."
370 virtual const char* what()
const throw()
372 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL \n The supplied kernel argument is invalid."
380 virtual const char* what()
const throw()
382 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_INDEX."
390 virtual const char* what()
const throw()
392 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_VALUE."
400 virtual const char* what()
const throw()
402 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_SIZE."
410 virtual const char* what()
const throw()
412 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."
420 virtual const char* what()
const throw()
422 return "ViennaCL: FATAL ERROR: CL_INVALID_WORK_DIMENSION"
430 virtual const char* what()
const throw()
432 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."
440 virtual const char* what()
const throw()
442 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."
450 virtual const char* what()
const throw()
452 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_OFFSET."
460 virtual const char* what()
const throw()
462 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT_WAIT_LIST."
470 virtual const char* what()
const throw()
472 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT."
480 virtual const char* what()
const throw()
482 return "ViennaCL: FATAL ERROR: CL_INVALID_OPERATION."
490 virtual const char* what()
const throw()
492 return "ViennaCL: FATAL ERROR: CL_INVALID_GL_OBJECT."
500 virtual const char* what()
const throw()
502 return "ViennaCL: FATAL ERROR: CL_INVALID_BUFFER_SIZE."
510 virtual const char* what()
const throw()
512 return "ViennaCL: FATAL ERROR: CL_INVALID_MIP_LEVEL."
520 virtual const char* what()
const throw()
522 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_WORK_SIZE."
530 virtual const char* what()
const throw()
532 return "ViennaCL: FATAL ERROR: CL_INVALID_PROPERTY."
540 virtual const char* what()
const throw()
542 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."
550 virtual const char* what()
const throw()
552 return "ViennaCL: FATAL ERROR: You requested to create a ViennaCL type using double precision. However, double precision is not supported by your device."
619 #ifdef CL_INVALID_PROPERTY
635 #ifdef VIENNACL_DEBUG_ALL
645 if (err != CL_SUCCESS)
647 #ifdef VIENNACL_DEBUG_ALL
648 std::cerr <<
"ViennaCL: Error " << err <<
" in function " << func <<
" ( "<< file <<
":" << line <<
" ) " << std::endl;
656 #define VIENNACL_ERR_CHECK(err) viennacl::ocl::error_checker<void>::checkError(err, __FILE__, __FUNCTION__, __LINE__);
Exception thrown if an invalid device type is specified.
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.
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.
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.