370_online_performance_tools.doxy 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2017 CNRS
  4. * Copyright (C) 2011-2012,2016 Inria
  5. * Copyright (C) 2009-2011,2014,2016 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. /*! \page OnlinePerformanceTools Online Performance Tools
  19. \section On-linePerformanceFeedback On-line Performance Feedback
  20. \subsection EnablingOn-linePerformanceMonitoring Enabling On-line Performance Monitoring
  21. In order to enable online performance monitoring, the application can
  22. call starpu_profiling_status_set() with the parameter
  23. ::STARPU_PROFILING_ENABLE. It is possible to detect whether monitoring
  24. is already enabled or not by calling starpu_profiling_status_get().
  25. Enabling monitoring also reinitialize all previously collected
  26. feedback. The environment variable \ref STARPU_PROFILING can also be
  27. set to <c>1</c> to achieve the same effect. The function
  28. starpu_profiling_init() can also be called during the execution to
  29. reinitialize performance counters and to start the profiling if the
  30. environment variable \ref STARPU_PROFILING is set to <c>1</c>.
  31. Likewise, performance monitoring is stopped by calling
  32. starpu_profiling_status_set() with the parameter
  33. ::STARPU_PROFILING_DISABLE. Note that this does not reset the
  34. performance counters so that the application may consult them later
  35. on.
  36. More details about the performance monitoring API are available in \ref API_Profiling.
  37. \subsection Per-taskFeedback Per-task Feedback
  38. If profiling is enabled, a pointer to a structure
  39. starpu_profiling_task_info is put in the field
  40. starpu_task::profiling_info when a task terminates. This structure is
  41. automatically destroyed when the task structure is destroyed, either
  42. automatically or by calling starpu_task_destroy().
  43. The structure starpu_profiling_task_info indicates the date when the
  44. task was submitted (starpu_profiling_task_info::submit_time), started
  45. (starpu_profiling_task_info::start_time), and terminated
  46. (starpu_profiling_task_info::end_time), relative to the initialization
  47. of StarPU with starpu_init(). It also specifies the identifier of the worker
  48. that has executed the task (starpu_profiling_task_info::workerid).
  49. These date are stored as <c>timespec</c> structures which the user may convert
  50. into micro-seconds using the helper function
  51. starpu_timing_timespec_to_us().
  52. It it worth noting that the application may directly access this structure from
  53. the callback executed at the end of the task. The structure starpu_task
  54. associated to the callback currently being executed is indeed accessible with
  55. the function starpu_task_get_current().
  56. \subsection Per-codeletFeedback Per-codelet Feedback
  57. The field starpu_codelet::per_worker_stats is
  58. an array of counters. The <c>i</c>-th entry of the array is incremented every time a
  59. task implementing the codelet is executed on the <c>i</c>-th worker.
  60. This array is not reinitialized when profiling is enabled or disabled.
  61. \subsection Per-workerFeedback Per-worker Feedback
  62. The second argument returned by the function
  63. starpu_profiling_worker_get_info() is a structure
  64. starpu_profiling_worker_info that gives statistics about the specified
  65. worker. This structure specifies when StarPU started collecting
  66. profiling information for that worker
  67. (starpu_profiling_worker_info::start_time), the
  68. duration of the profiling measurement interval
  69. (starpu_profiling_worker_info::total_time), the time spent executing
  70. kernels (starpu_profiling_worker_info::executing_time), the time
  71. spent sleeping because there is no task to execute at all
  72. (starpu_profiling_worker_info::sleeping_time), and the number of tasks that were executed
  73. while profiling was enabled. These values give an estimation of the
  74. proportion of time spent do real work, and the time spent either
  75. sleeping because there are not enough executable tasks or simply
  76. wasted in pure StarPU overhead.
  77. Calling starpu_profiling_worker_get_info() resets the profiling
  78. information associated to a worker.
  79. To easily display all this information, the environment variable
  80. \ref STARPU_WORKER_STATS can be set to <c>1</c> (in addition to setting
  81. \ref STARPU_PROFILING to 1). A summary will then be displayed at program termination:
  82. \verbatim
  83. Worker stats:
  84. CUDA 0.0 (4.7 GiB)
  85. 480 task(s)
  86. total: 1574.82 ms executing: 1510.72 ms sleeping: 0.00 ms overhead 64.10 ms
  87. 325.217970 GFlop/s
  88. CPU 0
  89. 22 task(s)
  90. total: 1574.82 ms executing: 1364.81 ms sleeping: 0.00 ms overhead 210.01 ms
  91. 7.512057 GFlop/s
  92. CPU 1
  93. 14 task(s)
  94. total: 1574.82 ms executing: 1500.13 ms sleeping: 0.00 ms overhead 74.69 ms
  95. 6.675853 GFlop/s
  96. CPU 2
  97. 14 task(s)
  98. total: 1574.82 ms executing: 1553.12 ms sleeping: 0.00 ms overhead 21.70 ms
  99. 7.152886 GFlop/s
  100. \endverbatim
  101. The number of GFlops is available because the starpu_task::flops field of the
  102. tasks were filled (or \ref STARPU_FLOPS used in starpu_task_insert()).
  103. When an FxT trace is generated (see \ref GeneratingTracesWithFxT), it is also
  104. possible to use the tool <c>starpu_workers_activity</c> (see
  105. \ref MonitoringActivity) to generate a graphic showing the evolution of
  106. these values during the time, for the different workers.
  107. \subsection Bus-relatedFeedback Bus-related Feedback
  108. // how to enable/disable performance monitoring
  109. // what kind of information do we get ?
  110. The bus speed measured by StarPU can be displayed by using the tool
  111. <c>starpu_machine_display</c>, for instance:
  112. \verbatim
  113. StarPU has found:
  114. 3 CUDA devices
  115. CUDA 0 (Tesla C2050 02:00.0)
  116. CUDA 1 (Tesla C2050 03:00.0)
  117. CUDA 2 (Tesla C2050 84:00.0)
  118. from to RAM to CUDA 0 to CUDA 1 to CUDA 2
  119. RAM 0.000000 5176.530428 5176.492994 5191.710722
  120. CUDA 0 4523.732446 0.000000 2414.074751 2417.379201
  121. CUDA 1 4523.718152 2414.078822 0.000000 2417.375119
  122. CUDA 2 4534.229519 2417.069025 2417.060863 0.000000
  123. \endverbatim
  124. Statistics about the data transfers which were performed and temporal average
  125. of bandwidth usage can be obtained by setting the environment variable
  126. \ref STARPU_BUS_STATS to <c>1</c>; a summary will then be displayed at program termination:
  127. \verbatim
  128. Data transfer stats:
  129. RAM 0 -> CUDA 0 319.92 MB 213.10 MB/s (transfers : 91 - avg 3.52 MB)
  130. CUDA 0 -> RAM 0 214.45 MB 142.85 MB/s (transfers : 61 - avg 3.52 MB)
  131. RAM 0 -> CUDA 1 302.34 MB 201.39 MB/s (transfers : 86 - avg 3.52 MB)
  132. CUDA 1 -> RAM 0 133.59 MB 88.99 MB/s (transfers : 38 - avg 3.52 MB)
  133. CUDA 0 -> CUDA 1 144.14 MB 96.01 MB/s (transfers : 41 - avg 3.52 MB)
  134. CUDA 1 -> CUDA 0 130.08 MB 86.64 MB/s (transfers : 37 - avg 3.52 MB)
  135. RAM 0 -> CUDA 2 312.89 MB 208.42 MB/s (transfers : 89 - avg 3.52 MB)
  136. CUDA 2 -> RAM 0 133.59 MB 88.99 MB/s (transfers : 38 - avg 3.52 MB)
  137. CUDA 0 -> CUDA 2 151.17 MB 100.69 MB/s (transfers : 43 - avg 3.52 MB)
  138. CUDA 2 -> CUDA 0 105.47 MB 70.25 MB/s (transfers : 30 - avg 3.52 MB)
  139. CUDA 1 -> CUDA 2 175.78 MB 117.09 MB/s (transfers : 50 - avg 3.52 MB)
  140. CUDA 2 -> CUDA 1 203.91 MB 135.82 MB/s (transfers : 58 - avg 3.52 MB)
  141. Total transfers: 2.27 GB
  142. \endverbatim
  143. \subsection StarPU-TopInterface StarPU-Top Interface
  144. StarPU-Top is an interface which remotely displays the on-line state of a StarPU
  145. application and permits the user to change parameters on the fly.
  146. Variables to be monitored can be registered by calling the functions
  147. starpu_top_add_data_boolean(), starpu_top_add_data_integer(),
  148. starpu_top_add_data_float(), e.g.:
  149. \code{.c}
  150. starpu_top_data *data = starpu_top_add_data_integer("mynum", 0, 100, 1);
  151. \endcode
  152. The application should then call starpu_top_init_and_wait() to give its name
  153. and wait for StarPU-Top to get a start request from the user. The name is used
  154. by StarPU-Top to quickly reload a previously-saved layout of parameter display.
  155. \code{.c}
  156. starpu_top_init_and_wait("the application");
  157. \endcode
  158. The new values can then be provided thanks to
  159. starpu_top_update_data_boolean(), starpu_top_update_data_integer(),
  160. starpu_top_update_data_float(), e.g.:
  161. \code{.c}
  162. starpu_top_update_data_integer(data, mynum);
  163. \endcode
  164. Updateable parameters can be registered thanks to starpu_top_register_parameter_boolean(), starpu_top_register_parameter_integer(), starpu_top_register_parameter_float(), e.g.:
  165. \code{.c}
  166. float alpha;
  167. starpu_top_register_parameter_float("alpha", &alpha, 0, 10, modif_hook);
  168. \endcode
  169. <c>modif_hook</c> is a function which will be called when the parameter is being modified, it can for instance print the new value:
  170. \code{.c}
  171. void modif_hook(struct starpu_top_param *d)
  172. {
  173. fprintf(stderr,"%s has been modified: %f\n", d->name, alpha);
  174. }
  175. \endcode
  176. Task schedulers should notify StarPU-Top when it has decided when a task will be
  177. scheduled, so that it can show it in its Gantt chart, for instance:
  178. \code{.c}
  179. starpu_top_task_prevision(task, workerid, begin, end);
  180. \endcode
  181. Starting StarPU-Top (StarPU-Top is started via the binary
  182. <c>starpu_top</c>) and the application can be done in two ways:
  183. <ul>
  184. <li> The application is started by hand on some machine (and thus already
  185. waiting for the start event). In the Preference dialog of StarPU-Top, the SSH
  186. checkbox should be unchecked, and the hostname and port (default is 2011) on
  187. which the application is already running should be specified. Clicking on the
  188. connection button will thus connect to the already-running application.
  189. </li>
  190. <li> StarPU-Top is started first, and clicking on the connection button will
  191. start the application itself (possibly on a remote machine). The SSH checkbox
  192. should be checked, and a command line provided, e.g.:
  193. \verbatim
  194. $ ssh myserver STARPU_SCHED=dmda ./application
  195. \endverbatim
  196. If port 2011 of the remote machine can not be accessed directly, an ssh port bridge should be added:
  197. \verbatim
  198. $ ssh -L 2011:localhost:2011 myserver STARPU_SCHED=dmda ./application
  199. \endverbatim
  200. and "localhost" should be used as IP Address to connect to.
  201. </li>
  202. </ul>
  203. \section TaskAndWorkerProfiling Task And Worker Profiling
  204. A full example showing how to use the profiling API is available in
  205. the StarPU sources in the directory <c>examples/profiling/</c>.
  206. \code{.c}
  207. struct starpu_task *task = starpu_task_create();
  208. task->cl = &cl;
  209. task->synchronous = 1;
  210. /* We will destroy the task structure by hand so that we can
  211. * query the profiling info before the task is destroyed. */
  212. task->destroy = 0;
  213. /* Submit and wait for completion (since synchronous was set to 1) */
  214. starpu_task_submit(task);
  215. /* The task is finished, get profiling information */
  216. struct starpu_profiling_task_info *info = task->profiling_info;
  217. /* How much time did it take before the task started ? */
  218. double delay += starpu_timing_timespec_delay_us(&info->submit_time, &info->start_time);
  219. /* How long was the task execution ? */
  220. double length += starpu_timing_timespec_delay_us(&info->start_time, &info->end_time);
  221. /* We no longer need the task structure */
  222. starpu_task_destroy(task);
  223. \endcode
  224. \code{.c}
  225. /* Display the occupancy of all workers during the test */
  226. int worker;
  227. for (worker = 0; worker < starpu_worker_get_count(); worker++)
  228. {
  229. struct starpu_profiling_worker_info worker_info;
  230. int ret = starpu_profiling_worker_get_info(worker, &worker_info);
  231. STARPU_ASSERT(!ret);
  232. double total_time = starpu_timing_timespec_to_us(&worker_info.total_time);
  233. double executing_time = starpu_timing_timespec_to_us(&worker_info.executing_time);
  234. double sleeping_time = starpu_timing_timespec_to_us(&worker_info.sleeping_time);
  235. double overhead_time = total_time - executing_time - sleeping_time;
  236. float executing_ratio = 100.0*executing_time/total_time;
  237. float sleeping_ratio = 100.0*sleeping_time/total_time;
  238. float overhead_ratio = 100.0 - executing_ratio - sleeping_ratio;
  239. char workername[128];
  240. starpu_worker_get_name(worker, workername, 128);
  241. fprintf(stderr, "Worker %s:\n", workername);
  242. fprintf(stderr, "\ttotal time: %.2lf ms\n", total_time*1e-3);
  243. fprintf(stderr, "\texec time: %.2lf ms (%.2f %%)\n",
  244. executing_time*1e-3, executing_ratio);
  245. fprintf(stderr, "\tblocked time: %.2lf ms (%.2f %%)\n",
  246. sleeping_time*1e-3, sleeping_ratio);
  247. fprintf(stderr, "\toverhead time: %.2lf ms (%.2f %%)\n",
  248. overhead_time*1e-3, overhead_ratio);
  249. }
  250. \endcode
  251. \section PerformanceModelExample Performance Model Example
  252. To achieve good scheduling, StarPU scheduling policies need to be able to
  253. estimate in advance the duration of a task. This is done by giving to codelets
  254. a performance model, by defining a structure starpu_perfmodel and
  255. providing its address in the field starpu_codelet::model. The fields
  256. starpu_perfmodel::symbol and starpu_perfmodel::type are mandatory, to
  257. give a name to the model, and the type of the model, since there are
  258. several kinds of performance models. For compatibility, make sure to
  259. initialize the whole structure to zero, either by using explicit
  260. memset(), or by letting the compiler implicitly do it as examplified
  261. below.
  262. <ul>
  263. <li>
  264. Measured at runtime (model type ::STARPU_HISTORY_BASED). This assumes that for a
  265. given set of data input/output sizes, the performance will always be about the
  266. same. This is very true for regular kernels on GPUs for instance (<0.1% error),
  267. and just a bit less true on CPUs (~=1% error). This also assumes that there are
  268. few different sets of data input/output sizes. StarPU will then keep record of
  269. the average time of previous executions on the various processing units, and use
  270. it as an estimation. History is done per task size, by using a hash of the input
  271. and ouput sizes as an index.
  272. It will also save it in <c>$STARPU_HOME/.starpu/sampling/codelets</c>
  273. for further executions, and can be observed by using the tool
  274. <c>starpu_perfmodel_display</c>, or drawn by using
  275. the tool <c>starpu_perfmodel_plot</c> (\ref PerformanceModelCalibration). The
  276. models are indexed by machine name. To
  277. share the models between machines (e.g. for a homogeneous cluster), use
  278. <c>export STARPU_HOSTNAME=some_global_name</c>. Measurements are only done
  279. when using a task scheduler which makes use of it, such as
  280. <c>dmda</c>. Measurements can also be provided explicitly by the application, by
  281. using the function starpu_perfmodel_update_history().
  282. The following is a small code example.
  283. If e.g. the code is recompiled with other compilation options, or several
  284. variants of the code are used, the <c>symbol</c> string should be changed to reflect
  285. that, in order to recalibrate a new model from zero. The <c>symbol</c> string can even
  286. be constructed dynamically at execution time, as long as this is done before
  287. submitting any task using it.
  288. \code{.c}
  289. static struct starpu_perfmodel mult_perf_model =
  290. {
  291. .type = STARPU_HISTORY_BASED,
  292. .symbol = "mult_perf_model"
  293. };
  294. struct starpu_codelet cl =
  295. {
  296. .cpu_funcs = { cpu_mult },
  297. .cpu_funcs_name = { "cpu_mult" },
  298. .nbuffers = 3,
  299. .modes = { STARPU_R, STARPU_R, STARPU_W },
  300. /* for the scheduling policy to be able to use performance models */
  301. .model = &mult_perf_model
  302. };
  303. \endcode
  304. </li>
  305. <li>
  306. Measured at runtime and refined by regression (model types
  307. ::STARPU_REGRESSION_BASED and ::STARPU_NL_REGRESSION_BASED). This
  308. still assumes performance regularity, but works
  309. with various data input sizes, by applying regression over observed
  310. execution times. ::STARPU_REGRESSION_BASED uses an <c>a*n^b</c> regression
  311. form, ::STARPU_NL_REGRESSION_BASED uses an <c>a*n^b+c</c> (more precise than
  312. ::STARPU_REGRESSION_BASED, but costs a lot more to compute).
  313. For instance,
  314. <c>tests/perfmodels/regression_based.c</c> uses a regression-based performance
  315. model for the function memset().
  316. Of course, the application has to issue
  317. tasks with varying size so that the regression can be computed. StarPU will not
  318. trust the regression unless there is at least 10% difference between the minimum
  319. and maximum observed input size. It can be useful to set the
  320. environment variable \ref STARPU_CALIBRATE to <c>1</c> and run the application
  321. on varying input sizes with \ref STARPU_SCHED set to <c>dmda</c> scheduler,
  322. so as to feed the performance model for a variety of
  323. inputs. The application can also provide the measurements explictly by
  324. using the function starpu_perfmodel_update_history(). The tools
  325. <c>starpu_perfmodel_display</c> and <c>starpu_perfmodel_plot</c> can
  326. be used to observe how much the performance model is calibrated
  327. (\ref PerformanceModelCalibration); when their output look good,
  328. \ref STARPU_CALIBRATE can be reset to <c>0</c> to let
  329. StarPU use the resulting performance model without recording new measures, and
  330. \ref STARPU_SCHED can be set to <c>dmda</c> to benefit from the performance models. If
  331. the data input sizes vary a lot, it is really important to set
  332. \ref STARPU_CALIBRATE to <c>0</c>, otherwise StarPU will continue adding the
  333. measures, and result with a very big performance model, which will take time a
  334. lot of time to load and save.
  335. For non-linear regression, since computing it
  336. is quite expensive, it is only done at termination of the application. This
  337. means that the first execution of the application will use only history-based
  338. performance model to perform scheduling, without using regression.
  339. </li>
  340. <li>
  341. Another type of model is ::STARPU_MULTIPLE_REGRESSION_BASED, which
  342. is based on multiple linear regression. In this model, the user
  343. defines both the relevant parameters and the equation for computing the
  344. task duration.
  345. \f[
  346. T_{kernel} = a + b(M^{\alpha_1} * N^{\beta_1} * K^{\gamma_1}) + c(M^{\alpha_2} * N^{\beta_2} * K^{\gamma_2}) + ...
  347. \f]
  348. \f$M, N, K\f$ are the parameters of the task, added at the task
  349. creation. These need to be extracted by the <c>cl_perf_func</c>
  350. function, which should be defined by the user. \f$\alpha, \beta,
  351. \gamma\f$ are the exponents defined by the user in
  352. <c>model->combinations</c> table. Finally, coefficients \f$a, b, c\f$
  353. are computed automatically by the StarPU at the end of the execution, using least
  354. squares method of the <c>dgels_</c> LAPACK function.
  355. <c>examples/mlr/mlr.c</c> example provides more details on
  356. the usage of ::STARPU_MULTIPLE_REGRESSION_BASED models.
  357. Coefficients computation is done at the end of the execution, and the
  358. results are stored in standard codelet perfmodel files. Additional
  359. files containing the duration of task together with the value of each
  360. parameter are stored in <c>.starpu/sampling/codelets/tmp/</c>
  361. directory. These files are reused when \ref STARPU_CALIBRATE
  362. environment variable is set to <c>1</c>, to recompute coefficients
  363. based on the current, but also on the previous
  364. executions. Additionally, when multiple linear regression models are
  365. disabled (using "--disable-mlr" configuration option) or when the
  366. <c>model->combinations</c> are not defined, StarPU will still write
  367. output files into <c>.starpu/sampling/codelets/tmp/</c> to allow
  368. performing an analysis. This analysis typically aims at finding the
  369. most appropriate equation for the codelet and
  370. <c>tools/starpu_mlr_analysis</c> script provides an example of how to
  371. perform such study.
  372. </li>
  373. <li>
  374. Provided as an estimation from the application itself (model type
  375. ::STARPU_COMMON and field starpu_perfmodel::cost_function),
  376. see for instance
  377. <c>examples/common/blas_model.h</c> and <c>examples/common/blas_model.c</c>.
  378. </li>
  379. <li>
  380. Provided explicitly by the application (model type ::STARPU_PER_ARCH):
  381. either field starpu_perfmodel::arch_cost_function, or
  382. the fields <c>.per_arch[arch][nimpl].cost_function</c> have to be
  383. filled with pointers to functions which return the expected duration
  384. of the task in micro-seconds, one per architecture, see for instance
  385. <c>tests/datawizard/locality.c</c>
  386. </li>
  387. </ul>
  388. For ::STARPU_HISTORY_BASED, ::STARPU_REGRESSION_BASED, and
  389. ::STARPU_NL_REGRESSION_BASED, the dimensions of task data (both input
  390. and output) are used as an index by default. ::STARPU_HISTORY_BASED uses a CRC
  391. hash of the dimensions as an index to distinguish histories, and
  392. ::STARPU_REGRESSION_BASED and ::STARPU_NL_REGRESSION_BASED use the total
  393. size as an index for the regression.
  394. The starpu_perfmodel::size_base and starpu_perfmodel::footprint fields however
  395. permit the application to override that, when for instance some of the data
  396. do not matter for task cost (e.g. mere reference table), or when using sparse
  397. structures (in which case it is the number of non-zeros which matter), or when
  398. there is some hidden parameter such as the number of iterations, or when the
  399. application actually has a very good idea of the complexity of the algorithm,
  400. and just not the speed of the processor, etc. The example in the directory
  401. <c>examples/pi</c> uses this to include the number of iterations in the base
  402. size. starpu_perfmodel::size_base should be used when the variance of the actual
  403. performance is known (i.e. bigger returned value is longer execution
  404. time), and thus particularly useful for ::STARPU_REGRESSION_BASED or
  405. ::STARPU_NL_REGRESSION_BASED. starpu_perfmodel::footprint can be used when the
  406. variance of the actual performance is unknown (irregular performance behavior,
  407. etc.), and thus only useful for ::STARPU_HISTORY_BASED.
  408. starpu_task_data_footprint() can be used as a base and combined with other
  409. parameters through starpu_hash_crc32c_be() for instance.
  410. StarPU will automatically determine when the performance model is calibrated,
  411. or rather, it will assume the performance model is calibrated until the
  412. application submits a task for which the performance can not be predicted. For
  413. ::STARPU_HISTORY_BASED, StarPU will require 10 (STARPU_CALIBRATE_MINIMUM)
  414. measurements for a given size before estimating that an average can be taken as
  415. estimation for further executions with the same size. For
  416. ::STARPU_REGRESSION_BASED and ::STARPU_NL_REGRESSION_BASED, StarPU will require
  417. 10 (STARPU_CALIBRATE_MINIMUM) measurements, and that the minimum measured
  418. data size is smaller than 90% of the maximum measured data size (i.e. the
  419. measurement interval is large enough for a regression to have a meaning).
  420. Calibration can also be forced by setting the \ref STARPU_CALIBRATE environment
  421. variable to <c>1</c>, or even reset by setting it to <c>2</c>.
  422. How to use schedulers which can benefit from such performance model is explained
  423. in \ref TaskSchedulingPolicy.
  424. The same can be done for task energy consumption estimation, by setting
  425. the field starpu_codelet::energy_model the same way as the field
  426. starpu_codelet::model. Note: for now, the application has to give to
  427. the energy consumption performance model a name which is different from
  428. the execution time performance model.
  429. The application can request time estimations from the StarPU performance
  430. models by filling a task structure as usual without actually submitting
  431. it. The data handles can be created by calling any of the functions
  432. <c>starpu_*_data_register</c> with a <c>NULL</c> pointer and <c>-1</c>
  433. node and the desired data sizes, and need to be unregistered as usual.
  434. The functions starpu_task_expected_length() and
  435. starpu_task_expected_energy() can then be called to get an estimation
  436. of the task cost on a given arch. starpu_task_footprint() can also be
  437. used to get the footprint used for indexing history-based performance
  438. models. starpu_task_destroy() needs to be called to destroy the dummy
  439. task afterwards. See <c>tests/perfmodels/regression_based.c</c> for an example.
  440. \section DataTrace Data trace and tasks length
  441. It is possible to get statistics about tasks length and data size by using :
  442. \verbatim
  443. $ starpu_fxt_data_trace filename [codelet1 codelet2 ... codeletn]
  444. \endverbatim
  445. Where filename is the FxT trace file and codeletX the names of the codelets you
  446. want to profile (if no names are specified, <c>starpu_fxt_data_trace</c> will profile them all).
  447. This will create a file, <c>data_trace.gp</c> which
  448. can be executed to get a <c>.eps</c> image of these results. On the image, each point represents a
  449. task, and each color corresponds to a codelet.
  450. \image html data_trace.png
  451. \image latex data_trace.eps "" width=\textwidth
  452. */