1 #ifndef VIENNACL_OCL_ERROR_HPP_
2 #define VIENNACL_OCL_ERROR_HPP_
35 #ifdef VIENNACL_BUILD_INFO
36 #define VIENNACL_DEBUG_ALL
41 #include <OpenCL/cl.h>
50 #define VIENNACL_BUG_REPORT_STRING \
51 "\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"\
52 " * Operating System\n"\
53 " * Which OpenCL implementation (AMD, NVIDIA, etc.)\n"\
54 " * ViennaCL version\n"\
55 "Many thanks in advance!";\
64 virtual const char* what()
const throw()
66 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."
73 virtual const char* what()
const throw()
75 return "ViennaCL: FATAL ERROR: CL_DEVICE_NOT_AVAILABLE \n ViennaCL could not use the compute device because it is not available."
82 virtual const char* what()
const throw()
84 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."
91 virtual const char* what()
const throw()
93 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."
100 virtual const char* what()
const throw()
102 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."
109 virtual const char* what()
const throw()
111 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."
118 virtual const char* what()
const throw()
120 return "ViennaCL: FATAL ERROR: CL_PROFILING_INFO_NOT_AVAILABLE."
127 virtual const char* what()
const throw()
129 return "ViennaCL: FATAL ERROR: CL_MEM_COPY_OVERLAP."
136 virtual const char* what()
const throw()
138 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_MISMATCH."
145 virtual const char* what()
const throw()
147 return "ViennaCL: FATAL ERROR: CL_IMAGE_FORMAT_NOT_SUPPORTED."
154 virtual const char* what()
const throw()
156 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."
163 virtual const char* what()
const throw()
165 return "ViennaCL: FATAL ERROR: CL_MAP_FAILURE."
172 virtual const char* what()
const throw()
174 return "ViennaCL: FATAL ERROR: CL_INVALID_VALUE."
181 virtual const char* what()
const throw()
183 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE_TYPE."
190 virtual const char* what()
const throw()
192 return "ViennaCL: FATAL ERROR: CL_INVALID_PLATFORM."
199 virtual const char* what()
const throw()
201 return "ViennaCL: FATAL ERROR: CL_INVALID_DEVICE."
208 virtual const char* what()
const throw()
210 return "ViennaCL: FATAL ERROR: CL_INVALID_CONTEXT."
217 virtual const char* what()
const throw()
219 return "ViennaCL: FATAL ERROR: CL_INVALID_QUEUE_PROPERTIES."
226 virtual const char* what()
const throw()
228 return "ViennaCL: FATAL ERROR: CL_INVALID_COMMAND_QUEUE."
235 virtual const char* what()
const throw()
237 return "ViennaCL: FATAL ERROR: CL_INVALID_HOST_PTR."
244 virtual const char* what()
const throw()
246 return "ViennaCL: FATAL ERROR: CL_INVALID_MEM_OBJECT."
253 virtual const char* what()
const throw()
255 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR."
262 virtual const char* what()
const throw()
264 return "ViennaCL: FATAL ERROR: CL_INVALID_IMAGE_SIZE."
271 virtual const char* what()
const throw()
273 return "ViennaCL: FATAL ERROR: CL_INVALID_SAMPLER."
280 virtual const char* what()
const throw()
282 return "ViennaCL: FATAL ERROR: CL_INVALID_BINARY."
289 virtual const char* what()
const throw()
291 return "ViennaCL: FATAL ERROR: CL_INVALID_BUILD_OPTIONS."
298 virtual const char* what()
const throw()
300 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM."
307 virtual const char* what()
const throw()
309 return "ViennaCL: FATAL ERROR: CL_INVALID_PROGRAM_EXECUTABLE."
316 virtual const char* what()
const throw()
318 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."
325 virtual const char* what()
const throw()
327 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL_DEFINITION."
334 virtual const char* what()
const throw()
336 return "ViennaCL: FATAL ERROR: CL_INVALID_KERNEL \n The supplied kernel argument is invalid."
343 virtual const char* what()
const throw()
345 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_INDEX."
352 virtual const char* what()
const throw()
354 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_VALUE."
361 virtual const char* what()
const throw()
363 return "ViennaCL: FATAL ERROR: CL_INVALID_ARG_SIZE."
370 virtual const char* what()
const throw()
372 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."
379 virtual const char* what()
const throw()
381 return "ViennaCL: FATAL ERROR: CL_INVALID_WORK_DIMENSION"
388 virtual const char* what()
const throw()
390 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."
397 virtual const char* what()
const throw()
399 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."
406 virtual const char* what()
const throw()
408 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_OFFSET."
415 virtual const char* what()
const throw()
417 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT_WAIT_LIST."
424 virtual const char* what()
const throw()
426 return "ViennaCL: FATAL ERROR: CL_INVALID_EVENT."
433 virtual const char* what()
const throw()
435 return "ViennaCL: FATAL ERROR: CL_INVALID_OPERATION."
442 virtual const char* what()
const throw()
444 return "ViennaCL: FATAL ERROR: CL_INVALID_GL_OBJECT."
451 virtual const char* what()
const throw()
453 return "ViennaCL: FATAL ERROR: CL_INVALID_BUFFER_SIZE."
460 virtual const char* what()
const throw()
462 return "ViennaCL: FATAL ERROR: CL_INVALID_MIP_LEVEL."
469 virtual const char* what()
const throw()
471 return "ViennaCL: FATAL ERROR: CL_INVALID_GLOBAL_WORK_SIZE."
478 virtual const char* what()
const throw()
480 return "ViennaCL: FATAL ERROR: CL_INVALID_PROPERTY."
487 virtual const char* what()
const throw()
489 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."
497 virtual const char* what()
const throw()
499 return "ViennaCL: FATAL ERROR: You requested to create a ViennaCL type using double precision. However, double precision is not supported by your device."
510 template <
typename T>
566 #ifdef CL_INVALID_PROPERTY
580 static void checkError(cl_int err,
const std::string & file,
const std::string & func,
int line)
582 if (err != CL_SUCCESS)
584 #ifdef VIENNACL_DEBUG_ALL
585 std::cerr <<
"ViennaCL: Error " << err <<
" in function " << func <<
" ( "<< file <<
":" << line <<
" ) " << std::endl;
593 #define VIENNACL_ERR_CHECK(err) viennacl::ocl::error_checker<void>::checkError(err, __FILE__, __FUNCTION__, __LINE__);