scheduling_context_hypervisor_usage.doxy 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011, 2012, 2013 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Scheduling_Context_Hypervisor_usage Scheduling Context Hypervisor - Regular usage
  9. \fn void *sc_hypervisor_init(struct sc_hypervisor_policy *policy)
  10. \ingroup API_Scheduling_Context_Hypervisor_usage
  11. There is a single hypervisor that is in charge of resizing contexts
  12. and the resizing strategy is chosen at the initialization of the
  13. hypervisor. A single resize can be done at a time.
  14. The Scheduling Context Hypervisor Plugin provides a series of
  15. performance counters to StarPU. By incrementing them, StarPU can help
  16. the hypervisor in the resizing decision making process.
  17. This function initializes the hypervisor to use the strategy provided as parameter
  18. and creates the performance counters (see starpu_sched_ctx_performance_counters).
  19. These performance counters represent actually some callbacks that will
  20. be used by the contexts to notify the information needed by the
  21. hypervisor.
  22. Note: The Hypervisor is actually a worker that takes this role once
  23. certain conditions trigger the resizing process (there is no
  24. additional thread assigned to the hypervisor).
  25. \fn void sc_hypervisor_shutdown(void)
  26. \ingroup API_Scheduling_Context_Hypervisor_usage
  27. The hypervisor and all information concerning it is cleaned. There is
  28. no synchronization between this function and starpu_shutdown(). Thus,
  29. this should be called after starpu_shutdown(), because the performance
  30. counters will still need allocated callback functions.
  31. \fn void sc_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
  32. \ingroup API_Scheduling_Context_Hypervisor_usage
  33. Scheduling Contexts that have to be resized by the hypervisor must be
  34. first registered to the hypervisor.
  35. This function registers the context to the hypervisor, and indicate the number of
  36. flops the context will execute (used for Gflops rate based strategy
  37. or any other custom strategy needing it, for the others we can pass 0.0)
  38. \fn void sc_hypervisor_unregister_ctx(unsigned sched_ctx)
  39. \ingroup API_Scheduling_Context_Hypervisor_usage
  40. Whenever we want to exclude
  41. contexts from the resizing process we have to unregister them from the
  42. hypervisor.
  43. \fn void sc_hypervisor_resize_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nworkers)
  44. \ingroup API_Scheduling_Context_Hypervisor_usage
  45. Requires reconsidering the distribution of ressources over the indicated scheduling contexts
  46. \fn void sc_hypervisor_stop_resize(unsigned sched_ctx)
  47. \ingroup API_Scheduling_Context_Hypervisor_usage
  48. The user can totally forbid the resizing of a certain context or can
  49. then change his mind and allow it (in this case the resizing is
  50. managed by the hypervisor, that can forbid it or allow it)
  51. \fn void sc_hypervisor_start_resize(unsigned sched_ctx)
  52. \ingroup API_Scheduling_Context_Hypervisor_usage
  53. Allow resizing of a context. The user can then provide information to
  54. the hypervisor concerning the conditions of resizing.
  55. \fn char *sc_hypervisor_get_policy();
  56. \ingroup API_Scheduling_Context_Hypervisor_usage
  57. Returns the name of the resizing policy the hypervisor uses
  58. \fn void sc_hypervisor_add_workers_to_sched_ctx(int* workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx)
  59. \ingroup API_Scheduling_Context_Hypervisor_usage
  60. Ask the hypervisor to add workers to a sched_ctx
  61. \fn void sc_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now)
  62. \ingroup API_Scheduling_Context_Hypervisor_usage
  63. Ask the hypervisor to remove workers from a sched_ctx
  64. \fn void sc_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now)
  65. \ingroup API_Scheduling_Context_Hypervisor_usage
  66. Moves workers from one context to another
  67. \fn void sc_hypervisor_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
  68. \ingroup API_Scheduling_Context_Hypervisor_usage
  69. Ask the hypervisor to chose a distribution of workers in the required contexts
  70. \fn void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size)
  71. \ingroup API_Scheduling_Context_Hypervisor_usage
  72. Indicate the types of tasks a context will execute in order to better decide the sizing of ctxs
  73. \fn void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total_flops)
  74. \ingroup API_Scheduling_Context_Hypervisor_usage
  75. Change dynamically the total number of flops of a context, move the deadline of the finishing time of the context
  76. \fn void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_task_flops)
  77. \ingroup API_Scheduling_Context_Hypervisor_usage
  78. Change dynamically the number of the elapsed flops in a context, modify the past in order to better compute the speed
  79. \fn int *sc_hypervisor_get_sched_ctxs()
  80. \ingroup API_Scheduling_Context_Hypervisor_usage
  81. Gets the contexts managed by the hypervisor
  82. \fn int sc_hypervisor_get_nsched_ctxs()
  83. \ingroup API_Scheduling_Context_Hypervisor_usage
  84. Gets the number of contexts managed by the hypervisor
  85. \fn void sc_hypervisor_ctl(unsigned sched_ctx, ...)
  86. \ingroup API_Scheduling_Context_Hypervisor_usage
  87. Inputs conditions to the context sched_ctx with the following
  88. arguments. The argument list must be zero-terminated.
  89. \def SC_HYPERVISOR_MAX_IDLE
  90. \ingroup API_Scheduling_Context_Hypervisor_usage
  91. This macro is used when calling sc_hypervisor_ctl() and must be
  92. followed by 3 arguments: an array of int for the workerids to apply
  93. the condition, an int to indicate the size of the array, and a double
  94. value indicating the maximum idle time allowed for a worker before the
  95. resizing process should be triggered
  96. \def SC_HYPERVISOR_PRIORITY
  97. \ingroup API_Scheduling_Context_Hypervisor_usage
  98. This macro is used when calling sc_hypervisor_ctl() and must be
  99. followed by 3 arguments: an array of int for the workerids to apply
  100. the condition, an int to indicate the size of the array, and an int
  101. value indicating the priority of the workers previously mentioned. The
  102. workers with the smallest priority are moved the first.
  103. \def SC_HYPERVISOR_MIN_WORKERS
  104. \ingroup API_Scheduling_Context_Hypervisor_usage
  105. This macro is used when calling sc_hypervisor_ctl() and must be
  106. followed by 1 argument(int) indicating the minimum number of workers a
  107. context should have, underneath this limit the context cannot execute.
  108. \def SC_HYPERVISOR_MAX_WORKERS
  109. \ingroup API_Scheduling_Context_Hypervisor_usage
  110. This macro is used when calling sc_hypervisor_ctl() and must be
  111. followed by 1 argument(int) indicating the maximum number of workers a
  112. context should have, above this limit the context would not be able to
  113. scale
  114. \def SC_HYPERVISOR_GRANULARITY
  115. \ingroup API_Scheduling_Context_Hypervisor_usage
  116. This macro is used when calling sc_hypervisor_ctl() and must be
  117. followed by 1 argument(int) indicating the granularity of the resizing
  118. process (the number of workers should be moved from the context once
  119. it is resized) This parameter is ignore for the Gflops rate based
  120. strategy (see \ref ResizingStrategies), the number of workers that have to
  121. be moved is calculated by the strategy.
  122. \def SC_HYPERVISOR_FIXED_WORKERS
  123. \ingroup API_Scheduling_Context_Hypervisor_usage
  124. This macro is used when calling sc_hypervisor_ctl() and must be
  125. followed by 2 arguments: an array of int for the workerids to apply
  126. the condition and an int to indicate the size of the array. These
  127. workers are not allowed to be moved from the context.
  128. \def SC_HYPERVISOR_MIN_TASKS
  129. \ingroup API_Scheduling_Context_Hypervisor_usage
  130. This macro is used when calling sc_hypervisor_ctl() and must be
  131. followed by 1 argument (int) that indicated the minimum number of
  132. tasks that have to be executed before the context could be resized.
  133. This parameter is ignored for the Application Driven strategy (see \ref
  134. ResizingStrategies) where the user indicates exactly when the resize
  135. should be done.
  136. \def SC_HYPERVISOR_NEW_WORKERS_MAX_IDLE
  137. \ingroup API_Scheduling_Context_Hypervisor_usage
  138. This macro is used when calling sc_hypervisor_ctl() and must be
  139. followed by 1 argument, a double value indicating the maximum idle
  140. time allowed for workers that have just been moved from other contexts
  141. in the current context.
  142. \def SC_HYPERVISOR_TIME_TO_APPLY
  143. \ingroup API_Scheduling_Context_Hypervisor_usage
  144. This macro is used when calling sc_hypervisor_ctl() and must be
  145. followed by 1 argument (int) indicating the tag an executed task
  146. should have such that this configuration should be taken into account.
  147. \def SC_HYPERVISOR_ISPEED_W_SAMPLE
  148. \ingroup API_Scheduling_Context_Hypervisor_usage
  149. This macro is used when calling sc_hypervisor_ctl() and must be
  150. followed by 1 argument, a double, that indicates the number of flops
  151. needed to be executed before computing the speed of a worker
  152. \def SC_HYPERVISOR_ISPEED_CTX_SAMPLE
  153. \ingroup API_Scheduling_Context_Hypervisor_usage
  154. This macro is used when calling sc_hypervisor_ctl() and must be
  155. followed by 1 argument, a double, that indicates the number of flops
  156. needed to be executed before computing the speed of a context
  157. \def SC_HYPERVISOR_NULL
  158. \ingroup API_Scheduling_Context_Hypervisor_usage
  159. This macro is used when calling sc_hypervisor_ctl() and must be
  160. followed by 1 arguments
  161. */