sc_hypervisor.doxy 9.0 KB

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