insert_task.doxy 8.3 KB

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