370_online_performance_tools.doxy 23 KB

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