sc_hypervisor.doxy 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011-2013 Inria
  4. * Copyright (C) 2010-2013,2015-2017 CNRS
  5. * Copyright (C) 2009-2011,2014 Université de Bordeaux
  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_SC_Hypervisor Scheduling Context Hypervisor - Building a new resizing policy
  19. \struct sc_hypervisor_policy
  20. \ingroup API_SC_Hypervisor
  21. This structure contains all the methods that implement a hypervisor resizing policy.
  22. \var sc_hypervisor_policy::name
  23. Indicates the name of the policy, if there is not a custom policy, the policy corresponding to this name will be used by the hypervisor
  24. \var sc_hypervisor_policy::custom
  25. Indicates whether the policy is custom or not
  26. \var sc_hypervisor_policy::size_ctxs
  27. Distribute workers to contexts even at the beginning of the program
  28. \var sc_hypervisor_policy::resize_ctxs
  29. Require explicit resizing
  30. \var sc_hypervisor_policy::handle_idle_cycle
  31. It is called whenever the indicated worker executes another idle cycle in sched_ctx
  32. \var sc_hypervisor_policy::handle_pushed_task
  33. It is called whenever a task is pushed on the worker’s queue corresponding to the context sched_ctx
  34. \var sc_hypervisor_policy::handle_poped_task
  35. It is called whenever a task is poped from the worker’s queue corresponding to the context sched_ctx
  36. \var sc_hypervisor_policy::handle_poped_task
  37. The hypervisor takes a decision when another task was poped from this worker in this ctx
  38. \var sc_hypervisor_policy::handle_idle_end
  39. It is called whenever a task is executed on the indicated worker and context after a long period of idle time
  40. \var sc_hypervisor_policy::handle_post_exec_hook
  41. It is called whenever a tag task has just been executed. The table of resize requests is provided as well as the tag
  42. \var sc_hypervisor_policy::handle_submitted_job
  43. The hypervisor takes a decision when a job was submitted in this ctx
  44. \var sc_hypervisor_policy::end_ctx
  45. The hypervisor takes a decision when a certain ctx was deleted
  46. \struct sc_hypervisor_policy_config
  47. \ingroup API_SC_Hypervisor
  48. This structure contains all configuration information of a
  49. context. It contains configuration information for each context, which
  50. can be used to construct new resize strategies.
  51. \var sc_hypervisor_policy_config::min_nworkers
  52. Indicates the minimum number of workers needed by the context
  53. \var sc_hypervisor_policy_config::max_nworkers
  54. Indicates the maximum number of workers needed by the context
  55. \var sc_hypervisor_policy_config::granularity
  56. Indicates the workers granularity of the context
  57. \var sc_hypervisor_policy_config::priority
  58. Indicates the priority of each worker in the context
  59. \var sc_hypervisor_policy_config::max_idle
  60. Indicates the maximum idle time accepted before a resize is triggered
  61. \var sc_hypervisor_policy_config::min_working
  62. Indicates that underneath this limit the priority of the worker is reduced
  63. \var sc_hypervisor_policy_config::fixed_workers
  64. Indicates which workers can be moved and which ones are fixed
  65. \var sc_hypervisor_policy_config:: new_workers_max_idle
  66. Indicates the maximum idle time accepted before a resize is triggered for the workers that just arrived in the new context
  67. \var sc_hypervisor_policy_config::ispeed_w_sample
  68. Indicates the sample used to compute the instant speed per worker
  69. \var sc_hypervisor_policy_config::ispeed_ctx_sample
  70. Indicates the sample used to compute the instant speed per ctxs
  71. \var sc_hypervisor_policy_config::time_sample
  72. todo
  73. \struct sc_hypervisor_wrapper
  74. \ingroup API_SC_Hypervisor
  75. This structure is a wrapper of the contexts available in StarPU
  76. and contains all information about a context obtained by incrementing
  77. the performance counters.
  78. \var sc_hypervisor_wrapper::sched_ctx
  79. The context wrapped
  80. \var sc_hypervisor_wrapper::config
  81. The corresponding resize configuration
  82. \var sc_hypervisor_wrapper::current_idle_time
  83. The idle time counter of each worker of the context
  84. \var sc_hypervisor_wrapper::idle_time
  85. The time the workers were idle from the last resize
  86. \var sc_hypervisor_wrapper::idle_start_time
  87. The moment when the workers started being idle
  88. \var sc_hypervisor_wrapper::worker_to_be_removed
  89. The list of workers that will leave this contexts (lazy resizing process)
  90. \var sc_hypervisor_wrapper::pushed_tasks
  91. The number of pushed tasks of each worker of the context
  92. \var sc_hypervisor_wrapper::poped_tasks
  93. The number of poped tasks of each worker of the context
  94. \var sc_hypervisor_wrapper::total_flops
  95. The total number of flops to execute by the context
  96. \var sc_hypervisor_wrapper::total_elapsed_flops
  97. The number of flops executed by each workers of the context
  98. \var sc_hypervisor_wrapper::elapsed_flops
  99. The number of flops executed by each worker of the context from last resize
  100. \var sc_hypervisor_wrapper::elapsed_data
  101. The quantity of data (in bytes) used to execute tasks on each worker in this ctx
  102. \var sc_hypervisor_wrapper::elapsed_tasks
  103. The nr of tasks executed on each worker in this ctx
  104. \var sc_hypervisor_wrapper::ref_speed
  105. The average speed of the workers (type of workers) when they belonged to this context
  106. 0 - cuda 1 - cpu
  107. \var sc_hypervisor_wrapper::submitted_flops
  108. The number of flops submitted to this ctx
  109. \var sc_hypervisor_wrapper::remaining_flops
  110. The number of flops that still have to be executed by the workers in the context
  111. \var sc_hypervisor_wrapper::ready_flops
  112. The number of flops corresponding to the ready tasks in this context
  113. \var sc_hypervisor_wrapper::start_time
  114. The time when he started executed
  115. \var sc_hypervisor_wrapper::real_start_time
  116. The first time a task was pushed to this context
  117. \var sc_hypervisor_wrapper::resize_ack
  118. The structure confirming the last resize finished and a new one can be done
  119. \var sc_hypervisor_wrapper::mutex
  120. The mutex needed to synchronize the acknowledgment of the workers into
  121. the receiver context
  122. \var sc_hypervisor_wrapper::total_flops_available
  123. A boolean indicating if the hypervisor can use the flops corresponding to
  124. the entire execution of the context
  125. \var sc_hypervisor_wrapper::nready_tasks
  126. The number of ready tasks in a context
  127. \struct sc_hypervisor_resize_ack
  128. \ingroup API_SC_Hypervisor
  129. This structures checks if the workers moved to another context
  130. are actually taken into account in that context.
  131. \var sc_hypervisor_resize_ack::receiver_sched_ctx
  132. The context receiving the new workers
  133. \var sc_hypervisor_resize_ack::moved_workers
  134. The workers moved to the receiver context
  135. \var sc_hypervisor_resize_ack::nmoved_workers
  136. The number of workers moved
  137. \var sc_hypervisor_resize_ack::acked_workers
  138. If the value corresponding to a worker is 1, this one is taken
  139. into account in the new context if 0 not yet
  140. \struct sc_hypervisor_policy_task_pool
  141. task wrapper linked list
  142. \ingroup API_SC_Hypervisor
  143. \var sc_hypervisor_policy_task_pool::cl
  144. Which codelet has been executed
  145. \var sc_hypervisor_policy_task_pool::footprint
  146. Task footprint key
  147. \var sc_hypervisor_policy_task_pool::sched_ctx_id
  148. Context the task belongs to
  149. \var sc_hypervisor_policy_task_pool::n
  150. Number of tasks of this kind
  151. \var sc_hypervisor_policy_task_pool::data_size
  152. The quantity of data(in bytes) needed by the task to execute
  153. \var sc_hypervisor_policy_task_pool::next
  154. Other task kinds
  155. \def STARPU_HYPERVISOR_TAG
  156. \ingroup API_SC_Hypervisor
  157. todo
  158. \fn void sc_hypervisor_post_resize_request(unsigned sched_ctx, int task_tag)
  159. \ingroup API_SC_Hypervisor
  160. Requires resizing the context \p sched_ctx whenever a task tagged with the id \p task_tag
  161. finished executing
  162. \fn unsigned sc_hypervisor_get_size_req(unsigned **sched_ctxs, int* nsched_ctxs, int **workers, int *nworkers)
  163. \ingroup API_SC_Hypervisor
  164. Check if there are pending demands of resizing
  165. \fn void sc_hypervisor_save_size_req(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
  166. \ingroup API_SC_Hypervisor
  167. Save a demand of resizing
  168. \fn void sc_hypervisor_free_size_req(void)
  169. \ingroup API_SC_Hypervisor
  170. Clear the list of pending demands of resizing
  171. \fn unsigned sc_hypervisor_can_resize(unsigned sched_ctx)
  172. \ingroup API_SC_Hypervisor
  173. Check out if a context can be resized
  174. \fn struct sc_hypervisor_policy_config *sc_hypervisor_get_config(unsigned sched_ctx)
  175. \ingroup API_SC_Hypervisor
  176. Returns the configuration structure of a context
  177. \fn void sc_hypervisor_set_config(unsigned sched_ctx, void *config)
  178. \ingroup API_SC_Hypervisor
  179. Set a certain configuration to a contexts
  180. \fn unsigned *sc_hypervisor_get_sched_ctxs()
  181. \ingroup API_SC_Hypervisor
  182. Gets the contexts managed by the hypervisor
  183. \fn int sc_hypervisor_get_nsched_ctxs()
  184. \ingroup API_SC_Hypervisor
  185. Gets the number of contexts managed by the hypervisor
  186. \fn struct sc_hypervisor_wrapper *sc_hypervisor_get_wrapper(unsigned sched_ctx)
  187. \ingroup API_SC_Hypervisor
  188. Returns the wrapper corresponding the context \p sched_ctx
  189. \fn double sc_hypervisor_get_elapsed_flops_per_sched_ctx(struct sc_hypervisor_wrapper *sc_w)
  190. \ingroup API_SC_Hypervisor
  191. Returns the flops of a context elapsed from the last resize
  192. */