modularized_scheduler.doxy 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013,2014 Inria
  4. * Copyright (C) 2013-2018 CNRS
  5. * Copyright (C) 2009-2011,2014,2015,2017,2018-2019 Université de Bordeaux
  6. * Copyright (C) 2013 Simon Archipoff
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. /*! \defgroup API_Modularized_Scheduler Modularized Scheduler Interface
  20. \enum starpu_sched_component_properties
  21. \ingroup API_Modularized_Scheduler
  22. flags for starpu_sched_component::properties
  23. \var starpu_sched_component_properties::STARPU_SCHED_COMPONENT_HOMOGENEOUS
  24. indicate that all workers have the same starpu_worker_archtype
  25. \var starpu_sched_component_properties::STARPU_SCHED_COMPONENT_SINGLE_MEMORY_NODE
  26. indicate that all workers have the same memory component
  27. \def STARPU_SCHED_COMPONENT_IS_HOMOGENEOUS
  28. \ingroup API_Modularized_Scheduler
  29. indicate if component is homogeneous
  30. \def STARPU_SCHED_COMPONENT_IS_SINGLE_MEMORY_NODE
  31. \ingroup API_Modularized_Scheduler
  32. indicate if all workers have the same memory component
  33. \struct starpu_sched_component
  34. \ingroup API_Modularized_Scheduler
  35. This structure represent a scheduler module. A scheduler is a
  36. tree-like structure of them, some parts of scheduler can be shared by
  37. several contexes to perform some local optimisations, so, for all
  38. components, a list of parent is defined by \c sched_ctx_id. They
  39. embed there specialised method in a pseudo object-style, so calls are
  40. like <c>component->push_task(component,task)</c>
  41. \var struct starpu_sched_tree *starpu_sched_component::tree
  42. The tree containing the component
  43. \var struct starpu_bitmap *starpu_sched_component::workers
  44. this member contain the set of underlying workers
  45. \var starpu_sched_component::workers_in_ctx
  46. this member contain the subset of starpu_sched_component::workers that is currently available in the context
  47. The push method should take this member into account.
  48. this member is set with :
  49. component->workers UNION tree->workers UNION
  50. component->child[i]->workers_in_ctx iff exist x such as component->children[i]->parents[x] == component
  51. \var void *starpu_sched_component::data
  52. private data
  53. \var int starpu_sched_component::nchildren
  54. the number of compoments's children
  55. \var struct starpu_sched_component **starpu_sched_component::children
  56. the vector of component's children
  57. \var int starpu_sched_component::nparents
  58. the numbers of component's parents
  59. \var struct starpu_sched_component **starpu_sched_component::parents
  60. the vector of component's parents
  61. \var void(*starpu_sched_component::add_child)(struct starpu_sched_component *component, struct starpu_sched_component *child)
  62. add a child to component
  63. \var void(*starpu_sched_component::remove_child)(struct starpu_sched_component *component, struct starpu_sched_component *child)
  64. remove a child from component
  65. \var void(*starpu_sched_component::add_parent)(struct starpu_sched_component *component, struct starpu_sched_component *parent)
  66. todo
  67. \var void(*starpu_sched_component::remove_parent)(struct starpu_sched_component *component, struct starpu_sched_component *parent)
  68. todo
  69. \var int (*starpu_sched_component::push_task)(struct starpu_sched_component *, struct starpu_task *)
  70. push a task in the scheduler module. this function is called to
  71. push a task on component subtree, this can either perform a
  72. recursive call on a child or store the task in the component,
  73. then it will be returned by a further pull_task call.
  74. the caller must ensure that component is able to execute task.
  75. This method must either return 0 if it the task was properly stored or
  76. passed over to a child component, or return a value different from 0 if the
  77. task could not be consumed (e.g. the queue is full).
  78. \var struct starpu_task * (*starpu_sched_component::pull_task)(struct starpu_sched_component *component, struct starpu_sched_component *to)
  79. pop a task from the scheduler module. this function is called by workers to get a task from their
  80. parents. this function should first return a locally stored task
  81. or perform a recursive call on the parents.
  82. the task returned by this function should be executable by the caller
  83. \var int (*starpu_sched_component::can_push)(struct starpu_sched_component *component, struct starpu_sched_component *to)
  84. This function is called by a component which implements a queue,
  85. allowing it to signify to its parents that an empty slot is
  86. available in its queue. This should return 1 if some tasks could be pushed
  87. The basic implementation of this function
  88. is a recursive call to its parents, the user has to specify a
  89. personally-made function to catch those calls.
  90. \var int (*starpu_sched_component::can_pull)(struct starpu_sched_component *component)
  91. This function allow a component to wake up a worker. It is
  92. currently called by component which implements a queue, to
  93. signify to its children that a task have been pushed in its local
  94. queue, and is available to be popped by a worker, for example.
  95. This should return 1 if some some container or worker could (or will) pull
  96. some tasks.
  97. The basic implementation of this function is a recursive call to
  98. its children, until at least one worker have been woken up.
  99. \var double (*starpu_sched_component::estimated_load)(struct starpu_sched_component *component)
  100. is an heuristic to compute load of scheduler module. Basically the number of tasks divided by the sum
  101. of relatives speedup of workers available in context.
  102. estimated_load(component) = sum(estimated_load(component_children)) + nb_local_tasks / average(relative_speedup(underlying_worker))
  103. \var starpu_sched_component::estimated_end
  104. return the time when a worker will enter in starvation. This function is relevant only if the task->predicted
  105. member has been set.
  106. \var void (*starpu_sched_component::deinit_data)(struct starpu_sched_component *component)
  107. called by starpu_sched_component_destroy. Should free data allocated during creation
  108. \var void (*starpu_sched_component::notify_change_workers)(struct starpu_sched_component *component)
  109. this function is called for each component when workers are added or removed from a context
  110. \var int starpu_sched_component::properties
  111. todo
  112. \var hwloc_obj_t starpu_sched_component::obj
  113. the hwloc object associated to scheduler module. points to the
  114. part of topology that is binded to this component, eg: a numa
  115. node for a ws component that would balance load between
  116. underlying sockets
  117. \struct starpu_sched_tree
  118. \ingroup API_Modularized_Scheduler
  119. The actual scheduler
  120. \var struct starpu_sched_component *starpu_sched_tree::root
  121. this is the entry module of the scheduler
  122. \var struct starpu_bitmap *starpu_sched_tree::workers
  123. this is the set of workers available in this context, this value is used to mask workers in modules
  124. \var unsigned starpu_sched_tree::sched_ctx_id
  125. the context id of the scheduler
  126. \var starpu_pthread_mutex_t starpu_sched_tree::lock
  127. this lock is used to protect the scheduler, it is taken in
  128. read mode pushing a task and in write mode for adding or
  129. removing workers
  130. @name Scheduling Tree API
  131. \ingroup API_Modularized_Scheduler
  132. \fn struct starpu_sched_tree *starpu_sched_tree_create(unsigned sched_ctx_id)
  133. \ingroup API_Modularized_Scheduler
  134. create a empty initialized starpu_sched_tree
  135. \fn void starpu_sched_tree_destroy(struct starpu_sched_tree *tree)
  136. \ingroup API_Modularized_Scheduler
  137. destroy tree and free all non shared component in it.
  138. \fn void starpu_sched_tree_update_workers(struct starpu_sched_tree *t)
  139. \ingroup API_Modularized_Scheduler
  140. recursively set all starpu_sched_component::workers, do not take into account shared parts (except workers).
  141. \fn void starpu_sched_tree_update_workers_in_ctx(struct starpu_sched_tree *t)
  142. \ingroup API_Modularized_Scheduler
  143. recursively set all starpu_sched_component::workers_in_ctx, do not take into account shared parts (except workers)
  144. \fn int starpu_sched_tree_push_task(struct starpu_task *task)
  145. \ingroup API_Modularized_Scheduler
  146. compatibility with starpu_sched_policy interface
  147. \fn struct starpu_task *starpu_sched_tree_pop_task(unsigned sched_ctx)
  148. \ingroup API_Modularized_Scheduler
  149. compatibility with starpu_sched_policy interface
  150. \fn void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
  151. \ingroup API_Modularized_Scheduler
  152. compatibility with starpu_sched_policy interface
  153. \fn void starpu_sched_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
  154. \ingroup API_Modularized_Scheduler
  155. compatibility with starpu_sched_policy interface
  156. \fn void starpu_sched_component_connect(struct starpu_sched_component *parent, struct starpu_sched_component *child)
  157. \ingroup API_Modularized_Scheduler
  158. Attaches component \p child to parent \p parent. Some component may accept only one child, others accept several (e.g. MCT)
  159. @name Generic Scheduling Component API
  160. \ingroup API_Modularized_Scheduler
  161. \fn struct starpu_sched_component *starpu_sched_component_create(struct starpu_sched_tree *tree, const char *name)
  162. \ingroup API_Modularized_Scheduler
  163. allocate and initialize component field with defaults values :
  164. .pop_task make recursive call on father
  165. .estimated_load compute relative speedup and tasks in sub tree
  166. .estimated_end return the minimum of recursive call on children
  167. .add_child is starpu_sched_component_add_child
  168. .remove_child is starpu_sched_component_remove_child
  169. .notify_change_workers does nothing
  170. .deinit_data does nothing
  171. \fn void starpu_sched_component_destroy(struct starpu_sched_component *component)
  172. \ingroup API_Modularized_Scheduler
  173. free data allocated by starpu_sched_component_create and call component->deinit_data(component)
  174. set to <c>NULL</c> the member starpu_sched_component::fathers[sched_ctx_id] of all child if its equal to \p component
  175. \fn void starpu_sched_component_destroy_rec(struct starpu_sched_component *component)
  176. \ingroup API_Modularized_Scheduler
  177. recursively destroy non shared parts of a \p component 's tree
  178. \fn int starpu_sched_component_can_execute_task(struct starpu_sched_component *component, struct starpu_task *task)
  179. \ingroup API_Modularized_Scheduler
  180. return true iff \p component can execute \p task, this function take into account the workers available in the scheduling context
  181. \fn int starpu_sched_component_execute_preds(struct starpu_sched_component *component, struct starpu_task *task, double *length)
  182. \ingroup API_Modularized_Scheduler
  183. return a non <c>NULL</c> value if \p component can execute \p task.
  184. write the execution prediction length for the best implementation of the best worker available and write this at \p length address.
  185. this result is more relevant if starpu_sched_component::is_homogeneous is non <c>NULL</c>.
  186. if a worker need to be calibrated for an implementation, nan is set to \p length.
  187. \fn double starpu_sched_component_transfer_length(struct starpu_sched_component *component, struct starpu_task *task)
  188. \ingroup API_Modularized_Scheduler
  189. return the average time to transfer \p task data to underlying \p component workers.
  190. @name Worker Component API
  191. \ingroup API_Modularized_Scheduler
  192. \fn struct starpu_sched_component *starpu_sched_component_worker_get(unsigned sched_ctx, int workerid)
  193. \ingroup API_Modularized_Scheduler
  194. return the struct starpu_sched_component corresponding to \p workerid. Undefined if \p workerid is not a valid workerid
  195. \fn struct starpu_sched_component *starpu_sched_component_parallel_worker_create(struct starpu_sched_tree *tree, unsigned nworkers, unsigned *workers)
  196. \ingroup API_Modularized_Scheduler
  197. Create a combined worker that pushes tasks in parallel to workers \p workers (size \p nworkers).
  198. \fn int starpu_sched_component_worker_get_workerid(struct starpu_sched_component *worker_component)
  199. \ingroup API_Modularized_Scheduler
  200. return the workerid of \p worker_component, undefined if starpu_sched_component_is_worker(worker_component) == 0
  201. \fn int starpu_sched_component_is_worker(struct starpu_sched_component *component)
  202. \ingroup API_Modularized_Scheduler
  203. return true iff \p component is a worker component
  204. \fn int starpu_sched_component_is_simple_worker(struct starpu_sched_component *component)
  205. \ingroup API_Modularized_Scheduler
  206. return true iff \p component is a simple worker component
  207. \fn int starpu_sched_component_is_combined_worker(struct starpu_sched_component *component)
  208. \ingroup API_Modularized_Scheduler
  209. return true iff \p component is a combined worker component
  210. \fn void starpu_sched_component_worker_pre_exec_hook(struct starpu_task *task, unsigned sched_ctx_id)
  211. \ingroup API_Modularized_Scheduler
  212. compatibility with starpu_sched_policy interface
  213. update predictions for workers
  214. \fn void starpu_sched_component_worker_post_exec_hook(struct starpu_task *task, unsigned sched_ctx_id)
  215. \ingroup API_Modularized_Scheduler
  216. compatibility with starpu_sched_policy interface
  217. @name Flow-control Fifo Component API
  218. \ingroup API_Modularized_Scheduler
  219. \fn int starpu_sched_component_can_push(struct starpu_sched_component * component, struct starpu_sched_component * to)
  220. \ingroup API_Modularized_Scheduler
  221. default function for the can_push component method, just calls can_push of parents until one of them returns non-zero
  222. \fn int starpu_sched_component_can_pull(struct starpu_sched_component * component)
  223. \ingroup API_Modularized_Scheduler
  224. default function for the can_pull component method, just calls can_pull of children until one of them returns non-zero
  225. \fn int starpu_sched_component_can_pull_all(struct starpu_sched_component * component)
  226. \ingroup API_Modularized_Scheduler
  227. function for the can_pull component method, calls can_pull of all children
  228. \fn double starpu_sched_component_estimated_load(struct starpu_sched_component * component);
  229. \ingroup API_Modularized_Scheduler
  230. default function for the estimated_load component method, just sums up the loads
  231. of the children of the component.
  232. \fn double starpu_sched_component_estimated_end_min(struct starpu_sched_component * component);
  233. \ingroup API_Modularized_Scheduler
  234. function that can be used for the estimated_end component method, which just computes the minimum completion time of the children.
  235. \fn double starpu_sched_component_estimated_end_min_add(struct starpu_sched_component * component, double exp_len);
  236. \ingroup API_Modularized_Scheduler
  237. function that can be used for the estimated_end component method, which computes
  238. the minimum completion time of the children, and adds to it an estimation of how
  239. existing queued work, plus the exp_len work, can be completed. This is typically
  240. used instead of starpu_sched_component_estimated_end_min when the component
  241. contains a queue of tasks, which thus needs to be added to the estimations.
  242. \fn double starpu_sched_component_estimated_end_average(struct starpu_sched_component * component);
  243. \ingroup API_Modularized_Scheduler
  244. default function for the estimated_end component method, which just computes the average completion time of the children.
  245. \struct starpu_sched_component_fifo_data
  246. \ingroup API_Modularized_Scheduler
  247. \var unsigned starpu_sched_component_fifo_data::ntasks_threshold
  248. todo
  249. \var double starpu_sched_component_fifo_data::exp_len_threshold
  250. todo
  251. \fn struct starpu_sched_component *starpu_sched_component_fifo_create(struct starpu_sched_tree *tree, struct starpu_sched_component_fifo_data *fifo_data)
  252. \ingroup API_Modularized_Scheduler
  253. Return a struct starpu_sched_component with a fifo. A stable sort is performed according to tasks priorities.
  254. A push_task call on this component does not perform recursive calls, underlying components will have to call pop_task to get it.
  255. starpu_sched_component::estimated_end function compute the estimated length by dividing the sequential length by the number of underlying workers.
  256. \fn int starpu_sched_component_is_fifo(struct starpu_sched_component *component)
  257. \ingroup API_Modularized_Scheduler
  258. return true iff \p component is a fifo component
  259. @name Flow-control Prio Component API
  260. \ingroup API_Modularized_Scheduler
  261. \struct starpu_sched_component_prio_data
  262. \ingroup API_Modularized_Scheduler
  263. \var unsigned starpu_sched_component_prio_data::ntasks_threshold
  264. todo
  265. \var double starpu_sched_component_prio_data::exp_len_threshold
  266. todo
  267. \fn struct starpu_sched_component *starpu_sched_component_prio_create(struct starpu_sched_tree *tree, struct starpu_sched_component_prio_data *prio_data)
  268. \ingroup API_Modularized_Scheduler
  269. todo
  270. \fn int starpu_sched_component_is_prio(struct starpu_sched_component *component)
  271. \ingroup API_Modularized_Scheduler
  272. todo
  273. @name Resource-mapping Work-Stealing Component API
  274. \ingroup API_Modularized_Scheduler
  275. \fn struct starpu_sched_component *starpu_sched_component_work_stealing_create(struct starpu_sched_tree *tree, void *arg)
  276. \ingroup API_Modularized_Scheduler
  277. return a component 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 children. 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.
  278. \fn int starpu_sched_tree_work_stealing_push_task(struct starpu_task *task)
  279. \ingroup API_Modularized_Scheduler
  280. undefined if there is no work stealing component 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.
  281. \fn int starpu_sched_component_is_work_stealing(struct starpu_sched_component *component)
  282. \ingroup API_Modularized_Scheduler
  283. return true iff \p component is a work stealing component
  284. @name Resource-mapping Random Component API
  285. \ingroup API_Modularized_Scheduler
  286. \fn struct starpu_sched_component *starpu_sched_component_random_create(struct starpu_sched_tree *tree, void *arg)
  287. \ingroup API_Modularized_Scheduler
  288. create a component that perform a random scheduling
  289. \fn int starpu_sched_component_is_random(struct starpu_sched_component *)
  290. \ingroup API_Modularized_Scheduler
  291. return true iff \p component is a random component
  292. @name Resource-mapping Eager Component API
  293. \ingroup API_Modularized_Scheduler
  294. \fn struct starpu_sched_component *starpu_sched_component_eager_create(struct starpu_sched_tree *tree, void *arg)
  295. \ingroup API_Modularized_Scheduler
  296. todo
  297. \fn int starpu_sched_component_is_eager(struct starpu_sched_component *)
  298. \ingroup API_Modularized_Scheduler
  299. todo
  300. @name Resource-mapping Eager-Calibration Component API
  301. \ingroup API_Modularized_Scheduler
  302. \fn struct starpu_sched_component *starpu_sched_component_eager_calibration_create(struct starpu_sched_tree *tree, void *arg)
  303. \ingroup API_Modularized_Scheduler
  304. todo
  305. \fn int starpu_sched_component_is_eager_calibration(struct starpu_sched_component *)
  306. \ingroup API_Modularized_Scheduler
  307. todo
  308. @name Resource-mapping MCT Component API
  309. \ingroup API_Modularized_Scheduler
  310. \struct starpu_sched_component_mct_data
  311. \ingroup API_Modularized_Scheduler
  312. \var double starpu_sched_component_mct_data::alpha
  313. todo
  314. \var double starpu_sched_component_mct_data::beta
  315. todo
  316. \var double starpu_sched_component_mct_data::_gamma
  317. todo
  318. \var double starpu_sched_component_mct_data::idle_power
  319. todo
  320. \fn struct starpu_sched_component *starpu_sched_component_mct_create(struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data)
  321. \ingroup API_Modularized_Scheduler
  322. create a component with mct_data paremeters. the mct component doesnt
  323. do anything but pushing tasks on no_perf_model_component and
  324. calibrating_component
  325. \fn int starpu_sched_component_is_mct(struct starpu_sched_component *component);
  326. \ingroup API_Modularized_Scheduler
  327. todo
  328. @name Resource-mapping Heft Component API
  329. \ingroup API_Modularized_Scheduler
  330. \fn struct starpu_sched_component *starpu_sched_component_heft_create(struct starpu_sched_tree *tree, struct starpu_sched_component_mct_data *mct_data)
  331. \ingroup API_Modularized_Scheduler
  332. this component perform a heft scheduling
  333. \fn int starpu_sched_component_is_heft(struct starpu_sched_component *component)
  334. \ingroup API_Modularized_Scheduler
  335. return true iff \p component is a heft component
  336. @name Special-purpose Best_Implementation Component API
  337. \ingroup API_Modularized_Scheduler
  338. \fn struct starpu_sched_component *starpu_sched_component_best_implementation_create(struct starpu_sched_tree *tree, void *arg)
  339. \ingroup API_Modularized_Scheduler
  340. Select the implementation that offer the shortest computation length for the first worker that can execute the task.
  341. Or an implementation that need to be calibrated.
  342. Also set starpu_task::predicted and starpu_task::predicted_transfer for memory component of the first suitable workerid.
  343. If starpu_sched_component::push method is called and starpu_sched_component::nchild > 1 the result is undefined.
  344. @name Special-purpose Perfmodel_Select Component API
  345. \ingroup API_Modularized_Scheduler
  346. \struct starpu_sched_component_perfmodel_select_data
  347. \ingroup API_Modularized_Scheduler
  348. \var struct starpu_sched_component *starpu_sched_component_perfmodel_select_data::calibrator_component
  349. todo
  350. \var struct starpu_sched_component *starpu_sched_component_perfmodel_select_data::no_perfmodel_component
  351. todo
  352. \var struct starpu_sched_component *starpu_sched_component_perfmodel_select_data::perfmodel_component
  353. todo
  354. \fn struct starpu_sched_component *starpu_sched_component_perfmodel_select_create(struct starpu_sched_tree *tree, struct starpu_sched_component_perfmodel_select_data *perfmodel_select_data)
  355. \ingroup API_Modularized_Scheduler
  356. todo
  357. \fn int starpu_sched_component_is_perfmodel_select(struct starpu_sched_component *component)
  358. \ingroup API_Modularized_Scheduler
  359. todo
  360. @name Recipe Component API
  361. \ingroup API_Modularized_Scheduler
  362. \struct starpu_sched_component_composed_recipe
  363. \ingroup API_Modularized_Scheduler
  364. parameters for starpu_sched_component_composed_component_create
  365. \fn struct starpu_sched_component_composed_recipe *starpu_sched_component_composed_recipe_create(void)
  366. \ingroup API_Modularized_Scheduler
  367. return an empty recipe for a composed component, it should not be used without modification
  368. \fn struct starpu_sched_component_composed_recipe *starpu_sched_component_composed_recipe_create_singleton(struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg)
  369. \ingroup API_Modularized_Scheduler
  370. return a recipe to build a composed component with a \p create_component
  371. \fn void starpu_sched_component_composed_recipe_add(struct starpu_sched_component_composed_recipe *recipe, struct starpu_sched_component *(*create_component)(struct starpu_sched_tree *tree, void *arg), void *arg)
  372. \ingroup API_Modularized_Scheduler
  373. add \p create_component under all previous components in recipe
  374. \fn void starpu_sched_component_composed_recipe_destroy(struct starpu_sched_component_composed_recipe *)
  375. \ingroup API_Modularized_Scheduler
  376. destroy composed_sched_component, this should be done after starpu_sched_component_composed_component_create was called
  377. \fn struct starpu_sched_component *starpu_sched_component_composed_component_create(struct starpu_sched_tree *tree, struct starpu_sched_component_composed_recipe *recipe)
  378. \ingroup API_Modularized_Scheduler
  379. create a component that behave as all component of recipe where linked. Except that you cant use starpu_sched_component_is_foo function
  380. if recipe contain a single create_foo arg_foo pair, create_foo(arg_foo) is returned instead of a composed component
  381. \struct starpu_sched_component_specs
  382. \ingroup API_Modularized_Scheduler
  383. Define how build a scheduler according to topology. Each level (except for hwloc_machine_composed_sched_component) can be <c>NULL</c>, then
  384. the level is just skipped. Bugs everywhere, do not rely on.
  385. \var struct starpu_sched_component_composed_recipe *starpu_sched_specs::hwloc_machine_composed_sched_component
  386. the composed component to put on the top of the scheduler
  387. this member must not be <c>NULL</c> as it is the root of the topology
  388. \var struct starpu_sched_component_composed_recipe *starpu_sched_specs::hwloc_component_composed_sched_component
  389. the composed component to put for each memory component
  390. \var struct starpu_sched_component_composed_recipe *starpu_sched_specs::hwloc_socket_composed_sched_component
  391. the composed component to put for each socket
  392. \var struct starpu_sched_component_composed_recipe *starpu_sched_specs::hwloc_cache_composed_sched_component
  393. the composed component to put for each cache
  394. \var struct starpu_sched_component_composed_recipe *(*starpu_sched_specs::worker_composed_sched_component)(enum starpu_worker_archtype archtype)
  395. a function that return a starpu_sched_component_composed_recipe to put on top of a worker of type \p archtype.
  396. <c>NULL</c> is a valid return value, then no component will be added on top
  397. \var starpu_sched_specs::mix_heterogeneous_workers
  398. this flag is a dirty hack because of the poor expressivity of this interface. As example, if you want to build
  399. a heft component with a fifo component per numa component, and you also have GPUs, if this flag is set, GPUs will share those fifos.
  400. If this flag is not set, a new fifo will be built for each of them (if they have the same starpu_perf_arch and the same
  401. numa component it will be shared. it indicates if heterogenous workers should be brothers or cousins, as example, if a gpu and a cpu should share or not there numa node
  402. \fn struct starpu_sched_tree *starpu_sched_component_make_scheduler(unsigned sched_ctx_id, struct starpu_sched_component_specs s)
  403. \ingroup API_Modularized_Scheduler
  404. this function build a scheduler for \p sched_ctx_id according to \p s and the hwloc topology of the machine.
  405. \def STARPU_SCHED_SIMPLE_DECIDE_WORKERS
  406. \ingroup API_Modularized_Scheduler
  407. Request to create downstream queues per worker, i.e. the scheduling decision-making component will choose exactly which workers tasks should got to.
  408. \def STARPU_SCHED_SIMPLE_COMBINED_WORKERS
  409. \ingroup API_Modularized_Scheduler
  410. Request to not only choose between simple workers, but also choose between combined workers.
  411. \def STARPU_SCHED_SIMPLE_DECIDE_MEMNODES
  412. \ingroup API_Modularized_Scheduler
  413. Request to create downstream queues per memory nodes, i.e. the scheduling decision-making component will choose which memory node tasks will go to.
  414. \def STARPU_SCHED_SIMPLE_DECIDE_ARCHS
  415. \ingroup API_Modularized_Scheduler
  416. Request to create downstream queues per computation arch, i.e. the scheduling decision-making component will choose whether tasks go to CPUs, or CUDA, or OpenCL, etc.
  417. \def STARPU_SCHED_SIMPLE_PERFMODEL
  418. \ingroup API_Modularized_Scheduler
  419. Request to add a perfmodel selector above the scheduling decision-making component. That way, only tasks with a calibrated performance model will be given to the component, other tasks will go to an eager branch that will distributed tasks so that their performance models will get calibrated.
  420. In other words, this is needed when using a component which needs performance models for tasks.
  421. \def STARPU_SCHED_SIMPLE_FIFO_ABOVE
  422. \ingroup API_Modularized_Scheduler
  423. Request to create a fifo above the scheduling decision-making component, otherwise tasks will be pushed directly to the component.
  424. This is useful to store tasks if there is a fifo below which limits the number of tasks to be scheduld in advance. The scheduling decision-making component can also store tasks itself, in which case this flag is not useful.
  425. \def STARPU_SCHED_SIMPLE_FIFO_ABOVE_PRIO
  426. \ingroup API_Modularized_Scheduler
  427. Request that the fifo above be sorted by priorities
  428. \def STARPU_SCHED_SIMPLE_FIFOS_BELOW
  429. \ingroup API_Modularized_Scheduler
  430. Request to create fifos below the scheduling decision-making component, otherwise tasks will be pulled directly from workers.
  431. This is useful to be able to schedule a (tunable) small number of tasks in advance only.
  432. \def STARPU_SCHED_SIMPLE_FIFOS_BELOW_PRIO
  433. \ingroup API_Modularized_Scheduler
  434. Request that the fifos below be sorted by priorities
  435. \def STARPU_SCHED_SIMPLE_WS_BELOW
  436. \ingroup API_Modularized_Scheduler
  437. Request that work between workers using the same fifo below be distributed using a work stealing component.
  438. \def STARPU_SCHED_SIMPLE_IMPL
  439. \ingroup API_Modularized_Scheduler
  440. Request that a component be added just above workers, that chooses the best task implementation.
  441. \fn void starpu_sched_component_initialize_simple_scheduler(starpu_sched_component_create_t create_decision_component, void *data, unsigned flags, unsigned sched_ctx_id)
  442. \ingroup API_Modularized_Scheduler
  443. This creates a simple modular scheduler tree around a scheduling decision-making
  444. component \p component. The details of what should be built around \p component
  445. is described by \p flags. The different STARPU_SCHED_SIMPL_DECIDE_* flags are
  446. mutually exclusive. \p data is passed to the \p create_decision_component
  447. function when creating the decision component.
  448. \fn int starpu_sched_component_push_task(struct starpu_sched_component *from, struct starpu_sched_component *to, struct starpu_task *task)
  449. \ingroup API_Modularized_Scheduler
  450. Push a task to a component. This is a helper for <c>component->push_task(component, task)</c> plus tracing.
  451. \fn struct starpu_task *starpu_sched_component_pull_task(struct starpu_sched_component *from, struct starpu_sched_component *to)
  452. \ingroup API_Modularized_Scheduler
  453. Pull a task from a component. This is a helper for <c>component->pull_task(component)</c> plus tracing.
  454. */