performance_model.doxy 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup Performance_Model Performance Model
  9. \struct starpu_perfmodel
  10. \brief Contains all information about a performance model. At least the
  11. type and symbol fields have to be filled when defining a performance
  12. model for a codelet. For compatibility, make sure to initialize the
  13. whole structure to zero, either by using explicit memset, or by
  14. letting the compiler implicitly do it in e.g. static storage case. If
  15. not provided, other fields have to be zero.
  16. \ingroup Performance_Model
  17. \var starpu_perfmodel::type
  18. is the type of performance model
  19. <ul>
  20. <li>::STARPU_HISTORY_BASED, ::STARPU_REGRESSION_BASED,
  21. ::STARPU_NL_REGRESSION_BASED: No other fields needs to be provided,
  22. this is purely history-based.
  23. </li>
  24. <li> ::STARPU_PER_ARCH: field starpu_perfmodel::per_arch has to be
  25. filled with functions which return the cost in micro-seconds.
  26. </li>
  27. <li> ::STARPU_COMMON: field starpu_perfmodel::cost_function has to be
  28. filled with a function that returns the cost in micro-seconds on a
  29. CPU, timing on other archs will be determined by multiplying by an
  30. arch-specific factor.
  31. </li>
  32. </ul>
  33. \var starpu_perfmodel::symbol
  34. is the symbol name for the performance model, which will be used as
  35. file name to store the model. It must be set otherwise the model will
  36. be ignored.
  37. \var starpu_perfmodel::cost_model
  38. \deprecated
  39. This field is deprecated. Use instead the field starpu_perfmodel::cost_function field.
  40. \var starpu_perfmodel::cost_function
  41. Used by ::STARPU_COMMON: takes a task and implementation number, and
  42. must return a task duration estimation in micro-seconds.
  43. \var starpu_perfmodel::size_base
  44. Used by ::STARPU_HISTORY_BASED, ::STARPU_REGRESSION_BASED and
  45. ::STARPU_NL_REGRESSION_BASED. If not NULL, takes a task and
  46. implementation number, and returns the size to be used as index for
  47. history and regression.
  48. \var starpu_perfmodel::per_arch
  49. Used by ::STARPU_PER_ARCH: array of structures starpu_per_arch_perfmodel
  50. \var starpu_perfmodel::is_loaded
  51. \private
  52. Whether the performance model is already loaded from the disk.
  53. \var starpu_perfmodel::benchmarking
  54. \private
  55. Whether the performance model is still being calibrated.
  56. \var starpu_perfmodel::model_rwlock
  57. \private
  58. Lock to protect concurrency between loading from disk (W), updating
  59. the values (W), and making a performance estimation (R).
  60. \struct starpu_perfmodel_regression_model
  61. \brief ...
  62. \ingroup Performance_Model
  63. \var starpu_perfmodel_regression_model::sumlny
  64. sum of ln(measured)
  65. \var starpu_perfmodel_regression_model::sumlnx
  66. sum of ln(size)
  67. \var starpu_perfmodel_regression_model::sumlnx2
  68. sum of ln(size)^2
  69. \var starpu_perfmodel_regression_model::minx
  70. minimum size
  71. \var starpu_perfmodel_regression_model::maxx
  72. maximum size
  73. \var starpu_perfmodel_regression_model::sumlnxlny
  74. sum of ln(size)*ln(measured)
  75. \var starpu_perfmodel_regression_model::alpha
  76. estimated = alpha * size ^ beta
  77. \var starpu_perfmodel_regression_model::beta
  78. estimated = alpha * size ^ beta
  79. \var starpu_perfmodel_regression_model::valid
  80. whether the linear regression model is valid (i.e. enough measures)
  81. \var starpu_perfmodel_regression_model::a
  82. estimated = a size ^b + c
  83. \var starpu_perfmodel_regression_model::b
  84. estimated = a size ^b + c
  85. \var starpu_perfmodel_regression_model::c
  86. estimated = a size ^b + c
  87. \var starpu_perfmodel_regression_model::nl_valid
  88. whether the non-linear regression model is valid (i.e. enough measures)
  89. \var starpu_perfmodel_regression_model::nsample
  90. number of sample values for non-linear regression
  91. \struct starpu_perfmodel_per_arch
  92. \brief contains information about the performance model of a given
  93. arch.
  94. \ingroup Performance_Model
  95. \var starpu_perfmodel_per_arch::cost_model
  96. \deprecated
  97. This field is deprecated. Use instead the field
  98. starpu_perfmodel_per_arch::cost_function.
  99. \var starpu_perfmodel_per_arch::cost_function
  100. Used by ::STARPU_PER_ARCH, must point to functions which take a task,
  101. the target arch and implementation number (as mere conveniency, since
  102. the array is already indexed by these), and must return a task
  103. duration estimation in micro-seconds.
  104. \var starpu_perfmodel_per_arch::size_base
  105. Same as in structure starpu_perfmodel, but per-arch, in case it
  106. depends on the architecture-specific implementation.
  107. \var starpu_perfmodel_per_arch::history
  108. \private
  109. The history of performance measurements.
  110. \var starpu_perfmodel_per_arch::list
  111. \private
  112. Used by ::STARPU_HISTORY_BASED and ::STARPU_NL_REGRESSION_BASED,
  113. records all execution history measures.
  114. \var starpu_perfmodel_per_arch::regression
  115. \private
  116. Used by ::STARPU_HISTORY_BASED and
  117. ::STARPU_NL_REGRESSION_BASED, contains the estimated factors of the
  118. regression.
  119. \struct starpu_perfmodel_history_list
  120. \brief todo
  121. \ingroup Performance_Model
  122. \var starpu_perfmodel_history_list::next
  123. todo
  124. \var starpu_perfmodel_history_list::entry
  125. todo
  126. \struct starpu_perfmodel_history_entry
  127. \brief todo
  128. \ingroup Performance_Model
  129. \var starpu_perfmodel_history_entry::mean
  130. mean_n = 1/n sum
  131. \var starpu_perfmodel_history_entry::deviation
  132. n dev_n = sum2 - 1/n (sum)^2
  133. \var starpu_perfmodel_history_entry::sum
  134. num of samples
  135. \var starpu_perfmodel_history_entry::sum2
  136. sum of samples^2
  137. \var starpu_perfmodel_history_entry::nsample
  138. todo
  139. \var starpu_perfmodel_history_entry::footprint
  140. todo
  141. \var starpu_perfmodel_history_entry::size
  142. in bytes
  143. \var starpu_perfmodel_history_entry::flops
  144. Provided by the application
  145. \fn int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)
  146. \ingroup Performance_Model
  147. loads a given performance model. The model structure has to be
  148. completely zero, and will be filled with the information saved in
  149. <c>$STARPU_HOME/.starpu</c>. The function is intended to be used by
  150. external tools that should read the performance model files.
  151. \fn int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)
  152. \ingroup Performance_Model
  153. unloads the given model which has been previously loaded
  154. through the function starpu_perfmodel_load_symbol()
  155. \fn void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, char *path, size_t maxlen, unsigned nimpl)
  156. \ingroup Performance_Model
  157. returns the path to the debugging information for the performance model.
  158. \fn void starpu_perfmodel_get_arch_name(enum starpu_perfmodel_archtype arch, char *archname, size_t maxlen, unsigned nimpl)
  159. \ingroup Performance_Model
  160. returns the architecture name for \p arch
  161. \fn enum starpu_perfmodel_archtype starpu_worker_get_perf_archtype(int workerid)
  162. \ingroup Performance_Model
  163. returns the architecture type of a given worker.
  164. \fn int starpu_perfmodel_list(FILE *output)
  165. \ingroup Performance_Model
  166. prints a list of all performance models on \p output
  167. \fn void starpu_perfmodel_print(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output)
  168. \ingroup Performance_Model
  169. todo
  170. \fn int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output)
  171. \ingroup Performance_Model
  172. todo
  173. \fn void starpu_bus_print_bandwidth(FILE *f)
  174. \ingroup Performance_Model
  175. prints a matrix of bus bandwidths on \p f.
  176. \fn void starpu_bus_print_affinity(FILE *f)
  177. \ingroup Performance_Model
  178. prints the affinity devices on \p f.
  179. \fn void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned cpuid, unsigned nimpl, double measured);
  180. \ingroup Performance_Model
  181. This feeds the performance model model with an explicit
  182. measurement measured, in addition to measurements done by StarPU
  183. itself. This can be useful when the application already has an
  184. existing set of measurements done in good conditions, that StarPU
  185. could benefit from instead of doing on-line measurements. And example
  186. of use can be see in \ref Performance_model_example.
  187. \fn double starpu_get_bandwidth_RAM_CUDA(unsigned cudadev)
  188. \ingroup Performance_Model
  189. Used to compute the velocity of resources
  190. \fn double starpu_get_latency_RAM_CUDA(unsigned cudadev)
  191. \ingroup Performance_Model
  192. Used to compute the velocity of resources
  193. */