task_dep.jl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. #
  5. # StarPU 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. # StarPU 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. function starpu_tag_declare_deps(id :: starpu_tag_t, dep :: starpu_tag_t, other_deps :: starpu_tag_t...)
  17. v = [dep, other_deps...]
  18. starpu_tag_declare_deps_array(id, length(v), pointer(v))
  19. end
  20. """
  21. starpu_task_declare_deps(task :: StarpuTask, dep :: StarpuTask [, other_deps :: StarpuTask...])
  22. Declare task dependencies between a task and the following provided ones. This function must be called
  23. prior to the submission of the task, but it may called after the submission or the execution of the tasks in the array,
  24. provided the tasks are still valid (i.e. they were not automatically destroyed). Calling this function on a task that was
  25. already submitted or with an entry of task_array that is no longer a valid task results in an undefined behaviour.
  26. """
  27. function starpu_task_declare_deps(task :: jl_starpu_task, dep :: jl_starpu_task, other_deps :: jl_starpu_task...)
  28. task_array = [pointer_from_objref(dep.c_task), map((t -> pointer_from_objref(t.c_task)), other_deps)...]
  29. starpu_task_declare_deps_array(pointer_from_objref(task.c_task), length(task_array), task_array)
  30. end
  31. function starpu_task_end_dep_add(task :: jl_starpu_task, nb_deps :: Int)
  32. starpu_task_end_dep_add(Ref(task.c_task), nb_deps)
  33. end
  34. function starpu_task_end_dep_release(task :: jl_starpu_task)
  35. starpu_task_end_dep_release(Ref(task.c_task))
  36. end
  37. function starpu_task_declare_end_deps(task :: jl_starpu_task, dep :: jl_starpu_task, other_deps :: jl_starpu_task...)
  38. task_array = [pointer_from_objref(dep.c_task), map((t -> pointer_from_objref(t.c_task)), other_deps)...]
  39. starpu_task_declare_end_deps_array(pointer_from_objref(task.c_task), length(task_array), pointer(task_array))
  40. end