debug.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  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. void ERROR_CL(char *s, cl_int err) {
  18. #define ERR_CASE(a) case a: ERROR_MSG("[OpenCL] %s CL error: %s\n", s, #a); break;
  19. switch(err) {
  20. case CL_SUCCESS:
  21. DEBUG_MSG("[OpenCL] %s SUCCESS.\n", s);
  22. break;
  23. ERR_CASE(CL_DEVICE_NOT_FOUND);
  24. ERR_CASE(CL_DEVICE_NOT_AVAILABLE);
  25. ERR_CASE(CL_COMPILER_NOT_AVAILABLE);
  26. ERR_CASE(CL_MEM_OBJECT_ALLOCATION_FAILURE);
  27. ERR_CASE(CL_OUT_OF_RESOURCES);
  28. ERR_CASE(CL_OUT_OF_HOST_MEMORY);
  29. ERR_CASE(CL_PROFILING_INFO_NOT_AVAILABLE);
  30. ERR_CASE(CL_MEM_COPY_OVERLAP);
  31. ERR_CASE(CL_IMAGE_FORMAT_MISMATCH);
  32. ERR_CASE(CL_IMAGE_FORMAT_NOT_SUPPORTED);
  33. ERR_CASE(CL_BUILD_PROGRAM_FAILURE);
  34. ERR_CASE(CL_MAP_FAILURE);
  35. ERR_CASE(CL_INVALID_VALUE);
  36. ERR_CASE(CL_INVALID_DEVICE_TYPE);
  37. ERR_CASE(CL_INVALID_PLATFORM);
  38. ERR_CASE(CL_INVALID_DEVICE);
  39. ERR_CASE(CL_INVALID_CONTEXT);
  40. ERR_CASE(CL_INVALID_QUEUE_PROPERTIES);
  41. ERR_CASE(CL_INVALID_COMMAND_QUEUE);
  42. ERR_CASE(CL_INVALID_HOST_PTR);
  43. ERR_CASE(CL_INVALID_MEM_OBJECT);
  44. ERR_CASE(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR);
  45. ERR_CASE(CL_INVALID_IMAGE_SIZE);
  46. ERR_CASE(CL_INVALID_SAMPLER);
  47. ERR_CASE(CL_INVALID_BINARY);
  48. ERR_CASE(CL_INVALID_BUILD_OPTIONS);
  49. ERR_CASE(CL_INVALID_PROGRAM);
  50. ERR_CASE(CL_INVALID_PROGRAM_EXECUTABLE);
  51. ERR_CASE(CL_INVALID_KERNEL_NAME);
  52. ERR_CASE(CL_INVALID_KERNEL_DEFINITION);
  53. ERR_CASE(CL_INVALID_KERNEL);
  54. ERR_CASE(CL_INVALID_ARG_INDEX);
  55. ERR_CASE(CL_INVALID_ARG_VALUE);
  56. ERR_CASE(CL_INVALID_ARG_SIZE);
  57. ERR_CASE(CL_INVALID_KERNEL_ARGS);
  58. ERR_CASE(CL_INVALID_WORK_DIMENSION);
  59. ERR_CASE(CL_INVALID_WORK_GROUP_SIZE);
  60. ERR_CASE(CL_INVALID_WORK_ITEM_SIZE);
  61. ERR_CASE(CL_INVALID_GLOBAL_OFFSET);
  62. ERR_CASE(CL_INVALID_EVENT_WAIT_LIST);
  63. ERR_CASE(CL_INVALID_EVENT);
  64. ERR_CASE(CL_INVALID_OPERATION);
  65. ERR_CASE(CL_INVALID_GL_OBJECT);
  66. ERR_CASE(CL_INVALID_BUFFER_SIZE);
  67. ERR_CASE(CL_INVALID_MIP_LEVEL);
  68. ERR_CASE(CL_INVALID_GLOBAL_WORK_SIZE);
  69. default:
  70. ERROR_MSG("%s CL error: Error message not supported by ERROR_CL function (%d).\n", s, err);
  71. }
  72. }