04optimize_performance.doxy 25 KB

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