insert_task.doxy 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 CNRS
  5. * Copyright (C) 2011, 2012 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Insert_Task Insert_Task
  9. \fn starpu_insert_task(struct starpu_codelet *cl, ...)
  10. \ingroup API_Insert_Task
  11. This function does the same as the function starpu_task_insert(). It has been 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 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
  31. followed by the appropriated objects as defined elsewhere.
  32. </ul>
  33. When using ::STARPU_DATA_ARRAY, the access mode of the data handles is
  34. not defined, it will be taken from the codelet starpu_codelet::modes or starpu_codelet::dyn_modes field. One
  35. should use ::STARPU_DATA_MODE_ARRAY to define the data handles along with the
  36. access modes.
  37. Parameters to be passed to the codelet implementation are defined
  38. through the type ::STARPU_VALUE. The function
  39. starpu_codelet_unpack_args() must be called within the codelet
  40. implementation to retrieve them.
  41. \def STARPU_VALUE
  42. \ingroup API_Insert_Task
  43. this macro is used when calling starpu_task_insert(), and must
  44. be followed by a pointer to a constant value and the size of the
  45. constant
  46. \def STARPU_CL_ARGS
  47. \ingroup API_Insert_Task
  48. this macro is used when calling starpu_task_insert(), and must
  49. be followed by a memory buffer containing the arguments to be given to
  50. the task, and by the size of the arguments. The memory buffer should
  51. be the result of a previous call to starpu_codelet_pack_args()
  52. \def STARPU_CALLBACK
  53. \ingroup API_Insert_Task
  54. this macro is used when calling starpu_task_insert(), and must
  55. be followed by a pointer to a callback function
  56. \def STARPU_CALLBACK_WITH_ARG
  57. \ingroup API_Insert_Task
  58. this macro is used when calling starpu_task_insert(), and must
  59. be followed by two pointers: one to a callback function, and the other
  60. to be given as an argument to the callback function; this is
  61. equivalent to using both ::STARPU_CALLBACK and
  62. ::STARPU_CALLBACK_WITH_ARG.
  63. \def STARPU_CALLBACK_ARG
  64. \ingroup API_Insert_Task
  65. this macro is used when calling starpu_task_insert(), and must
  66. be followed by a pointer to be given as an argument to the callback
  67. function
  68. \def STARPU_PRIORITY
  69. \ingroup API_Insert_Task
  70. this macro is used when calling starpu_task_insert(), and must
  71. be followed by a integer defining a priority level
  72. \def STARPU_DATA_ARRAY
  73. \ingroup API_Insert_Task
  74. TODO
  75. \def STARPU_DATA_MODE_ARRAY
  76. \ingroup API_Insert_Task
  77. TODO
  78. \def STARPU_EXECUTE_ON_WORKER
  79. \ingroup API_Insert_Task
  80. this macro is used when calling starpu_task_insert(), and must be
  81. followed by an integer value specifying the worker on which to execute
  82. the task (as specified by starpu_task::execute_on_a_specific_worker)
  83. \def STARPU_WORKER_ORDER
  84. \ingroup API_Insert_Task
  85. this macro is used when calling starpu_task_insert(), and must be
  86. followed by an integer value specifying the worker order in which to execute
  87. the tasks (as specified by starpu_task::workerorder)
  88. \def STARPU_TAG
  89. \ingroup API_Insert_Task
  90. this macro is used when calling starpu_task_insert(), and must be followed by a tag.
  91. \def STARPU_TAG_ONLY
  92. \ingroup API_Insert_Task
  93. this macro is used when calling starpu_task_insert(), and must be followed by a tag.
  94. It sets starpu_task::tag_id, but leaves starpu_task::use_tag as 0.
  95. \def STARPU_NAME
  96. \ingroup API_Insert_Task
  97. this macro is used when calling starpu_task_insert(), and must be followed by a char *.
  98. It sets starpu_task::name to it.
  99. \def STARPU_FLOPS
  100. \ingroup API_Insert_Task
  101. this macro is used when calling starpu_task_insert(), and must
  102. be followed by an amount of floating point operations, as a double.
  103. Users <b>MUST</b> explicitly cast into double, otherwise parameter
  104. passing will not work.
  105. \def STARPU_SCHED_CTX
  106. \ingroup API_Insert_Task
  107. this macro is used when calling starpu_task_insert(), and must
  108. be followed by the id of the scheduling context to which we want to
  109. submit the task.
  110. \fn void starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size, ...)
  111. \ingroup API_Insert_Task
  112. Pack arguments of type ::STARPU_VALUE into a buffer which can be
  113. given to a codelet and later unpacked with the function
  114. starpu_codelet_unpack_args().
  115. \fn void starpu_codelet_unpack_args(void *cl_arg, ...)
  116. \ingroup API_Insert_Task
  117. Retrieve the arguments of type ::STARPU_VALUE associated to a
  118. task automatically created using the function starpu_task_insert(). If
  119. some parameter is NULL, unpacking will stop there and ignore the remaining
  120. parameters.
  121. \fn void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size, ...)
  122. \ingroup API_Insert_Task
  123. Similar to starpu_codelet_unpack_args(), but if some parameter is
  124. NULL, copy the part of cl_arg that has not been read in buffer which
  125. can then be used in a later call to one of the unpack functions.
  126. \fn struct starpu_task *starpu_task_build(struct starpu_codelet *cl, ...)
  127. \ingroup API_Insert_Task
  128. Create a task corresponding to \p cl with the following arguments.
  129. The argument list must be zero-terminated. The arguments
  130. following the codelet are the same as the ones for the function
  131. starpu_task_insert().
  132. If some arguments of type ::STARPU_VALUE are given, the parameter
  133. starpu_task::cl_arg_free will be set to 1.
  134. */