opencl-errors.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* GCC-StarPU
  2. Copyright (C) 2012 Institut National de Recherche en Informatique et Automatique
  3. GCC-StarPU is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. GCC-StarPU is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with GCC-StarPU. If not, see <http://www.gnu.org/licenses/>. */
  13. #include <mocks.h> /* for `starpu_opencl_load_opencl_from_string' */
  14. /* Claim that OpenCL is supported. */
  15. #pragma starpu add_target "opencl"
  16. void my_task (int x, float a[x])
  17. __attribute__ ((task));
  18. static void my_task_cpu (int x, float a[x])
  19. __attribute__ ((task_implementation ("cpu", my_task)));
  20. static void my_task_opencl (int x, float a[x])
  21. __attribute__ ((task_implementation ("opencl", my_task)));
  22. static void
  23. my_task_cpu (int x, float a[x])
  24. {
  25. }
  26. #pragma starpu opencl my_task "test.cl" "kern" /* (error "not a.* task impl") */
  27. #pragma starpu opencl my_task_cpu /* (error "not a.* task impl") */ \
  28. "test.cl" "kern"
  29. #pragma starpu opencl my_task_opencl "/dev/null" "kern" /* (error "empty") */
  30. #pragma starpu opencl my_task_opencl "/does-not-exist/" "kern" /* (error "failed to access") */
  31. #pragma starpu opencl my_task_opencl /* (error "wrong number of arg") */
  32. #pragma starpu opencl my_task_opencl 123 "kern" /* (error "string constant") */
  33. #pragma starpu opencl my_task_opencl "test.cl" 123 /* (error "string constant") */
  34. #pragma starpu opencl my_task_opencl "test.cl" "kern" "foo" /* (error "junk after") */
  35. void
  36. foo (void)
  37. {
  38. #pragma starpu opencl my_task_opencl "test.cl" "kern" /* (error "top-level") */
  39. }