perf-optimization.texi 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. @c -*-texinfo-*-
  2. @c This file is part of the StarPU Handbook.
  3. @c Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. @c Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
  5. @c Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
  6. @c See the file starpu.texi for copying conditions.
  7. TODO: improve!
  8. @menu
  9. * Data management::
  10. * Task granularity::
  11. * Task submission::
  12. * Task priorities::
  13. * Task scheduling policy::
  14. * Task scheduling contexts::
  15. * Performance model calibration::
  16. * Task distribution vs Data transfer::
  17. * Data prefetch::
  18. * Power-based scheduling::
  19. * Static scheduling::
  20. * Profiling::
  21. * CUDA-specific optimizations::
  22. * Performance debugging::
  23. * Simulated performance::
  24. @end menu
  25. Simply encapsulating application kernels into tasks already permits to
  26. seamlessly support CPU and GPUs at the same time. To achieve good performance, a
  27. few additional changes are needed.
  28. @node Data management
  29. @section Data management
  30. When the application allocates data, whenever possible it should use the
  31. @code{starpu_malloc} function, which will ask CUDA or
  32. OpenCL to make the allocation itself and pin the corresponding allocated
  33. memory. This is needed to permit asynchronous data transfer, i.e. permit data
  34. transfer to overlap with computations. Otherwise, the trace will show that the
  35. @code{DriverCopyAsync} state takes a lot of time, this is because CUDA or OpenCL
  36. then reverts to synchronous transfers.
  37. By default, StarPU leaves replicates of data wherever they were used, in case they
  38. will be re-used by other tasks, thus saving the data transfer time. When some
  39. task modifies some data, all the other replicates are invalidated, and only the
  40. processing unit which ran that task will have a valid replicate of the data. If the application knows
  41. that this data will not be re-used by further tasks, it should advise StarPU to
  42. immediately replicate it to a desired list of memory nodes (given through a
  43. bitmask). This can be understood like the write-through mode of CPU caches.
  44. @cartouche
  45. @smallexample
  46. starpu_data_set_wt_mask(img_handle, 1<<0);
  47. @end smallexample
  48. @end cartouche
  49. will for instance request to always automatically transfer a replicate into the
  50. main memory (node 0), as bit 0 of the write-through bitmask is being set.
  51. @cartouche
  52. @smallexample
  53. starpu_data_set_wt_mask(img_handle, ~0U);
  54. @end smallexample
  55. @end cartouche
  56. will request to always automatically broadcast the updated data to all memory
  57. nodes.
  58. Setting the write-through mask to @code{~0U} can also be useful to make sure all
  59. memory nodes always have a copy of the data, so that it is never evicted when
  60. memory gets scarse.
  61. Implicit data dependency computation can become expensive if a lot
  62. of tasks access the same piece of data. If no dependency is required
  63. on some piece of data (e.g. because it is only accessed in read-only
  64. mode, or because write accesses are actually commutative), use the
  65. @code{starpu_data_set_sequential_consistency_flag} function to disable implicit
  66. dependencies on that data.
  67. In the same vein, accumulation of results in the same data can become a
  68. bottleneck. The use of the @code{STARPU_REDUX} mode permits to optimize such
  69. accumulation (@pxref{Data reduction}).
  70. Applications often need a data just for temporary results. In such a case,
  71. registration can be made without an initial value, for instance this produces a vector data:
  72. @cartouche
  73. @smallexample
  74. starpu_vector_data_register(&handle, -1, 0, n, sizeof(float));
  75. @end smallexample
  76. @end cartouche
  77. StarPU will then allocate the actual buffer only when it is actually needed,
  78. e.g. directly on the GPU without allocating in main memory.
  79. In the same vein, once the temporary results are not useful any more, the
  80. data should be thrown away. If the handle is not to be reused, it can be
  81. unregistered:
  82. @cartouche
  83. @smallexample
  84. starpu_unregister_submit(handle);
  85. @end smallexample
  86. @end cartouche
  87. actual unregistration will be done after all tasks working on the handle
  88. terminate.
  89. If the handle is to be reused, instead of unregistering it, it can simply be invalidated:
  90. @cartouche
  91. @smallexample
  92. starpu_invalidate_submit(handle);
  93. @end smallexample
  94. @end cartouche
  95. the buffers containing the current value will then be freed, and reallocated
  96. only when another task writes some value to the handle.
  97. @node Task granularity
  98. @section Task granularity
  99. Like any other runtime, StarPU has some overhead to manage tasks. Since
  100. it does smart scheduling and data management, that overhead is not always
  101. neglectable. The order of magnitude of the overhead is typically a couple of
  102. microseconds, which is actually quite smaller than the CUDA overhead itself. The
  103. amount of work that a task should do should thus be somewhat
  104. bigger, to make sure that the overhead becomes neglectible. The offline
  105. performance feedback can provide a measure of task length, which should thus be
  106. checked if bad performance are observed. To get a grasp at the scalability
  107. possibility according to task size, one can run
  108. @code{tests/microbenchs/tasks_size_overhead.sh} which draws curves of the
  109. speedup of independent tasks of very small sizes.
  110. The choice of scheduler also has impact over the overhead: for instance, the
  111. @code{dmda} scheduler takes time to make a decision, while @code{eager} does
  112. not. @code{tasks_size_overhead.sh} can again be used to get a grasp at how much
  113. impact that has on the target machine.
  114. @node Task submission
  115. @section Task submission
  116. To let StarPU make online optimizations, tasks should be submitted
  117. asynchronously as much as possible. Ideally, all the tasks should be
  118. submitted, and mere calls to @code{starpu_task_wait_for_all} or
  119. @code{starpu_data_unregister} be done to wait for
  120. termination. StarPU will then be able to rework the whole schedule, overlap
  121. computation with communication, manage accelerator local memory usage, etc.
  122. @node Task priorities
  123. @section Task priorities
  124. By default, StarPU will consider the tasks in the order they are submitted by
  125. the application. If the application programmer knows that some tasks should
  126. be performed in priority (for instance because their output is needed by many
  127. other tasks and may thus be a bottleneck if not executed early enough), the
  128. @code{priority} field of the task structure should be set to transmit the
  129. priority information to StarPU.
  130. @node Task scheduling policy
  131. @section Task scheduling policy
  132. By default, StarPU uses the @code{eager} simple greedy scheduler. This is
  133. because it provides correct load balance even if the application codelets do not
  134. have performance models. If your application codelets have performance models
  135. (@pxref{Performance model example} for examples showing how to do it),
  136. you should change the scheduler thanks to the @code{STARPU_SCHED} environment
  137. variable. For instance @code{export STARPU_SCHED=dmda} . Use @code{help} to get
  138. the list of available schedulers.
  139. The @b{eager} scheduler uses a central task queue, from which workers draw tasks
  140. to work on. This however does not permit to prefetch data since the scheduling
  141. decision is taken late. If a task has a non-0 priority, it is put at the front of the queue.
  142. The @b{prio} scheduler also uses a central task queue, but sorts tasks by
  143. priority (between -5 and 5).
  144. The @b{random} scheduler distributes tasks randomly according to assumed worker
  145. overall performance.
  146. The @b{ws} (work stealing) scheduler schedules tasks on the local worker by
  147. default. When a worker becomes idle, it steals a task from the most loaded
  148. worker.
  149. The @b{dm} (deque model) scheduler uses task execution performance models into account to
  150. perform an HEFT-similar scheduling strategy: it schedules tasks where their
  151. termination time will be minimal.
  152. The @b{dmda} (deque model data aware) scheduler is similar to dm, it also takes
  153. into account data transfer time.
  154. The @b{dmdar} (deque model data aware ready) scheduler is similar to dmda,
  155. it also sorts tasks on per-worker queues by number of already-available data
  156. buffers.
  157. The @b{dmdas} (deque model data aware sorted) scheduler is similar to dmda, it
  158. also supports arbitrary priority values.
  159. The @b{heft} (heterogeneous earliest finish time) scheduler is deprecated. It
  160. is now just an alias for @b{dmda}.
  161. The @b{pheft} (parallel HEFT) scheduler is similar to heft, it also supports
  162. parallel tasks (still experimental).
  163. The @b{peager} (parallel eager) scheduler is similar to eager, it also
  164. supports parallel tasks (still experimental).
  165. @node Task scheduling contexts
  166. @section Task scheduling contexts
  167. Task scheduling contexts represent abstracts sets of workers that allow the programmers to control the distribution of computational resources (i.e. CPUs and
  168. GPUs) to concurrent parallel kernels. The main goal is to minimize interferences between the execution of multiple parallel kernels, by partitioning the underlying pool of workers using contexts.
  169. By default, the application submits tasks to an initial context, which disposes of all the computation ressources available to StarPU (all the workers).
  170. If the application programmer plans to launch several parallel kernels simultaneusly, by default these kernels will be executed within this initial context, using a single scheduler policy(@pxref{Task scheduling policy}).
  171. Meanwhile, if the application programmer is aware of the demands of these kernels and of the specificity of the machine used to execute them, the workers can be divided between several contexts.
  172. These scheduling contexts will isolate the execution of each kernel and they will permit the use of a scheduling policy proper to each one of them.
  173. In order to create the contexts, you have to know the indentifiers of the workers running within StarPU.
  174. By passing a set of workers together with the scheduling policy to the function @code{starpu_sched_ctx_create}, you will get an identifier of the context created which you will use to indicate the context you want to submit the tasks to.
  175. @cartouche
  176. @smallexample
  177. /* @b{the list of ressources the context will manage} */
  178. int workerids[3] = @{1, 3, 10@};
  179. /* @b{indicate the scheduling policy to be used within the context, the list of
  180. workers assigned to it, the number of workers, the name of the context} */
  181. int id_ctx = starpu_sched_ctx_create("heft", workerids, 3, "my_ctx");
  182. /* @b{let StarPU know that the folowing tasks will be submitted to this context} */
  183. starpu_task_set_context(id);
  184. /* @b{submit the task to StarPU} */
  185. starpu_task_submit(task);
  186. @end smallexample
  187. @end cartouche
  188. Note: Parallel greedy and parallel heft scheduling policies do not support the existence of several disjoint contexts on the machine.
  189. Combined workers are constructed depending on the entire topology of the machine, not only the one belonging to a context.
  190. @node Performance model calibration
  191. @section Performance model calibration
  192. Most schedulers are based on an estimation of codelet duration on each kind
  193. of processing unit. For this to be possible, the application programmer needs
  194. to configure a performance model for the codelets of the application (see
  195. @ref{Performance model example} for instance). History-based performance models
  196. use on-line calibration. StarPU will automatically calibrate codelets
  197. which have never been calibrated yet, and save the result in
  198. @code{~/.starpu/sampling/codelets} (@code{$USERPROFILE/.starpu/sampling/codelets} in windows environments)
  199. The models are indexed by machine name. To share the models between machines (e.g. for a homogeneous cluster), use @code{export STARPU_HOSTNAME=some_global_name}. To force continuing calibration, use
  200. @code{export STARPU_CALIBRATE=1} . This may be necessary if your application
  201. has not-so-stable performance. StarPU will force calibration (and thus ignore
  202. the current result) until 10 (_STARPU_CALIBRATION_MINIMUM) measurements have been
  203. made on each architecture, to avoid badly scheduling tasks just because the
  204. first measurements were not so good. Details on the current performance model status
  205. can be obtained from the @code{starpu_perfmodel_display} command: the @code{-l}
  206. option lists the available performance models, and the @code{-s} option permits
  207. to choose the performance model to be displayed. The result looks like:
  208. @example
  209. $ starpu_perfmodel_display -s starpu_dlu_lu_model_22
  210. performance model for cpu
  211. # hash size mean dev n
  212. 880805ba 98304 2.731309e+02 6.010210e+01 1240
  213. b50b6605 393216 1.469926e+03 1.088828e+02 1240
  214. 5c6c3401 1572864 1.125983e+04 3.265296e+03 1240
  215. @end example
  216. Which shows that for the LU 22 kernel with a 1.5MiB matrix, the average
  217. execution time on CPUs was about 11ms, with a 3ms standard deviation, over
  218. 1240 samples. It is a good idea to check this before doing actual performance
  219. measurements.
  220. A graph can be drawn by using the @code{starpu_perfmodel_plot}:
  221. @example
  222. $ starpu_perfmodel_plot -s starpu_dlu_lu_model_22
  223. 98304 393216 1572864
  224. $ gnuplot starpu_starpu_dlu_lu_model_22.gp
  225. $ gv starpu_starpu_dlu_lu_model_22.eps
  226. @end example
  227. If a kernel source code was modified (e.g. performance improvement), the
  228. calibration information is stale and should be dropped, to re-calibrate from
  229. start. This can be done by using @code{export STARPU_CALIBRATE=2}.
  230. Note: due to CUDA limitations, to be able to measure kernel duration,
  231. calibration mode needs to disable asynchronous data transfers. Calibration thus
  232. disables data transfer / computation overlapping, and should thus not be used
  233. for eventual benchmarks. Note 2: history-based performance models get calibrated
  234. only if a performance-model-based scheduler is chosen.
  235. The history-based performance models can also be explicitly filled by the
  236. application without execution, if e.g. the application already has a series of
  237. measurements. This can be done by using @code{starpu_perfmodel_update_history},
  238. for instance:
  239. @cartouche
  240. @smallexample
  241. static struct starpu_perfmodel perf_model = @{
  242. .type = STARPU_HISTORY_BASED,
  243. .symbol = "my_perfmodel",
  244. @};
  245. struct starpu_codelet cl = @{
  246. .where = STARPU_CUDA,
  247. .cuda_funcs = @{ cuda_func1, cuda_func2, NULL @},
  248. .nbuffers = 1,
  249. .modes = @{STARPU_W@},
  250. .model = &perf_model
  251. @};
  252. void feed(void) @{
  253. struct my_measure *measure;
  254. struct starpu_task task;
  255. starpu_task_init(&task);
  256. task.cl = &cl;
  257. for (measure = &measures[0]; measure < measures[last]; measure++) @{
  258. starpu_data_handle_t handle;
  259. starpu_vector_data_register(&handle, -1, 0, measure->size, sizeof(float));
  260. task.handles[0] = handle;
  261. starpu_perfmodel_update_history(&perf_model, &task,
  262. STARPU_CUDA_DEFAULT + measure->cudadev, 0,
  263. measure->implementation, measure->time);
  264. starpu_task_clean(&task);
  265. starpu_data_unregister(handle);
  266. @}
  267. @}
  268. @end smallexample
  269. @end cartouche
  270. Measurement has to be provided in milliseconds for the completion time models,
  271. and in Joules for the energy consumption models.
  272. @node Task distribution vs Data transfer
  273. @section Task distribution vs Data transfer
  274. Distributing tasks to balance the load induces data transfer penalty. StarPU
  275. thus needs to find a balance between both. The target function that the
  276. @code{dmda} scheduler of StarPU
  277. tries to minimize is @code{alpha * T_execution + beta * T_data_transfer}, where
  278. @code{T_execution} is the estimated execution time of the codelet (usually
  279. accurate), and @code{T_data_transfer} is the estimated data transfer time. The
  280. latter is estimated based on bus calibration before execution start,
  281. i.e. with an idle machine, thus without contention. You can force bus re-calibration by running
  282. @code{starpu_calibrate_bus}. The beta parameter defaults to 1, but it can be
  283. worth trying to tweak it by using @code{export STARPU_SCHED_BETA=2} for instance,
  284. since during real application execution, contention makes transfer times bigger.
  285. This is of course imprecise, but in practice, a rough estimation already gives
  286. the good results that a precise estimation would give.
  287. @node Data prefetch
  288. @section Data prefetch
  289. The @code{heft}, @code{dmda} and @code{pheft} scheduling policies perform data prefetch (see @ref{STARPU_PREFETCH}):
  290. as soon as a scheduling decision is taken for a task, requests are issued to
  291. transfer its required data to the target processing unit, if needeed, so that
  292. when the processing unit actually starts the task, its data will hopefully be
  293. already available and it will not have to wait for the transfer to finish.
  294. The application may want to perform some manual prefetching, for several reasons
  295. such as excluding initial data transfers from performance measurements, or
  296. setting up an initial statically-computed data distribution on the machine
  297. before submitting tasks, which will thus guide StarPU toward an initial task
  298. distribution (since StarPU will try to avoid further transfers).
  299. This can be achieved by giving the @code{starpu_data_prefetch_on_node} function
  300. the handle and the desired target memory node.
  301. @node Power-based scheduling
  302. @section Power-based scheduling
  303. If the application can provide some power performance model (through
  304. the @code{power_model} field of the codelet structure), StarPU will
  305. take it into account when distributing tasks. The target function that
  306. the @code{dmda} scheduler minimizes becomes @code{alpha * T_execution +
  307. beta * T_data_transfer + gamma * Consumption} , where @code{Consumption}
  308. is the estimated task consumption in Joules. To tune this parameter, use
  309. @code{export STARPU_SCHED_GAMMA=3000} for instance, to express that each Joule
  310. (i.e kW during 1000us) is worth 3000us execution time penalty. Setting
  311. @code{alpha} and @code{beta} to zero permits to only take into account power consumption.
  312. This is however not sufficient to correctly optimize power: the scheduler would
  313. simply tend to run all computations on the most energy-conservative processing
  314. unit. To account for the consumption of the whole machine (including idle
  315. processing units), the idle power of the machine should be given by setting
  316. @code{export STARPU_IDLE_POWER=200} for 200W, for instance. This value can often
  317. be obtained from the machine power supplier.
  318. The power actually consumed by the total execution can be displayed by setting
  319. @code{export STARPU_PROFILING=1 STARPU_WORKER_STATS=1} .
  320. On-line task consumption measurement is currently only supported through the
  321. @code{CL_PROFILING_POWER_CONSUMED} OpenCL extension, implemented in the MoviSim
  322. simulator. Applications can however provide explicit measurements by using the
  323. @code{starpu_perfmodel_update_history} function (examplified in @ref{Performance
  324. model example} with the @code{power_model} performance model. Fine-grain
  325. measurement is often not feasible with the feedback provided by the hardware, so
  326. the user can for instance run a given task a thousand times, measure the global
  327. consumption for that series of tasks, divide it by a thousand, repeat for
  328. varying kinds of tasks and task sizes, and eventually feed StarPU
  329. with these manual measurements through @code{starpu_perfmodel_update_history}.
  330. @node Static scheduling
  331. @section Static scheduling
  332. In some cases, one may want to force some scheduling, for instance force a given
  333. set of tasks to GPU0, another set to GPU1, etc. while letting some other tasks
  334. be scheduled on any other device. This can indeed be useful to guide StarPU into
  335. some work distribution, while still letting some degree of dynamism. For
  336. instance, to force execution of a task on CUDA0:
  337. @cartouche
  338. @smallexample
  339. task->execute_on_a_specific_worker = 1;
  340. task->worker = starpu_worker_get_by_type(STARPU_CUDA_WORKER, 0);
  341. @end smallexample
  342. @end cartouche
  343. @node Profiling
  344. @section Profiling
  345. A quick view of how many tasks each worker has executed can be obtained by setting
  346. @code{export STARPU_WORKER_STATS=1} This is a convenient way to check that
  347. execution did happen on accelerators without penalizing performance with
  348. the profiling overhead.
  349. A quick view of how much data transfers have been issued can be obtained by setting
  350. @code{export STARPU_BUS_STATS=1} .
  351. More detailed profiling information can be enabled by using @code{export STARPU_PROFILING=1} or by
  352. calling @code{starpu_profiling_status_set} from the source code.
  353. Statistics on the execution can then be obtained by using @code{export
  354. STARPU_BUS_STATS=1} and @code{export STARPU_WORKER_STATS=1} .
  355. More details on performance feedback are provided by the next chapter.
  356. @node CUDA-specific optimizations
  357. @section CUDA-specific optimizations
  358. Due to CUDA limitations, StarPU will have a hard time overlapping its own
  359. communications and the codelet computations if the application does not use a
  360. dedicated CUDA stream for its computations. StarPU provides one by the use of
  361. @code{starpu_cuda_get_local_stream()} which should be used by all CUDA codelet
  362. operations. For instance:
  363. @cartouche
  364. @smallexample
  365. func <<<grid,block,0,starpu_cuda_get_local_stream()>>> (foo, bar);
  366. cudaStreamSynchronize(starpu_cuda_get_local_stream());
  367. @end smallexample
  368. @end cartouche
  369. StarPU already does appropriate calls for the CUBLAS library.
  370. Unfortunately, some CUDA libraries do not have stream variants of
  371. kernels. That will lower the potential for overlapping.
  372. @node Performance debugging
  373. @section Performance debugging
  374. To get an idea of what is happening, a lot of performance feedback is available,
  375. detailed in the next chapter. The various informations should be checked for.
  376. @itemize
  377. @item What does the Gantt diagram look like? (see @ref{Gantt diagram})
  378. @itemize
  379. @item If it's mostly green (tasks running in the initial context) or context specific
  380. color prevailing, then the machine is properly
  381. utilized, and perhaps the codelets are just slow. Check their performance, see
  382. @ref{Codelet performance}.
  383. @item If it's mostly purple (FetchingInput), tasks keep waiting for data
  384. transfers, do you perhaps have far more communication than computation? Did
  385. you properly use CUDA streams to make sure communication can be
  386. overlapped? Did you use data-locality aware schedulers to avoid transfers as
  387. much as possible?
  388. @item If it's mostly red (Blocked), tasks keep waiting for dependencies,
  389. do you have enough parallelism? It might be a good idea to check what the DAG
  390. looks like (see @ref{DAG}).
  391. @item If only some workers are completely red (Blocked), for some reason the
  392. scheduler didn't assign tasks to them. Perhaps the performance model is bogus,
  393. check it (see @ref{Codelet performance}). Do all your codelets have a
  394. performance model? When some of them don't, the schedulers switches to a
  395. greedy algorithm which thus performs badly.
  396. @end itemize
  397. @end itemize
  398. You can also use the Temanejo task debugger (see @ref{Task debugger}) to
  399. visualize the task graph more easily.
  400. @node Simulated performance
  401. @section Simulated performance
  402. StarPU can use Simgrid in order to simulate execution on an arbitrary
  403. platform. The idea is to first compile StarPU normally, and run the application,
  404. so as to automatically benchmark the bus and the codelets.
  405. @smallexample
  406. $ ./configure && make
  407. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  408. [starpu][_starpu_load_history_based_model] Warning: model matvecmult
  409. is not calibrated, forcing calibration for this run. Use the
  410. STARPU_CALIBRATE environment variable to control this.
  411. $ ...
  412. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  413. TEST PASSED
  414. @end smallexample
  415. Note that we force to use the dmda scheduler to generate performance
  416. models for the application. The application may need to be run several
  417. times before the model is calibrated.
  418. Then, recompile StarPU, passing @code{--enable-simgrid} to @code{./configure}, and re-run the
  419. application, specifying the requested number of devices:
  420. @smallexample
  421. $ ./configure --enable-simgrid && make
  422. $ STARPU_SCHED=dmda STARPU_NCPU=12 STARPU_NCUDA=0 STARPU_NOPENCL=1 ./examples/matvecmult/matvecmult
  423. TEST FAILED !!!
  424. @end smallexample
  425. It is normal that the test fails: since the computation are not actually done
  426. (that is the whole point of simgrid), the result is wrong, of course.
  427. If the performance model is not calibrated enough, the following error
  428. message will be displayed
  429. @smallexample
  430. $ STARPU_SCHED=dmda STARPU_NCPU=12 STARPU_NCUDA=0 STARPU_NOPENCL=1 ./examples/matvecmult/matvecmult
  431. [0.000000] [xbt_cfg/INFO] type in variable = 2
  432. [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
  433. [starpu][_starpu_load_history_based_model] Warning: model matvecmult
  434. is not calibrated, forcing calibration for this run. Use the
  435. STARPU_CALIBRATE environment variable to control this.
  436. [starpu][_starpu_simgrid_execute_job][assert failure] Codelet
  437. matvecmult does not have a perfmodel, or is not calibrated enough
  438. @end smallexample
  439. For now, only the number of cpus can be arbitrarily chosen. The number of CUDA
  440. and OpenCL devices have to be lower than the real number on the current machine.
  441. The Simgrid default stack size is small, to increase it use the
  442. parameter @code{--cfg=contexts/stack_size}, for example:
  443. @smallexample
  444. $ STARPU_NCPU=12 STARPU_NCUDA=2 STARPU_NOPENCL=0 ./example --cfg=contexts/stack_size:8192
  445. [0.000000] [xbt_cfg/INFO] type in variable = 2
  446. [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
  447. TEST FAILED !!!
  448. @end smallexample
  449. Note: of course, if the application uses @code{gettimeofday} to make its
  450. performance measurements, the real time will be used, which will be bogus. To
  451. get the simulated time, it has to use @code{starpu_timing_now} which returns the
  452. virtual timestamp in ms.