debug.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011 University of Bordeaux
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include "socl.h"
  17. #ifdef STARPU_VERBOSE
  18. void DEBUG_CL(char *s, cl_int err) {
  19. #define ERR_CASE(a) case a: DEBUG_MSG("[OpenCL] %s CL error: %s\n", s, #a); break;
  20. switch(err) {
  21. case CL_SUCCESS:
  22. DEBUG_MSG("[OpenCL] %s SUCCESS.\n", s);
  23. break;
  24. ERR_CASE(CL_DEVICE_NOT_FOUND)
  25. ERR_CASE(CL_DEVICE_NOT_AVAILABLE)
  26. ERR_CASE(CL_COMPILER_NOT_AVAILABLE)
  27. ERR_CASE(CL_MEM_OBJECT_ALLOCATION_FAILURE)
  28. ERR_CASE(CL_OUT_OF_RESOURCES)
  29. ERR_CASE(CL_OUT_OF_HOST_MEMORY)
  30. ERR_CASE(CL_PROFILING_INFO_NOT_AVAILABLE)
  31. ERR_CASE(CL_MEM_COPY_OVERLAP)
  32. ERR_CASE(CL_IMAGE_FORMAT_MISMATCH)
  33. ERR_CASE(CL_IMAGE_FORMAT_NOT_SUPPORTED)
  34. ERR_CASE(CL_BUILD_PROGRAM_FAILURE)
  35. ERR_CASE(CL_MAP_FAILURE)
  36. ERR_CASE(CL_INVALID_VALUE)
  37. ERR_CASE(CL_INVALID_DEVICE_TYPE)
  38. ERR_CASE(CL_INVALID_PLATFORM)
  39. ERR_CASE(CL_INVALID_DEVICE)
  40. ERR_CASE(CL_INVALID_CONTEXT)
  41. ERR_CASE(CL_INVALID_QUEUE_PROPERTIES)
  42. ERR_CASE(CL_INVALID_COMMAND_QUEUE)
  43. ERR_CASE(CL_INVALID_HOST_PTR)
  44. ERR_CASE(CL_INVALID_MEM_OBJECT)
  45. ERR_CASE(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR)
  46. ERR_CASE(CL_INVALID_IMAGE_SIZE)
  47. ERR_CASE(CL_INVALID_SAMPLER)
  48. ERR_CASE(CL_INVALID_BINARY)
  49. ERR_CASE(CL_INVALID_BUILD_OPTIONS)
  50. ERR_CASE(CL_INVALID_PROGRAM)
  51. ERR_CASE(CL_INVALID_PROGRAM_EXECUTABLE)
  52. ERR_CASE(CL_INVALID_KERNEL_NAME)
  53. ERR_CASE(CL_INVALID_KERNEL_DEFINITION)
  54. ERR_CASE(CL_INVALID_KERNEL)
  55. ERR_CASE(CL_INVALID_ARG_INDEX)
  56. ERR_CASE(CL_INVALID_ARG_VALUE)
  57. ERR_CASE(CL_INVALID_ARG_SIZE)
  58. ERR_CASE(CL_INVALID_KERNEL_ARGS)
  59. ERR_CASE(CL_INVALID_WORK_DIMENSION)
  60. ERR_CASE(CL_INVALID_WORK_GROUP_SIZE)
  61. ERR_CASE(CL_INVALID_WORK_ITEM_SIZE)
  62. ERR_CASE(CL_INVALID_GLOBAL_OFFSET)
  63. ERR_CASE(CL_INVALID_EVENT_WAIT_LIST)
  64. ERR_CASE(CL_INVALID_EVENT)
  65. ERR_CASE(CL_INVALID_OPERATION)
  66. ERR_CASE(CL_INVALID_GL_OBJECT)
  67. ERR_CASE(CL_INVALID_BUFFER_SIZE)
  68. ERR_CASE(CL_INVALID_MIP_LEVEL)
  69. ERR_CASE(CL_INVALID_GLOBAL_WORK_SIZE)
  70. default:
  71. DEBUG_MSG("%s CL error: Error message not supported by DEBUG_CL macro (%d).\n", s, err);
  72. }
  73. }
  74. #endif