insert_task_nullcodelet.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012 Inria
  4. * Copyright (C) 2011-2013,2015,2017 CNRS
  5. * Copyright (C) 2012,2016 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #include <starpu.h>
  19. #include "../helper.h"
  20. /*
  21. * Try starpu_task_insert with a NULL codelet
  22. */
  23. int main(void)
  24. {
  25. int ret;
  26. ret = starpu_init(NULL);
  27. if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
  28. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  29. ret = starpu_task_insert(NULL, 0);
  30. if (ret == -ENODEV) goto enodev;
  31. STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
  32. ret = starpu_task_wait_for_all();
  33. STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
  34. starpu_shutdown();
  35. return EXIT_SUCCESS;
  36. enodev:
  37. starpu_shutdown();
  38. fprintf(stderr, "WARNING: No one can execute this task\n");
  39. /* yes, we do not perform the computation but we did detect that no one
  40. * could perform the kernel, so this is not an error from StarPU */
  41. return STARPU_TEST_SKIPPED;
  42. }