301_tasks.doxy 21 KB

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