06tasks.doxy 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \page TasksInStarPU Tasks In StarPU
  9. \section TaskGranularity Task Granularity
  10. Like any other runtime, StarPU has some overhead to manage tasks. Since
  11. it does smart scheduling and data management, that overhead is not always
  12. neglectable. The order of magnitude of the overhead is typically a couple of
  13. microseconds, which is actually quite smaller than the CUDA overhead itself. The
  14. amount of work that a task should do should thus be somewhat
  15. bigger, to make sure that the overhead becomes neglectible. The offline
  16. performance feedback can provide a measure of task length, which should thus be
  17. checked if bad performance are observed. To get a grasp at the scalability
  18. possibility according to task size, one can run
  19. <c>tests/microbenchs/tasks_size_overhead.sh</c> which draws curves of the
  20. speedup of independent tasks of very small sizes.
  21. The choice of scheduler also has impact over the overhead: for instance, the
  22. scheduler <c>dmda</c> takes time to make a decision, while <c>eager</c> does
  23. not. <c>tasks_size_overhead.sh</c> can again be used to get a grasp at how much
  24. impact that has on the target machine.
  25. \section TaskSubmission Task Submission
  26. To let StarPU make online optimizations, tasks should be submitted
  27. asynchronously as much as possible. Ideally, all the tasks should be
  28. submitted, and mere calls to starpu_task_wait_for_all() or
  29. starpu_data_unregister() be done to wait for
  30. termination. StarPU will then be able to rework the whole schedule, overlap
  31. computation with communication, manage accelerator local memory usage, etc.
  32. \section TaskPriorities Task Priorities
  33. By default, StarPU will consider the tasks in the order they are submitted by
  34. the application. If the application programmer knows that some tasks should
  35. be performed in priority (for instance because their output is needed by many
  36. other tasks and may thus be a bottleneck if not executed early
  37. enough), the field starpu_task::priority should be set to transmit the
  38. priority information to StarPU.
  39. \section SettingManyDataHandlesForATask Setting Many Data Handles For a Task
  40. The maximum number of data a task can manage is fixed by the environment variable
  41. \ref STARPU_NMAXBUFS which has a default value which can be changed
  42. through the configure option \ref enable-maxbuffers "--enable-maxbuffers".
  43. However, it is possible to define tasks managing more data by using
  44. the field starpu_task::dyn_handles when defining a task and the field
  45. starpu_codelet::dyn_modes when defining the corresponding codelet.
  46. \code{.c}
  47. enum starpu_data_access_mode modes[STARPU_NMAXBUFS+1] = {
  48. STARPU_R, STARPU_R, ...
  49. };
  50. struct starpu_codelet dummy_big_cl =
  51. {
  52. .cuda_funcs = { dummy_big_kernel },
  53. .opencl_funcs = { dummy_big_kernel },
  54. .cpu_funcs = { dummy_big_kernel },
  55. .cpu_funcs_name = { "dummy_big_kernel" },
  56. .nbuffers = STARPU_NMAXBUFS+1,
  57. .dyn_modes = modes
  58. };
  59. task = starpu_task_create();
  60. task->cl = &dummy_big_cl;
  61. task->dyn_handles = malloc(task->cl->nbuffers * sizeof(starpu_data_handle_t));
  62. for(i=0 ; i<task->cl->nbuffers ; i++)
  63. {
  64. task->dyn_handles[i] = handle;
  65. }
  66. starpu_task_submit(task);
  67. \endcode
  68. \code{.c}
  69. starpu_data_handle_t *handles = malloc(dummy_big_cl.nbuffers * sizeof(starpu_data_handle_t));
  70. for(i=0 ; i<dummy_big_cl.nbuffers ; i++)
  71. {
  72. handles[i] = handle;
  73. }
  74. starpu_task_insert(&dummy_big_cl,
  75. STARPU_VALUE, &dummy_big_cl.nbuffers, sizeof(dummy_big_cl.nbuffers),
  76. STARPU_DATA_ARRAY, handles, dummy_big_cl.nbuffers,
  77. 0);
  78. \endcode
  79. The whole code for this complex data interface is available in the
  80. directory <c>examples/basic_examples/dynamic_handles.c</c>.
  81. \section SettingVariableDataHandlesForATask Setting a Variable number Data Handles For a Task
  82. Normally, the number of data handles given to a task is fixed in the
  83. starpu_codelet::nbuffers codelet field. This field can however be set to
  84. STARPU_VARIABLE_NBUFFERS, in which case the starpu_task::nbuffers task field
  85. must be set, and the starpu_task::modes field (or starpu_task_dyn_modes field,
  86. see \ref SettingManyDataHandlesForATask) should be used to specify the modes for
  87. the handles.
  88. \section UsingMultipleImplementationsOfACodelet Using Multiple Implementations Of A Codelet
  89. One may want to write multiple implementations of a codelet for a single type of
  90. device and let StarPU choose which one to run. As an example, we will show how
  91. to use SSE to scale a vector. The codelet can be written as follows:
  92. \code{.c}
  93. #include <xmmintrin.h>
  94. void scal_sse_func(void *buffers[], void *cl_arg)
  95. {
  96. float *vector = (float *) STARPU_VECTOR_GET_PTR(buffers[0]);
  97. unsigned int n = STARPU_VECTOR_GET_NX(buffers[0]);
  98. unsigned int n_iterations = n/4;
  99. if (n % 4 != 0)
  100. n_iterations++;
  101. __m128 *VECTOR = (__m128*) vector;
  102. __m128 factor __attribute__((aligned(16)));
  103. factor = _mm_set1_ps(*(float *) cl_arg);
  104. unsigned int i;
  105. for (i = 0; i < n_iterations; i++)
  106. VECTOR[i] = _mm_mul_ps(factor, VECTOR[i]);
  107. }
  108. \endcode
  109. \code{.c}
  110. struct starpu_codelet cl = {
  111. .cpu_funcs = { scal_cpu_func, scal_sse_func },
  112. .cpu_funcs_name = { "scal_cpu_func", "scal_sse_func" },
  113. .nbuffers = 1,
  114. .modes = { STARPU_RW }
  115. };
  116. \endcode
  117. Schedulers which are multi-implementation aware (only <c>dmda</c> and
  118. <c>pheft</c> for now) will use the performance models of all the
  119. implementations it was given, and pick the one that seems to be the fastest.
  120. \section EnablingImplementationAccordingToCapabilities Enabling Implementation According To Capabilities
  121. Some implementations may not run on some devices. For instance, some CUDA
  122. devices do not support double floating point precision, and thus the kernel
  123. execution would just fail; or the device may not have enough shared memory for
  124. the implementation being used. The field starpu_codelet::can_execute
  125. permits to express this. For instance:
  126. \code{.c}
  127. static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
  128. {
  129. const struct cudaDeviceProp *props;
  130. if (starpu_worker_get_type(workerid) == STARPU_CPU_WORKER)
  131. return 1;
  132. /* Cuda device */
  133. props = starpu_cuda_get_device_properties(workerid);
  134. if (props->major >= 2 || props->minor >= 3)
  135. /* At least compute capability 1.3, supports doubles */
  136. return 1;
  137. /* Old card, does not support doubles */
  138. return 0;
  139. }
  140. struct starpu_codelet cl = {
  141. .can_execute = can_execute,
  142. .cpu_funcs = { cpu_func },
  143. .cpu_funcs_name = { "cpu_func" },
  144. .cuda_funcs = { gpu_func }
  145. .nbuffers = 1,
  146. .modes = { STARPU_RW }
  147. };
  148. \endcode
  149. This can be essential e.g. when running on a machine which mixes various models
  150. of CUDA devices, to take benefit from the new models without crashing on old models.
  151. Note: the function starpu_codelet::can_execute is called by the
  152. scheduler each time it tries to match a task with a worker, and should
  153. thus be very fast. The function starpu_cuda_get_device_properties()
  154. provides a quick access to CUDA properties of CUDA devices to achieve
  155. such efficiency.
  156. Another example is to compile CUDA code for various compute capabilities,
  157. resulting with two CUDA functions, e.g. <c>scal_gpu_13</c> for compute capability
  158. 1.3, and <c>scal_gpu_20</c> for compute capability 2.0. Both functions can be
  159. provided to StarPU by using starpu_codelet::cuda_funcs, and
  160. starpu_codelet::can_execute can then be used to rule out the
  161. <c>scal_gpu_20</c> variant on a CUDA device which will not be able to execute it:
  162. \code{.c}
  163. static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
  164. {
  165. const struct cudaDeviceProp *props;
  166. if (starpu_worker_get_type(workerid) == STARPU_CPU_WORKER)
  167. return 1;
  168. /* Cuda device */
  169. if (nimpl == 0)
  170. /* Trying to execute the 1.3 capability variant, we assume it is ok in all cases. */
  171. return 1;
  172. /* Trying to execute the 2.0 capability variant, check that the card can do it. */
  173. props = starpu_cuda_get_device_properties(workerid);
  174. if (props->major >= 2 || props->minor >= 0)
  175. /* At least compute capability 2.0, can run it */
  176. return 1;
  177. /* Old card, does not support 2.0, will not be able to execute the 2.0 variant. */
  178. return 0;
  179. }
  180. struct starpu_codelet cl = {
  181. .can_execute = can_execute,
  182. .cpu_funcs = { cpu_func },
  183. .cpu_funcs_name = { "cpu_func" },
  184. .cuda_funcs = { scal_gpu_13, scal_gpu_20 },
  185. .nbuffers = 1,
  186. .modes = { STARPU_RW }
  187. };
  188. \endcode
  189. Another example is having specialized implementations for some given common
  190. sizes, for instance here we have a specialized implementation for 1024x1024
  191. matrices:
  192. \code{.c}
  193. static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
  194. {
  195. const struct cudaDeviceProp *props;
  196. if (starpu_worker_get_type(workerid) == STARPU_CPU_WORKER)
  197. return 1;
  198. /* Cuda device */
  199. switch (nimpl)
  200. {
  201. case 0:
  202. /* Trying to execute the generic capability variant. */
  203. return 1;
  204. case 1:
  205. {
  206. /* Trying to execute the size == 1024 specific variant. */
  207. struct starpu_matrix_interface *interface = starpu_data_get_interface_on_node(task->handles[0]);
  208. return STARPU_MATRIX_GET_NX(interface) == 1024 && STARPU_MATRIX_GET_NY(interface == 1024);
  209. }
  210. }
  211. }
  212. struct starpu_codelet cl = {
  213. .can_execute = can_execute,
  214. .cpu_funcs = { cpu_func },
  215. .cpu_funcs_name = { "cpu_func" },
  216. .cuda_funcs = { potrf_gpu_generic, potrf_gpu_1024 },
  217. .nbuffers = 1,
  218. .modes = { STARPU_RW }
  219. };
  220. \endcode
  221. Note: the most generic variant should be provided first, as some schedulers are
  222. not able to try the different variants.
  223. \section InsertTaskUtility Insert Task Utility
  224. StarPU provides the wrapper function starpu_task_insert() to ease
  225. the creation and submission of tasks.
  226. Here the implementation of the codelet:
  227. \code{.c}
  228. void func_cpu(void *descr[], void *_args)
  229. {
  230. int *x0 = (int *)STARPU_VARIABLE_GET_PTR(descr[0]);
  231. float *x1 = (float *)STARPU_VARIABLE_GET_PTR(descr[1]);
  232. int ifactor;
  233. float ffactor;
  234. starpu_codelet_unpack_args(_args, &ifactor, &ffactor);
  235. *x0 = *x0 * ifactor;
  236. *x1 = *x1 * ffactor;
  237. }
  238. struct starpu_codelet mycodelet = {
  239. .cpu_funcs = { func_cpu },
  240. .cpu_funcs_name = { "func_cpu" },
  241. .nbuffers = 2,
  242. .modes = { STARPU_RW, STARPU_RW }
  243. };
  244. \endcode
  245. And the call to the function starpu_task_insert():
  246. \code{.c}
  247. starpu_task_insert(&mycodelet,
  248. STARPU_VALUE, &ifactor, sizeof(ifactor),
  249. STARPU_VALUE, &ffactor, sizeof(ffactor),
  250. STARPU_RW, data_handles[0], STARPU_RW, data_handles[1],
  251. 0);
  252. \endcode
  253. The call to starpu_task_insert() is equivalent to the following
  254. code:
  255. \code{.c}
  256. struct starpu_task *task = starpu_task_create();
  257. task->cl = &mycodelet;
  258. task->handles[0] = data_handles[0];
  259. task->handles[1] = data_handles[1];
  260. char *arg_buffer;
  261. size_t arg_buffer_size;
  262. starpu_codelet_pack_args(&arg_buffer, &arg_buffer_size,
  263. STARPU_VALUE, &ifactor, sizeof(ifactor),
  264. STARPU_VALUE, &ffactor, sizeof(ffactor),
  265. 0);
  266. task->cl_arg = arg_buffer;
  267. task->cl_arg_size = arg_buffer_size;
  268. int ret = starpu_task_submit(task);
  269. \endcode
  270. Here a similar call using ::STARPU_DATA_ARRAY.
  271. \code{.c}
  272. starpu_task_insert(&mycodelet,
  273. STARPU_DATA_ARRAY, data_handles, 2,
  274. STARPU_VALUE, &ifactor, sizeof(ifactor),
  275. STARPU_VALUE, &ffactor, sizeof(ffactor),
  276. 0);
  277. \endcode
  278. If some part of the task insertion depends on the value of some computation,
  279. the macro ::STARPU_DATA_ACQUIRE_CB can be very convenient. For
  280. instance, assuming that the index variable <c>i</c> was registered as handle
  281. <c>A_handle[i]</c>:
  282. \code{.c}
  283. /* Compute which portion we will work on, e.g. pivot */
  284. starpu_task_insert(&which_index, STARPU_W, i_handle, 0);
  285. /* And submit the corresponding task */
  286. STARPU_DATA_ACQUIRE_CB(i_handle, STARPU_R,
  287. starpu_task_insert(&work, STARPU_RW, A_handle[i], 0));
  288. \endcode
  289. The macro ::STARPU_DATA_ACQUIRE_CB submits an asynchronous request for
  290. acquiring data <c>i</c> for the main application, and will execute the code
  291. given as third parameter when it is acquired. In other words, as soon as the
  292. value of <c>i</c> computed by the codelet <c>which_index</c> can be read, the
  293. portion of code passed as third parameter of ::STARPU_DATA_ACQUIRE_CB will
  294. be executed, and is allowed to read from <c>i</c> to use it e.g. as an
  295. index. Note that this macro is only avaible when compiling StarPU with
  296. the compiler <c>gcc</c>.
  297. There is several ways of calling the function starpu_codelet_unpack_args().
  298. \code{.c}
  299. void func_cpu(void *descr[], void *_args)
  300. {
  301. int ifactor;
  302. float ffactor;
  303. starpu_codelet_unpack_args(_args, &ifactor, &ffactor);
  304. }
  305. \endcode
  306. \code{.c}
  307. void func_cpu(void *descr[], void *_args)
  308. {
  309. int ifactor;
  310. float ffactor;
  311. starpu_codelet_unpack_args(_args, &ifactor, NULL);
  312. starpu_codelet_unpack_args(_args, &ifactor, &ffactor);
  313. }
  314. \endcode
  315. \code{.c}
  316. void func_cpu(void *descr[], void *_args)
  317. {
  318. int ifactor;
  319. float ffactor;
  320. char buffer[100];
  321. starpu_codelet_unpack_args_and_copyleft(_args, buffer, 100, &ifactor, NULL);
  322. starpu_codelet_unpack_args(buffer, &ffactor);
  323. }
  324. \endcode
  325. \section GettingTaskChildren Getting Task Children
  326. It may be interesting to get the list of tasks which depend on a given task,
  327. notably when using implicit dependencies, since this list is computed by StarPU.
  328. starpu_task_get_task_succs() provides it. For instance:
  329. \code{.c}
  330. struct starpu_task *tasks[4];
  331. ret = starpu_task_get_task_succs(task, sizeof(tasks)/sizeof(*tasks), tasks);
  332. \endcode
  333. \section ParallelTasks Parallel Tasks
  334. StarPU can leverage existing parallel computation libraries by the means of
  335. parallel tasks. A parallel task is a task which gets worked on by a set of CPUs
  336. (called a parallel or combined worker) at the same time, by using an existing
  337. parallel CPU implementation of the computation to be achieved. This can also be
  338. useful to improve the load balance between slow CPUs and fast GPUs: since CPUs
  339. work collectively on a single task, the completion time of tasks on CPUs become
  340. comparable to the completion time on GPUs, thus relieving from granularity
  341. discrepancy concerns. <c>hwloc</c> support needs to be enabled to get
  342. good performance, otherwise StarPU will not know how to better group
  343. cores.
  344. Two modes of execution exist to accomodate with existing usages.
  345. \subsection Fork-modeParallelTasks Fork-mode Parallel Tasks
  346. In the Fork mode, StarPU will call the codelet function on one
  347. of the CPUs of the combined worker. The codelet function can use
  348. starpu_combined_worker_get_size() to get the number of threads it is
  349. allowed to start to achieve the computation. The CPU binding mask for the whole
  350. set of CPUs is already enforced, so that threads created by the function will
  351. inherit the mask, and thus execute where StarPU expected, the OS being in charge
  352. of choosing how to schedule threads on the corresponding CPUs. The application
  353. can also choose to bind threads by hand, using e.g. sched_getaffinity to know
  354. the CPU binding mask that StarPU chose.
  355. For instance, using OpenMP (full source is available in
  356. <c>examples/openmp/vector_scal.c</c>):
  357. \snippet forkmode.c To be included. You should update doxygen if you see this text.
  358. Other examples include for instance calling a BLAS parallel CPU implementation
  359. (see <c>examples/mult/xgemm.c</c>).
  360. \subsection SPMD-modeParallelTasks SPMD-mode Parallel Tasks
  361. In the SPMD mode, StarPU will call the codelet function on
  362. each CPU of the combined worker. The codelet function can use
  363. starpu_combined_worker_get_size() to get the total number of CPUs
  364. involved in the combined worker, and thus the number of calls that are made in
  365. parallel to the function, and starpu_combined_worker_get_rank() to get
  366. the rank of the current CPU within the combined worker. For instance:
  367. \code{.c}
  368. static void func(void *buffers[], void *args)
  369. {
  370. unsigned i;
  371. float *factor = _args;
  372. struct starpu_vector_interface *vector = buffers[0];
  373. unsigned n = STARPU_VECTOR_GET_NX(vector);
  374. float *val = (float *)STARPU_VECTOR_GET_PTR(vector);
  375. /* Compute slice to compute */
  376. unsigned m = starpu_combined_worker_get_size();
  377. unsigned j = starpu_combined_worker_get_rank();
  378. unsigned slice = (n+m-1)/m;
  379. for (i = j * slice; i < (j+1) * slice && i < n; i++)
  380. val[i] *= *factor;
  381. }
  382. static struct starpu_codelet cl =
  383. {
  384. .modes = { STARPU_RW },
  385. .type = STARPU_SPMD,
  386. .max_parallelism = INT_MAX,
  387. .cpu_funcs = { func },
  388. .cpu_funcs_name = { "func" },
  389. .nbuffers = 1,
  390. }
  391. \endcode
  392. Of course, this trivial example will not really benefit from parallel task
  393. execution, and was only meant to be simple to understand. The benefit comes
  394. when the computation to be done is so that threads have to e.g. exchange
  395. intermediate results, or write to the data in a complex but safe way in the same
  396. buffer.
  397. \subsection ParallelTasksPerformance Parallel Tasks Performance
  398. To benefit from parallel tasks, a parallel-task-aware StarPU scheduler has to
  399. be used. When exposed to codelets with a flag ::STARPU_FORKJOIN or
  400. ::STARPU_SPMD, the schedulers <c>pheft</c> (parallel-heft) and <c>peager</c>
  401. (parallel eager) will indeed also try to execute tasks with
  402. several CPUs. It will automatically try the various available combined
  403. worker sizes (making several measurements for each worker size) and
  404. thus be able to avoid choosing a large combined worker if the codelet
  405. does not actually scale so much.
  406. \subsection CombinedWorkers Combined Workers
  407. By default, StarPU creates combined workers according to the architecture
  408. structure as detected by <c>hwloc</c>. It means that for each object of the <c>hwloc</c>
  409. topology (NUMA node, socket, cache, ...) a combined worker will be created. If
  410. some nodes of the hierarchy have a big arity (e.g. many cores in a socket
  411. without a hierarchy of shared caches), StarPU will create combined workers of
  412. intermediate sizes. The variable \ref
  413. STARPU_SYNTHESIZE_ARITY_COMBINED_WORKER permits to tune the maximum
  414. arity between levels of combined workers.
  415. The combined workers actually produced can be seen in the output of the
  416. tool <c>starpu_machine_display</c> (the environment variable \ref
  417. STARPU_SCHED has to be set to a combined worker-aware scheduler such
  418. as <c>pheft</c> or <c>peager</c>).
  419. \subsection ConcurrentParallelTasks Concurrent Parallel Tasks
  420. Unfortunately, many environments and librairies do not support concurrent
  421. calls.
  422. For instance, most OpenMP implementations (including the main ones) do not
  423. support concurrent <c>pragma omp parallel</c> statements without nesting them in
  424. another <c>pragma omp parallel</c> statement, but StarPU does not yet support
  425. creating its CPU workers by using such pragma.
  426. Other parallel libraries are also not safe when being invoked concurrently
  427. from different threads, due to the use of global variables in their sequential
  428. sections for instance.
  429. The solution is then to use only one combined worker at a time. This can be
  430. done by setting the field starpu_conf::single_combined_worker to <c>1</c>, or
  431. setting the environment variable \ref STARPU_SINGLE_COMBINED_WORKER
  432. to <c>1</c>. StarPU will then run only one parallel task at a time (but other
  433. CPU and GPU tasks are not affected and can be run concurrently). The parallel
  434. task scheduler will however still however still try varying combined worker
  435. sizes to look for the most efficient ones.
  436. \subsection SynchronizationTasks Synchronization tasks
  437. For the application conveniency, it may be useful to define tasks which do not
  438. actually make any computation, but wear for instance dependencies between other
  439. tasks or tags, or to be submitted in callbacks, etc.
  440. The obvious way is of course to make kernel functions empty, but such task will
  441. thus have to wait for a worker to become ready, transfer data, etc.
  442. A much lighter way to define a synchronization task is to set its <c>cl</c>
  443. field to <c>NULL</c>. The task will thus be a mere synchronization point,
  444. without any data access or execution content: as soon as its dependencies become
  445. available, it will terminate, call the callbacks, and release dependencies.
  446. An intermediate solution is to define a codelet with its <c>where</c> field set
  447. to STARPU_NOWHERE, for instance this:
  448. \code{.c}
  449. struct starpu_codelet {
  450. .where = STARPU_NOWHERE,
  451. .nbuffers = 1,
  452. .modes = { STARPU_R },
  453. }
  454. task = starpu_task_create();
  455. task->cl = starpu_codelet;
  456. task->handles[0] = handle;
  457. starpu_task_submit(task);
  458. \endcode
  459. will create a task which simply waits for the value of <c>handle</c> to be
  460. available for read. This task can then be depended on, etc.
  461. */