debug.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011, 2015 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. #ifndef SOCL_DEBUG_H
  17. #define SOCL_DEBUG_H
  18. #include <../src/common/config.h>
  19. #ifdef STARPU_VERBOSE
  20. #define DEBUG
  21. #include <stdio.h>
  22. #define DEBUG_MSG(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, "[SOCL] [%s] ", __starpu_func__); fprintf(stderr, __VA_ARGS__);}} while (0)
  23. #define DEBUG_MSG_NOHEAD(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, __VA_ARGS__);}} while (0);
  24. #define DEBUG_ERROR(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, "[SOCL] ERROR: "__VA_ARGS__); } exit(1); } while (0)
  25. #else
  26. #define DEBUG_MSG(...) while(0)
  27. #define DEBUG_MSG_NOHEAD(...) while(0)
  28. #define DEBUG_ERROR(...) while(0)
  29. #endif
  30. #define ERROR_MSG(...) do { fprintf(stderr, "[SOCL] [%s] ERROR: ", __starpu_func__); fprintf(stderr, __VA_ARGS__); } while (0)
  31. #define ERROR_MSG_NOHEAD(...) fprintf(stderr, __VA_ARGS__)
  32. #define ERROR_STOP(...) do { ERROR_MSG(__VA_ARGS__); exit(1); } while(0)
  33. void ERROR_CL(char *s, cl_int err);
  34. #ifdef STARPU_VERBOSE
  35. #define DEBUG_CL(args...) ERROR_CL(args)
  36. #else
  37. #define DEBUG_CL(...) while(0)
  38. #endif
  39. #ifdef DEBUG
  40. #define DEBUG_PARAM(p) p
  41. #else
  42. #define DEBUG_PARAM(p) UNUSED(p)
  43. #endif
  44. #endif /* SOCL_DEBUG_H */