empty_task_sync_point_tasks.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <starpu.h>
  18. static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
  19. {
  20. }
  21. static starpu_codelet dummy_codelet =
  22. {
  23. .where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
  24. .cpu_func = dummy_func,
  25. .cuda_func = dummy_func,
  26. .opencl_func = dummy_func,
  27. .model = NULL,
  28. .nbuffers = 0
  29. };
  30. int main(int argc, char **argv)
  31. {
  32. starpu_init(NULL);
  33. /* {A,B,C} -> D -> {E,F}, D is empty */
  34. struct starpu_task *taskA = starpu_task_create();
  35. taskA->cl = &dummy_codelet;
  36. struct starpu_task *taskB = starpu_task_create();
  37. taskB->cl = &dummy_codelet;
  38. struct starpu_task *taskC = starpu_task_create();
  39. taskC->cl = &dummy_codelet;
  40. struct starpu_task *taskD = starpu_task_create();
  41. taskD->cl = NULL;
  42. struct starpu_task *taskE = starpu_task_create();
  43. taskE->cl = &dummy_codelet;
  44. struct starpu_task *taskF = starpu_task_create();
  45. taskF->cl = &dummy_codelet;
  46. struct starpu_task *tasksABC[3] = {taskA, taskB, taskC};
  47. starpu_task_declare_deps_array(taskD, 3, tasksABC);
  48. starpu_task_declare_deps_array(taskE, 1, &taskD);
  49. starpu_task_declare_deps_array(taskF, 1, &taskD);
  50. starpu_task_submit(taskA);
  51. starpu_task_submit(taskB);
  52. starpu_task_submit(taskC);
  53. starpu_task_submit(taskD);
  54. starpu_task_submit(taskE);
  55. starpu_task_submit(taskF);
  56. starpu_task_wait_for_all();
  57. starpu_shutdown();
  58. return 0;
  59. }