empty_task_sync_point_tasks.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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 <starpu.h>
  17. static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
  18. {
  19. }
  20. static starpu_codelet dummy_codelet =
  21. {
  22. .where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
  23. .cpu_func = dummy_func,
  24. .cuda_func = dummy_func,
  25. .opencl_func = dummy_func,
  26. .model = NULL,
  27. .nbuffers = 0
  28. };
  29. int main(int argc, char **argv)
  30. {
  31. starpu_init(NULL);
  32. /* {A,B,C} -> D -> {E,F}, D is empty */
  33. struct starpu_task *taskA = starpu_task_create();
  34. taskA->cl = &dummy_codelet;
  35. struct starpu_task *taskB = starpu_task_create();
  36. taskB->cl = &dummy_codelet;
  37. struct starpu_task *taskC = starpu_task_create();
  38. taskC->cl = &dummy_codelet;
  39. struct starpu_task *taskD = starpu_task_create();
  40. taskD->cl = NULL;
  41. struct starpu_task *taskE = starpu_task_create();
  42. taskE->cl = &dummy_codelet;
  43. struct starpu_task *taskF = starpu_task_create();
  44. taskF->cl = &dummy_codelet;
  45. struct starpu_task *tasksABC[3] = {taskA, taskB, taskC};
  46. starpu_task_declare_deps_array(taskD, 3, tasksABC);
  47. starpu_task_declare_deps_array(taskE, 1, &taskD);
  48. starpu_task_declare_deps_array(taskF, 1, &taskD);
  49. starpu_task_submit(taskA);
  50. starpu_task_submit(taskB);
  51. starpu_task_submit(taskC);
  52. starpu_task_submit(taskD);
  53. starpu_task_submit(taskE);
  54. starpu_task_submit(taskF);
  55. starpu_task_wait_for_all();
  56. starpu_shutdown();
  57. return 0;
  58. }