starpu_perf_steering.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2019-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __STARPU_PERF_STEERING_H__
  17. #define __STARPU_PERF_STEERING_H__
  18. #include <starpu.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. /**
  24. @defgroup API_Perf_Steering Performance Steering Knobs
  25. @brief This section describes the interface to access performance steering counters.
  26. @{
  27. */
  28. /**
  29. @name API
  30. \anchor PM_API
  31. @{
  32. */
  33. /**
  34. Enum of all possible performance knob scopes.
  35. */
  36. enum starpu_perf_knob_scope
  37. {
  38. starpu_perf_knob_scope_undefined = 0, /**< undefined scope */
  39. starpu_perf_knob_scope_global = 1, /**< global scope */
  40. starpu_perf_knob_scope_per_worker = 3, /**< per-worker scope */
  41. starpu_perf_knob_scope_per_scheduler = 5 /**< per-scheduler scope */
  42. };
  43. /**
  44. Enum of all possible performance knob value type.
  45. */
  46. enum starpu_perf_knob_type
  47. {
  48. starpu_perf_knob_type_undefined = 0, /**< underfined value type */
  49. starpu_perf_knob_type_int32 = 1, /**< signed 32-bit integer value */
  50. starpu_perf_knob_type_int64 = 2, /**< signed 64-bit integer value */
  51. starpu_perf_knob_type_float = 3, /**< 32-bit single precision floating-point value */
  52. starpu_perf_knob_type_double = 4 /**< 64-bit double precision floating-point value */
  53. };
  54. /**
  55. Translate scope name constant string to scope id.
  56. */
  57. int starpu_perf_knob_scope_name_to_id(const char *name);
  58. /**
  59. Translate scope id to scope name constant string.
  60. */
  61. const char *starpu_perf_knob_scope_id_to_name(enum starpu_perf_knob_scope scope);
  62. /**
  63. Translate type name constant string to type id.
  64. */
  65. int starpu_perf_knob_type_name_to_id(const char *name);
  66. /**
  67. Translate type id to type name constant string.
  68. */
  69. const char *starpu_perf_knob_type_id_to_name(enum starpu_perf_knob_type type);
  70. /**
  71. Return the number of performance steering knobs for the given scope.
  72. */
  73. int starpu_perf_knob_nb(enum starpu_perf_knob_scope scope);
  74. /**
  75. Translate a performance knob name to its id.
  76. */
  77. int starpu_perf_knob_name_to_id(enum starpu_perf_knob_scope scope, const char *name);
  78. /**
  79. Translate a performance knob name to its id.
  80. */
  81. int starpu_perf_knob_nth_to_id(enum starpu_perf_knob_scope scope, int nth);
  82. /**
  83. Translate a performance knob rank in its scope to its knob id.
  84. */
  85. const char *starpu_perf_knob_id_to_name(int id);
  86. /**
  87. Translate a knob id to its name constant string.
  88. */
  89. int starpu_perf_knob_get_type_id(int id);
  90. /**
  91. Return the knob's help string.
  92. */
  93. const char *starpu_perf_knob_get_help_string(int id);
  94. /**
  95. Display the list of knobs defined in the given scope.
  96. */
  97. void starpu_perf_knob_list_avail(enum starpu_perf_knob_scope scope);
  98. /**
  99. Display the list of knobs defined in all scopes.
  100. */
  101. void starpu_perf_knob_list_all_avail(void);
  102. /**
  103. Get knob value for Global scope.
  104. */
  105. int32_t starpu_perf_knob_get_global_int32_value (const int knob_id);
  106. /**
  107. Get knob value for Global scope.
  108. */
  109. int64_t starpu_perf_knob_get_global_int64_value (const int knob_id);
  110. /**
  111. Get knob value for Global scope.
  112. */
  113. float starpu_perf_knob_get_global_float_value (const int knob_id);
  114. /**
  115. Get knob value for Global scope.
  116. */
  117. double starpu_perf_knob_get_global_double_value(const int knob_id);
  118. /**
  119. Set int32 knob value for Global scope.
  120. */
  121. void starpu_perf_knob_set_global_int32_value (const int knob_id, int32_t new_value);
  122. /**
  123. Set int64 knob value for Global scope.
  124. */
  125. void starpu_perf_knob_set_global_int64_value (const int knob_id, int64_t new_value);
  126. /**
  127. Set float knob value for Global scope.
  128. */
  129. void starpu_perf_knob_set_global_float_value (const int knob_id, float new_value);
  130. /**
  131. Set double knob value for Global scope.
  132. */
  133. void starpu_perf_knob_set_global_double_value(const int knob_id, double new_value);
  134. /**
  135. Get int32 value for Per_worker scope.
  136. */
  137. int32_t starpu_perf_knob_get_per_worker_int32_value (const int knob_id, unsigned workerid);
  138. /**
  139. Get int64 value for Per_worker scope.
  140. */
  141. int64_t starpu_perf_knob_get_per_worker_int64_value (const int knob_id, unsigned workerid);
  142. /**
  143. Get float value for Per_worker scope.
  144. */
  145. float starpu_perf_knob_get_per_worker_float_value (const int knob_id, unsigned workerid);
  146. /**
  147. Get double value for Per_worker scope.
  148. */
  149. double starpu_perf_knob_get_per_worker_double_value(const int knob_id, unsigned workerid);
  150. /**
  151. Set int32 value for Per_worker scope.
  152. */
  153. void starpu_perf_knob_set_per_worker_int32_value (const int knob_id, unsigned workerid, int32_t new_value);
  154. /**
  155. Set int64 value for Per_worker scope.
  156. */
  157. void starpu_perf_knob_set_per_worker_int64_value (const int knob_id, unsigned workerid, int64_t new_value);
  158. /**
  159. Set float value for Per_worker scope.
  160. */
  161. void starpu_perf_knob_set_per_worker_float_value (const int knob_id, unsigned workerid, float new_value);
  162. /**
  163. Set double value for Per_worker scope.
  164. */
  165. void starpu_perf_knob_set_per_worker_double_value(const int knob_id, unsigned workerid, double new_value);
  166. /**
  167. Get int32 value for per_scheduler scope.
  168. */
  169. int32_t starpu_perf_knob_get_per_scheduler_int32_value (const int knob_id, const char * sched_policy_name);
  170. /**
  171. Get int64 value for per_scheduler scope.
  172. */
  173. int64_t starpu_perf_knob_get_per_scheduler_int64_value (const int knob_id, const char * sched_policy_name);
  174. /**
  175. Get float value for per_scheduler scope.
  176. */
  177. float starpu_perf_knob_get_per_scheduler_float_value (const int knob_id, const char * sched_policy_name);
  178. /**
  179. Get double value for per_scheduler scope.
  180. */
  181. double starpu_perf_knob_get_per_scheduler_double_value(const int knob_id, const char * sched_policy_name);
  182. /**
  183. Set int32 value for per_scheduler scope.
  184. */
  185. void starpu_perf_knob_set_per_scheduler_int32_value (const int knob_id, const char * sched_policy_name, int32_t new_value);
  186. /**
  187. Set int64 value for per_scheduler scope.
  188. */
  189. void starpu_perf_knob_set_per_scheduler_int64_value (const int knob_id, const char * sched_policy_name, int64_t new_value);
  190. /**
  191. Set float value for per_scheduler scope.
  192. */
  193. void starpu_perf_knob_set_per_scheduler_float_value (const int knob_id, const char * sched_policy_name, float new_value);
  194. /**
  195. Set double value for per_scheduler scope.
  196. */
  197. void starpu_perf_knob_set_per_scheduler_double_value(const int knob_id, const char * sched_policy_name, double new_value);
  198. /** @} */
  199. /** @} */
  200. #ifdef __cplusplus
  201. }
  202. #endif
  203. #endif /* __STARPU_PERF_STEERING_H__ */