modularized_scheduler.doxy 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /*! \defgroup API_Modularized_Scheduler Modularized Scheduler Interface
  2. \struct starpu_sched_node
  3. \ingroup API_Modularized_Scheduler
  4. This structure represent a scheduler module.
  5. \var starpu_sched_node::push_task
  6. push a task in the scheduler module.
  7. \var starpu_sched_node::pop_task
  8. pop a task from the scheduler module, the task returned by this function is executable by the caller
  9. It should use starpu_sched_node::fathers[sched_ctx_id] to perform a recursive call.
  10. \var starpu_sched_node::estimated_load
  11. is an heuristic to compute load of scheduler module. Basically the number of tasks divided by the sum
  12. of relatives speedup of workers available in context.
  13. \var starpu_sched_node::estimated_end
  14. return the time when a worker will enter in starvation. This function is relevant only if the task->predicted
  15. member has been set.
  16. \var starpu_sched_node::nchilds
  17. the number of modules downstairs
  18. \var starpu_sched_node::childs
  19. modules downstairs
  20. \var starpu_sched_node::workers
  21. this member contain the set of underlying workers
  22. \var starpu_sched_node::workers_in_ctx
  23. this member contain the subset of starpu_sched_node::workers that is currently available in the context
  24. The push method should take this member into account.
  25. \var starpu_sched_node::is_homogeneous
  26. this is set to true iff all underlying workers are the same starpu_worker_archtype.
  27. \var starpu_sched_node::data
  28. data used by the scheduler module
  29. \var starpu_sched_node::add_child
  30. add a child to node
  31. \var starpu_sched_node::remove_child
  32. remove a child from node
  33. \var starpu_sched_node::fathers
  34. the array of scheduler module above indexed by scheduling context index
  35. \var starpu_sched_node::notify_change_workers
  36. this function is called when starpu_sched_node::workers_in_ctx or starpu_sched_node::workers is changed
  37. \var starpu_sched_node::deinit_data
  38. called by starpu_sched_node_destroy. Should free data allocated during creation
  39. \var starpu_sched_node::obj
  40. the hwloc object associated to scheduler module
  41. \struct starpu_sched_tree
  42. \ingroup API_Modularized_Scheduler
  43. The actual scheduler
  44. \var starpu_sched_tree::root
  45. this is the entry module of the scheduler
  46. \var starpu_sched_tree::workers
  47. this is the set of workers available in this context, this value is used to mask workers in modules
  48. \var starpu_sched_tree::lock
  49. this lock protect concurrent access from the hypervisor and the application.
  50. \var starpu_sched_tree::sched_ctx_id
  51. the context id of the scheduler
  52. \fn struct starpu_sched_node * starpu_sched_node_create(void)
  53. \ingroup API_Modularized_Scheduler
  54. allocate and initialize node field with defaults values :
  55. .pop_task make recursive call on father
  56. .estimated_load compute relative speedup and tasks in sub tree
  57. .estimated_end return the average of recursive call on childs
  58. .add_child is starpu_sched_node_add_child
  59. .remove_child is starpu_sched_node_remove_child
  60. .notify_change_workers does nothing
  61. .deinit_data does nothing
  62. \fn void starpu_sched_node_destroy(struct starpu_sched_node * node)
  63. \ingroup API_Modularized_Scheduler
  64. free data allocated by starpu_sched_node_create and call node->deinit_data(node)
  65. set to null the member starpu_sched_node::fathers[sched_ctx_id] of all child if its equal to \p node
  66. \fn void starpu_sched_node_set_father(struct starpu_sched_node * node, struct starpu_sched_node * father_node, unsigned sched_ctx_id)
  67. \ingroup API_Modularized_Scheduler
  68. set node->fathers[sched_ctx_id] to father_node
  69. \fn void starpu_sched_node_add_child(struct starpu_sched_node* node, struct starpu_sched_node * child)
  70. \ingroup API_Modularized_Scheduler
  71. add child to node->childs and increment nchilds as well.
  72. and dont modify child->fathers
  73. \p child must not be already in starpu_sched_node::childs of \p node
  74. \fn void starpu_sched_node_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
  75. \ingroup API_Modularized_Scheduler
  76. remove child from node->childs and decrements nchilds
  77. \p child must be in starpu_sched_node::child of \p node
  78. \fn int starpu_sched_node_can_execute_task(struct starpu_sched_node * node, struct starpu_task * task)
  79. \ingroup API_Modularized_Scheduler
  80. return true iff \p node can execute \p task, this function take into account the workers available in the scheduling context
  81. \fn int STARPU_WARN_UNUSED_RESULT starpu_sched_node_execute_preds(struct starpu_sched_node * node, struct starpu_task * task, double * length);
  82. \ingroup API_Modularized_Scheduler
  83. return a non null value if \p node can execute \p task.
  84. write the execution prediction length for the best implementation of the best worker available and write this at \p length address.
  85. this result is more relevant if starpu_sched_node::is_homogeneous is non null.
  86. if a worker need to be calibrated for an implementation, nan is set to \p length.
  87. \fn double starpu_sched_node_transfer_length(struct starpu_sched_node * node, struct starpu_task * task);
  88. \ingroup API_Modularized_Scheduler
  89. return the average time to transfer \p task data to underlying \p node workers.
  90. \fn struct starpu_sched_node * starpu_sched_node_worker_get(int workerid)
  91. \ingroup API_Modularized_Scheduler
  92. return the struct starpu_sched_node corresponding to \p workerid. Undefined if \p workerid is not a valid workerid
  93. \fn int starpu_sched_node_is_worker(struct starpu_sched_node * node)
  94. \ingroup API_Modularized_Scheduler
  95. return true iff \p node is a worker node
  96. \fn int starpu_sched_node_is_simple_worker(struct starpu_sched_node * node)
  97. \ingroup API_Modularized_Scheduler
  98. return true iff \p node is a simple worker node
  99. \fn int starpu_sched_node_is_combined_worker(struct starpu_sched_node * node)
  100. \ingroup API_Modularized_Scheduler
  101. return true iff \p node is a combined worker node
  102. \fn int starpu_sched_node_worker_get_workerid(struct starpu_sched_node * worker_node)
  103. \ingroup API_Modularized_Scheduler
  104. return the workerid of \p worker_node, undefined if starpu_sched_node_is_worker(worker_node) == 0
  105. \fn struct starpu_sched_node * starpu_sched_node_fifo_create(void * arg STARPU_ATTRIBUTE_UNUSED)
  106. \ingroup API_Modularized_Scheduler
  107. Return a struct starpu_sched_node with a fifo. A stable sort is performed according to tasks priorities.
  108. A push_task call on this node does not perform recursive calls, underlaying nodes will have to call pop_task to get it.
  109. starpu_sched_node::estimated_end function compute the estimated length by dividing the sequential length by the number of underlying workers. Do not take into account tasks that are currently executed.
  110. \fn int starpu_sched_node_is_fifo(struct starpu_sched_node * node)
  111. \ingroup API_Modularized_Scheduler
  112. return true iff \p node is a fifo node
  113. \fn struct starpu_sched_node * starpu_sched_node_work_stealing_create(void * arg STARPU_ATTRIBUTE_UNUSED)
  114. \ingroup API_Modularized_Scheduler
  115. return a node that perform a work stealing scheduling. Tasks are pushed in a round robin way. estimated_end return the average of expected length of fifos, starting at the average of the expected_end of his childs. When a worker have to steal a task, it steal a task in a round robin way, and get the last pushed task of the higher priority.
  116. \fn int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
  117. \ingroup API_Modularized_Scheduler
  118. undefined if there is no work stealing node in the scheduler. If any, \p task is pushed in a default way if the caller is the application, and in the caller's fifo if its a worker.
  119. \fn int starpu_sched_node_is_work_stealing(struct starpu_sched_node * node)
  120. \ingroup API_Modularized_Scheduler
  121. return true iff \p node is a work stealing node
  122. \fn struct starpu_sched_node * starpu_sched_node_random_create(void * arg STARPU_ATTRIBUTE_UNUSED)
  123. \ingroup API_Modularized_Scheduler
  124. create a node that perform a random scheduling.
  125. \fn int starpu_sched_node_is_random(struct starpu_sched_node *);
  126. \ingroup API_Modularized_Scheduler
  127. return true iff \p node is a random node
  128. \fn struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data * heft_data)
  129. \ingroup API_Modularized_Scheduler
  130. this node perform a heft scheduling using data provided by estimated_execute_preds, if no pred_model are available a random node is used to push tasks.
  131. \fn int starpu_sched_node_is_heft(struct starpu_sched_node * node)
  132. \ingroup API_Modularized_Scheduler
  133. return true iff \p node is a heft node
  134. \struct starpu_heft_data
  135. \ingroup API_Modularized_Scheduler
  136. starpu_sched_node_heft_create parameters
  137. \var starpu_heft_data::alpha
  138. coefficient applied to computation length
  139. \var starpu_heft_data::beta
  140. coefficient applied to communication length
  141. \var starpu_heft_data::gamma
  142. coefficient applied to power consumption
  143. \var starpu_heft_data::idle_power
  144. idle consumption of the machine
  145. \var starpu_heft_data::no_perf_model_node_create
  146. called to create the node to push task for whom no perf model is available
  147. \var starpu_heft_data::arg_no_perf_model
  148. argument passed to starpu_heft_data::no_perf_model_node_create
  149. \var starpu_heft_data::calibrating_node_create
  150. idem for tasks with an non calibrated implementation
  151. \var starpu_heft_data::arg_calibrating_node
  152. argument passed to starpu_heft_data::calibrating_node_create
  153. \fn struct starpu_sched_node * starpu_sched_node_best_implementation_create(void * arg STARPU_ATTRIBUTE_UNUSED);
  154. \ingroup API_Modularized_Scheduler
  155. Select the implementation that offer the shortest computation length for the first worker that can execute the task.
  156. Or an implementation that need to be calibrated.
  157. Also set starpu_task::predicted and starpu_task::predicted_transfer for memory node of the first suitable workerid.
  158. If starpu_sched_node::push method is called and starpu_sched_node::nchild > 1 the result is undefined.
  159. \fn struct starpu_sched_tree * starpu_sched_tree_create(void)
  160. \ingroup API_Modularized_Scheduler
  161. create a empty initialized starpu_sched_tree
  162. \fn void starpu_sched_tree_destroy(struct starpu_sched_tree * tree, unsigned sched_ctx_id)
  163. \ingroup API_Modularized_Scheduler
  164. destroy tree and free all non shared node in it.
  165. \fn void starpu_sched_node_destroy_rec (struct starpu_sched_node *node, unsigned sched_ctx_id)
  166. \ingroup API_Modularized_Scheduler
  167. recursively destroy non shared parts of a \p node 's tree
  168. \fn int starpu_sched_tree_push_task(struct starpu_task * task)
  169. \ingroup API_Modularized_Scheduler
  170. compatibility with starpu_sched_policy interface
  171. \fn struct starpu_task * starpu_sched_tree_pop_task(unsigned sched_ctx_id)
  172. \ingroup API_Modularized_Scheduler
  173. compatibility with starpu_sched_policy interface
  174. \fn void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
  175. \ingroup API_Modularized_Scheduler
  176. compatibility with starpu_sched_policy interface
  177. \fn void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
  178. \ingroup API_Modularized_Scheduler
  179. compatibility with starpu_sched_policy interface
  180. \fn void starpu_sched_node_worker_pre_exec_hook(struct starpu_task * task)
  181. \ingroup API_Modularized_Scheduler
  182. compatibility with starpu_sched_policy interface
  183. update predictions for workers
  184. \fn void starpu_sched_node_worker_post_exec_hook(struct starpu_task * task)
  185. \ingroup API_Modularized_Scheduler
  186. compatibility with starpu_sched_policy interface
  187. \fn void starpu_sched_tree_update_workers(struct starpu_sched_tree * t)
  188. \ingroup API_Modularized_Scheduler
  189. recursively set all starpu_sched_node::workers, do not take into account shared parts (except workers).
  190. \fn void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree * t)
  191. \ingroup API_Modularized_Scheduler
  192. recursively set all starpu_sched_node::workers_in_ctx, do not take into account shared parts (except workers)
  193. \struct starpu_bitmap;
  194. \ingroup API_Modularized_Scheduler
  195. implement a simple bitmap
  196. \fn struct starpu_bitmap * starpu_bitmap_create(void)
  197. \ingroup API_Modularized_Scheduler
  198. create a empty starpu_bitmap
  199. \fn void starpu_bitmap_destroy(struct starpu_bitmap *)
  200. \ingroup API_Modularized_Scheduler
  201. free a starpu_bitmap
  202. \fn void starpu_bitmap_set(struct starpu_bitmap * bitmap, int e)
  203. \ingroup API_Modularized_Scheduler
  204. set bit \p e in \p bitmap
  205. \fn void starpu_bitmap_unset(struct starpu_bitmap * bitmap, int e)
  206. \ingroup API_Modularized_Scheduler
  207. unset bit \p e in \p bitmap
  208. \fn void starpu_bitmap_unset_all(struct starpu_bitmap * bitmap)
  209. \ingroup API_Modularized_Scheduler
  210. unset all bits in \b bitmap
  211. \fn int starpu_bitmap_get(struct starpu_bitmap * bitmap, int e);
  212. \ingroup API_Modularized_Scheduler
  213. return true iff bit \p e is set in \p bitmap
  214. \fn int starpu_bitmap_cardinal(struct starpu_bitmap * bitmap);
  215. \ingroup API_Modularized_Scheduler
  216. return the number of set bits in \p bitmap
  217. \fn int starpu_bitmap_first(struct starpu_bitmap * bitmap)
  218. \ingroup API_Modularized_Scheduler
  219. return the position of the first set bit of \p bitmap, -1 if none
  220. \fn int starpu_bitmap_last(struct starpu_bitmap * bitmap)
  221. \ingroup API_Modularized_Scheduler
  222. return the position of the last set bit of \p bitmap, -1 if none
  223. \fn int starpu_bitmap_next(struct starpu_bitmap *, int e)
  224. \ingroup API_Modularized_Scheduler
  225. return the position of set bit right after \p e in \p bitmap, -1 if none
  226. */