opencl-errors.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* GCC-StarPU
  2. Copyright (C) 2012 INRIA
  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" 1 /* (error "not a.* task impl") */
  27. #pragma starpu opencl my_task_cpu /* (error "not a.* task impl") */ \
  28. "test.cl" "kern" 1
  29. #pragma starpu opencl my_task_opencl "/dev/null" "kern" 1 /* (error "empty") */
  30. #pragma starpu opencl my_task_opencl "/does-not-exist/" "kern" 1 /* (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" 1 /* (error "string constant") */
  33. #pragma starpu opencl my_task_opencl "test.cl" 123 1 /* (error "string constant") */
  34. #pragma starpu opencl my_task_opencl "test.cl" "kern" "a" /* (error "integral type") */
  35. #pragma starpu opencl my_task_opencl "test.cl" "kern" 1 "foo" /* (error "junk after") */
  36. void
  37. foo (void)
  38. {
  39. #pragma starpu opencl my_task_opencl "test.cl" "kern" 1 /* (error "top-level") */
  40. }