insert_task.doxy 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 CNRS
  5. * Copyright (C) 2011, 2012 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Insert_Task Task Insert Utility
  9. \fn int starpu_insert_task(struct starpu_codelet *cl, ...)
  10. \ingroup API_Insert_Task
  11. Similar to starpu_task_insert(). Kept to avoid breaking old codes.
  12. \fn int starpu_task_insert(struct starpu_codelet *cl, ...)
  13. \ingroup API_Insert_Task
  14. Create and submit a task corresponding to \p cl with the
  15. following given arguments. The argument list must be zero-terminated.
  16. The arguments following the codelet can be of the following types:
  17. <ul>
  18. <li> ::STARPU_R, ::STARPU_W, ::STARPU_RW, ::STARPU_SCRATCH,
  19. ::STARPU_REDUX an access mode followed by a data handle;
  20. <li> ::STARPU_DATA_ARRAY followed by an array of data handles and its
  21. number of elements;
  22. <li> ::STARPU_DATA_MODE_ARRAY followed by an array of struct
  23. starpu_data_descr, i.e data handles with their associated access
  24. modes, and its number of elements;
  25. <li> ::STARPU_EXECUTE_ON_WORKER, ::STARPU_WORKER_ORDER followed by an integer value
  26. specifying the worker on which to execute the task (as specified by
  27. starpu_task::execute_on_a_specific_worker)
  28. <li> the specific values ::STARPU_VALUE, ::STARPU_CALLBACK,
  29. ::STARPU_CALLBACK_ARG, ::STARPU_CALLBACK_WITH_ARG, ::STARPU_PRIORITY,
  30. ::STARPU_TAG, ::STARPU_TAG_ONLY, ::STARPU_FLOPS, ::STARPU_SCHED_CTX, ::STARPU_CL_ARGS, ::STARPU_CL_ARGS_NFREE,
  31. ::STARPU_TASK_DEPS_ARRAY,
  32. followed by the appropriated objects as defined elsewhere.
  33. </ul>
  34. When using ::STARPU_DATA_ARRAY, the access mode of the data handles is
  35. not defined, it will be taken from the codelet starpu_codelet::modes or starpu_codelet::dyn_modes field. One
  36. should use ::STARPU_DATA_MODE_ARRAY to define the data handles along with the
  37. access modes.
  38. Parameters to be passed to the codelet implementation are defined
  39. through the type ::STARPU_VALUE. The function
  40. starpu_codelet_unpack_args() must be called within the codelet
  41. implementation to retrieve them.
  42. \def STARPU_VALUE
  43. \ingroup API_Insert_Task
  44. Used when calling starpu_task_insert(), must
  45. be followed by a pointer to a constant value and the size of the
  46. constant
  47. \def STARPU_CL_ARGS
  48. \ingroup API_Insert_Task
  49. Used when calling starpu_task_insert(), must
  50. be followed by a memory buffer containing the arguments to be given to
  51. the task, and by the size of the arguments. The memory buffer should
  52. be the result of a previous call to starpu_codelet_pack_args(), and will be
  53. freed (i.e. starpu_task::cl_arg_free will be set to 1)
  54. \def STARPU_CL_ARGS_NFREE
  55. \ingroup API_Insert_Task
  56. Used when calling starpu_task_insert(), similarly to ::STARPU_CL_ARGS, must
  57. be followed by a memory buffer containing the arguments to be given to
  58. the task, and by the size of the arguments. The memory buffer should
  59. be the result of a previous call to starpu_codelet_pack_args(), and will NOT be
  60. freed (i.e. starpu_task::cl_arg_free will be set to 0)
  61. \def STARPU_CALLBACK
  62. \ingroup API_Insert_Task
  63. Used when calling starpu_task_insert(), must
  64. be followed by a pointer to a callback function
  65. \def STARPU_CALLBACK_WITH_ARG
  66. \ingroup API_Insert_Task
  67. Used when calling starpu_task_insert(), must
  68. be followed by two pointers: one to a callback function, and the other
  69. to be given as an argument to the callback function; this is
  70. equivalent to using both ::STARPU_CALLBACK and
  71. ::STARPU_CALLBACK_WITH_ARG.
  72. \def STARPU_CALLBACK_ARG
  73. \ingroup API_Insert_Task
  74. Used when calling starpu_task_insert(), must
  75. be followed by a pointer to be given as an argument to the callback
  76. function
  77. \def STARPU_PRIORITY
  78. \ingroup API_Insert_Task
  79. Used when calling starpu_task_insert(), must
  80. be followed by a integer defining a priority level
  81. \def STARPU_DATA_ARRAY
  82. \ingroup API_Insert_Task
  83. TODO
  84. \def STARPU_DATA_MODE_ARRAY
  85. \ingroup API_Insert_Task
  86. TODO
  87. \def STARPU_EXECUTE_ON_WORKER
  88. \ingroup API_Insert_Task
  89. Used when calling starpu_task_insert(), must be
  90. followed by an integer value specifying the worker on which to execute
  91. the task (as specified by starpu_task::execute_on_a_specific_worker)
  92. \def STARPU_WORKER_ORDER
  93. \ingroup API_Insert_Task
  94. used when calling starpu_task_insert(), must be
  95. followed by an integer value specifying the worker order in which to execute
  96. the tasks (as specified by starpu_task::workerorder)
  97. \def STARPU_TAG
  98. \ingroup API_Insert_Task
  99. Used when calling starpu_task_insert(), must be followed by a tag.
  100. \def STARPU_TAG_ONLY
  101. \ingroup API_Insert_Task
  102. Used when calling starpu_task_insert(), must be followed by a tag
  103. stored in starpu_task::tag_id. Leave starpu_task::use_tag as 0.
  104. \def STARPU_NAME
  105. \ingroup API_Insert_Task
  106. Used when calling starpu_task_insert(), must be followed by a char *
  107. stored in starpu_task::name.
  108. \def STARPU_FLOPS
  109. \ingroup API_Insert_Task
  110. Used when calling starpu_task_insert(), must
  111. be followed by an amount of floating point operations, as a double.
  112. Users <b>MUST</b> explicitly cast into double, otherwise parameter
  113. passing will not work.
  114. \def STARPU_SCHED_CTX
  115. \ingroup API_Insert_Task
  116. Used when calling starpu_task_insert(), must
  117. be followed by the id of the scheduling context to which to submit the
  118. task to.
  119. \def STARPU_TASK_DEPS_ARRAY
  120. \ingroup API_Insert_Task
  121. Used when calling starpu_task_insert(), must
  122. be followed by a number of tasks, and an array containing these tasks.
  123. The function starpu_task_declare_deps_array() will be called with the
  124. given values.
  125. \fn void starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size, ...)
  126. \ingroup API_Insert_Task
  127. Pack arguments of type ::STARPU_VALUE into a buffer which can be
  128. given to a codelet and later unpacked with the function
  129. starpu_codelet_unpack_args().
  130. \fn void starpu_codelet_unpack_args(void *cl_arg, ...)
  131. \ingroup API_Insert_Task
  132. Retrieve the arguments of type ::STARPU_VALUE associated to a
  133. task automatically created using the function starpu_task_insert(). If
  134. any parameter's value is 0, unpacking will stop there and ignore the remaining
  135. parameters.
  136. \fn void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size, ...)
  137. \ingroup API_Insert_Task
  138. Similar to starpu_codelet_unpack_args(), but if any parameter is
  139. 0, copy the part of \p cl_arg that has not been read in \p buffer which
  140. can then be used in a later call to one of the unpack functions.
  141. \fn struct starpu_task *starpu_task_build(struct starpu_codelet *cl, ...)
  142. \ingroup API_Insert_Task
  143. Create a task corresponding to \p cl with the following arguments.
  144. The argument list must be zero-terminated. The arguments
  145. following the codelet are the same as the ones for the function
  146. starpu_task_insert().
  147. If some arguments of type ::STARPU_VALUE are given, the parameter
  148. starpu_task::cl_arg_free will be set to 1.
  149. */