starpu.texi 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. \input texinfo @c -*-texinfo-*-
  2. @c %**start of header
  3. @setfilename starpu.info
  4. @settitle StarPU
  5. @c %**end of header
  6. @setchapternewpage odd
  7. @titlepage
  8. @title StarPU
  9. @page
  10. @vskip 0pt plus 1filll
  11. @comment For the @value{version-GCC} Version*
  12. @end titlepage
  13. @summarycontents
  14. @contents
  15. @page
  16. @node Top
  17. @top Preface
  18. @cindex Preface
  19. This manual documents the usage of StarPU
  20. @comment
  21. @comment When you add a new menu item, please keep the right hand
  22. @comment aligned to the same column. Do not use tabs. This provides
  23. @comment better formatting.
  24. @comment
  25. @menu
  26. * Introduction:: A basic introduction to using StarPU.
  27. * Installing StarPU:: How to configure, build and install StarPU.
  28. * Configuration options:: Configurations options
  29. * Environment variables:: Environment variables used by StarPU.
  30. * StarPU API:: The API to use StarPU.
  31. * Basic Examples:: Basic examples of the use of StarPU.
  32. * Advanced Topics:: Advanced use of StarPU.
  33. @end menu
  34. @c ---------------------------------------------------------------------
  35. @c Introduction to StarPU
  36. @c ---------------------------------------------------------------------
  37. @node Introduction
  38. @chapter Introduction to StarPU
  39. @menu
  40. * Motivation:: Why StarPU ?
  41. * StarPU in a Nutshell:: The Fundamentals of StarPU
  42. @end menu
  43. @node Motivation
  44. @section Motivation
  45. @c complex machines with heterogeneous cores/devices
  46. The use of specialized hardware such as accelerators or coprocessors offers an
  47. interesting approach to overcome the physical limits encountered by processor
  48. architects. As a result, many machines are now equipped with one or several
  49. accelerators (eg. a GPU), in addition to the usual processor(s). While a lot of
  50. efforts have been devoted to offload computation onto such accelerators, very
  51. little attention as been paid to portability concerns on the one hand, and to the
  52. possibility of having heterogeneous accelerators and processors to interact on the other hand.
  53. StarPU is a runtime system that offers support for heterogeneous multicore
  54. architectures, it not only offers a unified view of the computational resources
  55. (ie. CPUs and accelerators at the same time), but it also takes care to
  56. efficiently map and execute tasks onto an heterogeneous machine while
  57. transparently handling low-level issues in a portable fashion.
  58. @c this leads to a complicated distributed memory design
  59. @c which is not (easily) manageable by hand
  60. @c added value/benefits of StarPU
  61. @c - portability
  62. @c - scheduling, perf. portability
  63. @node StarPU in a Nutshell
  64. @section StarPU in a Nutshell
  65. From a programming point of view, StarPU is not a new language but a library
  66. that executes tasks explicitly submitted by the application. The data that a
  67. task manipulate are automatically transferred onto the accelerator so that the
  68. programmer does not have to take care of complex data movements. StarPU also
  69. takes particular care of scheduling those tasks efficiently and allows
  70. scheduling experts to implement custom scheduling policies in a portable
  71. fashion.
  72. @c explain the notion of codelet and task (ie. g(A, B)
  73. @subsection Codelet and Tasks
  74. One of StarPU primary data structure is the @b{codelet}. A codelet describes a
  75. computational kernel that can possibly be implemented on multiple architectures
  76. such as a CPU, a CUDA device or a Cell's SPU.
  77. @c TODO insert illustration f : f_spu, f_cpu, ...
  78. Another important data structure is the @b{task}. Executing a StarPU task
  79. consists in applying a codelet on a data set, on one of the architecture on
  80. which the codelet is implemented. In addition to the codelet that a task
  81. implements, it also describes which data are accessed, and how they are
  82. accessed during the computation (read and/or write).
  83. StarPU tasks are asynchronous: submitting a task to StarPU is a non-blocking
  84. operation. The task structure can also specify a @b{callback} function that is
  85. called once StarPU has properly executed the task. It also contains optional
  86. fields that the application may use to give hints to the scheduler (such as
  87. priority levels).
  88. A task may be identified by a unique 64-bit number which we refer as a @b{tag}.
  89. Task dependencies can be enforced either by the means of callback functions, or
  90. by expressing dependencies between tags.
  91. @c TODO insert illustration f(Ar, Brw, Cr) + ..
  92. @c DSM
  93. @subsection StarPU Data Management Library
  94. Because StarPU schedules tasks at runtime, data transfers have to be
  95. done automatically and ``just-in-time'' between processing units,
  96. relieving the application programmer from explicit data transfers.
  97. Moreover, to avoid unnecessary transfers, StarPU keeps data
  98. where it was last needed, even if was modified there, and it
  99. allows multiple copies of the same data to reside at the same time on
  100. several processing units as long as it is not modified.
  101. @c ---------------------------------------------------------------------
  102. @c Installing StarPU
  103. @c ---------------------------------------------------------------------
  104. @node Installing StarPU
  105. @chapter Installing StarPU
  106. StarPU can be built and installed by the standard means of the GNU
  107. autotools. The following chapter is intended to briefly remind how these tools
  108. can be used to install StarPU.
  109. @section Configuring StarPU
  110. @subsection Generating Makefiles and configuration scripts
  111. This step is not necessary when using the tarball releases of StarPU. If you
  112. are using the source code from the svn repository, you first need to generate
  113. the configure scripts and the Makefiles.
  114. @example
  115. $ autoreconf -vfi
  116. @end example
  117. @subsection Configuring StarPU
  118. @example
  119. $ ./configure
  120. @end example
  121. @c TODO enumerate the list of interesting options: refer to a specific section
  122. @section Building and Installing StarPU
  123. @subsection Building
  124. @example
  125. $ make
  126. @end example
  127. @subsection Sanity Checks
  128. In order to make sure that StarPU is working properly on the system, it is also
  129. possible to run a test suite.
  130. @example
  131. $ make check
  132. @end example
  133. @subsection Installing
  134. In order to install StarPU at the location that was specified during
  135. configuration:
  136. @example
  137. $ make install
  138. @end example
  139. @subsection pkg-config configuration
  140. It is possible that compiling and linking an application against StarPU
  141. requires to use specific flags or libraries (for instance @code{CUDA} or
  142. @code{libspe2}). Therefore, it is possible to use the @code{pkg-config} tool.
  143. If StarPU was not installed at some standard location, the path of StarPU's
  144. library must be specified in the @code{PKG_CONFIG_PATH} environment variable so
  145. that @code{pkg-config} can find it. So if StarPU was installed in
  146. @code{$(prefix_dir)}:
  147. @example
  148. @c TODO: heu, c'est vraiment du shell ça ? :)
  149. $ PKG_CONFIG_PATH = @{PKG_CONFIG_PATH@}:$(prefix_dir)/lib/
  150. @end example
  151. The flags required to compiled or linked against StarPU are then
  152. accessible with the following commands:
  153. @example
  154. $ pkg-config --cflags libstarpu # options for the compiler
  155. $ pkg-config --libs libstarpu # options for the linker
  156. @end example
  157. @c ---------------------------------------------------------------------
  158. @c Configuration options
  159. @c ---------------------------------------------------------------------
  160. @node Configuration options
  161. @chapter Configuration options
  162. TODO
  163. @c ---------------------------------------------------------------------
  164. @c Environment variables
  165. @c ---------------------------------------------------------------------
  166. @node Environment variables
  167. @chapter Environment variables
  168. @menu
  169. * Workers:: Configuring workers
  170. * Scheduling:: Configuring the Scheduling engine
  171. * Misc:: Miscellaneous and debug
  172. @end menu
  173. TODO, explicit configuration (passed to starpu_init) overrides env variables.
  174. @node Workers
  175. @section Configuring workers
  176. @menu
  177. * STARPU_NCPUS :: Number of CPU workers
  178. * STARPU_NCUDA :: Number of CUDA workers
  179. * STARPU_NOPENCL :: Number of OpenCL workers
  180. * STARPU_NGORDON :: Number of SPU workers (Cell)
  181. * STARPU_WORKERS_CPUID :: Bind workers to specific CPUs
  182. * STARPU_WORKERS_CUDAID :: Select specific CUDA devices
  183. * STARPU_WORKERS_OPENCLID :: Select specific OpenCL devices
  184. @end menu
  185. @node STARPU_NCPUS
  186. @subsection @code{STARPU_NCPUS} -- Number of CPU workers
  187. @table @asis
  188. @item @emph{Description}:
  189. Specify the maximum number of CPU workers. Note that StarPU will not allocate
  190. more CPUs than there are physical CPUs, and that some CPUs are used to control
  191. the accelerators.
  192. @end table
  193. @node STARPU_NCUDA
  194. @subsection @code{STARPU_NCUDA} -- Number of CUDA workers
  195. @table @asis
  196. @item @emph{Description}:
  197. Specify the maximum number of CUDA devices that StarPU can use. In case there
  198. @code{STARPU_NCUDA} is lower than the number of physical devices, it is
  199. possible to select which CUDA devices should be used by the means of the
  200. @code{STARPU_WORKERS_CUDAID} environment variable.
  201. @end table
  202. @node STARPU_NOPENCL
  203. @subsection @code{STARPU_NOPENCL} -- Number of OpenCL workers
  204. @table @asis
  205. @item @emph{Description}:
  206. OpenCL equivalent of the @code{STARPU_NCUDA} environment variable.
  207. @end table
  208. @node STARPU_NGORDON
  209. @subsection @code{STARPU_NGORDON} -- Number of SPU workers (Cell)
  210. @table @asis
  211. @item @emph{Description}:
  212. Specify the maximum number of SPUs that StarPU can use.
  213. @end table
  214. @node STARPU_WORKERS_CPUID
  215. @subsection @code{STARPU_WORKERS_CPUID} -- Bind workers to specific CPUs
  216. @table @asis
  217. @item @emph{Description}:
  218. Passing an array of integers (starting from 0) in @code{STARPU_WORKERS_CPUID}
  219. specifies on which logical CPU the different workers should be
  220. bound. For instance, if @code{STARPU_WORKERS_CPUID = "1 3 0 2"}, the first
  221. worker will be bound to logical CPU #1, the second CPU worker will be bound to
  222. logical CPU #3 and so on. Note that the logical ordering of the CPUs is either
  223. determined by the OS, or provided by the @code{hwloc}  library in case it is
  224. available.
  225. Note that the first workers correspond to the CUDA workers, then come the
  226. OpenCL and the SPU, and finally the CPU workers. For example if
  227. we have @code{STARPU_NCUDA=1}, @code{STARPU_NOPENCL=1}, @code{STARPU_NCPUS=2}
  228. and @code{STARPU_WORKERS_CPUID = "0 2 1 3"}, the CUDA device will be controlled
  229. by logical CPU #0, the OpenCL device will be controlled by logical CPU #2, and
  230. the logical CPUs #1 and #3 will be used by the CPU workers.
  231. If the number of workers is larger than the array given in
  232. @code{STARPU_WORKERS_CPUID}, the workers are bound to the logical CPUs in a
  233. round-robin fashion: if @code{STARPU_WORKERS_CPUID = "0 1"}, the first and the
  234. third (resp. second and fourth) workers will be put on CPU #0 (resp. CPU #1).
  235. @end table
  236. @node STARPU_WORKERS_CUDAID
  237. @subsection @code{STARPU_WORKERS_CUDAID} -- Select specific CUDA devices
  238. @table @asis
  239. @item @emph{Description}:
  240. Similarly to the @code{STARPU_WORKERS_CPUID} environment variable, it is
  241. possible to select which CUDA devices should be used by StarPU. On a machine
  242. equipped with 4 GPUs, setting @code{STARPU_WORKERS_CUDAID = "1 3"} and
  243. @code{STARPU_NCUDA=2} specifies that 2 CUDA workers should be created, and that
  244. they should use CUDA devices #1 and #3 (the logical ordering of the devices is
  245. the one reported by CUDA).
  246. @end table
  247. @node STARPU_WORKERS_OPENCLID
  248. @subsection @code{STARPU_WORKERS_OPENCLID} -- Select specific OpenCL devices
  249. @table @asis
  250. @item @emph{Description}:
  251. OpenCL equivalent of the @code{STARPU_WORKERS_CUDAID} environment variable.
  252. @end table
  253. @node Scheduling
  254. @section Configuring the Scheduling engine
  255. @menu
  256. * STARPU_SCHED :: Scheduling policy
  257. * STARPU_CALIBRATE :: Calibrate performance models
  258. * STARPU_PREFETCH :: Use data prefetch
  259. * STARPU_SCHED_ALPHA :: Computation factor
  260. * STARPU_SCHED_BETA :: Communication factor
  261. @end menu
  262. @node STARPU_SCHED
  263. @subsection @code{STARPU_SCHED} -- Scheduling policy
  264. @table @asis
  265. @item @emph{Description}:
  266. TODO
  267. Use @code{STARPU_SCHED=help} to get the list of available schedulers
  268. @end table
  269. @node STARPU_CALIBRATE
  270. @subsection @code{STARPU_CALIBRATE} -- Calibrate performance models
  271. @table @asis
  272. @item @emph{Description}:
  273. TODO
  274. Note: only applies to dm and dmda scheduling policies.
  275. @end table
  276. @node STARPU_PREFETCH
  277. @subsection @code{STARPU_PREFETCH} -- Use data prefetch
  278. @table @asis
  279. @item @emph{Description}:
  280. TODO
  281. @end table
  282. @node STARPU_SCHED_ALPHA
  283. @subsection @code{STARPU_SCHED_ALPHA} -- Computation factor
  284. @table @asis
  285. @item @emph{Description}:
  286. TODO
  287. @end table
  288. @node STARPU_SCHED_BETA
  289. @subsection @code{STARPU_SCHED_BETA} -- Communication factor
  290. @table @asis
  291. @item @emph{Description}:
  292. TODO
  293. @end table
  294. @node Misc
  295. @section Miscellaneous and debug
  296. @menu
  297. * STARPU_LOGFILENAME :: Select debug file name
  298. @end menu
  299. @node STARPU_LOGFILENAME
  300. @subsection @code{STARPU_LOGFILENAME} -- Select debug file name
  301. @table @asis
  302. @item @emph{Description}:
  303. TODO
  304. @end table
  305. @c ---------------------------------------------------------------------
  306. @c StarPU API
  307. @c ---------------------------------------------------------------------
  308. @node StarPU API
  309. @chapter StarPU API
  310. @menu
  311. * Initialization and Termination:: Initialization and Termination methods
  312. * Workers' Properties:: Methods to enumerate workers' properties
  313. * Data Library:: Methods to manipulate data
  314. * Codelets and Tasks:: Methods to construct tasks
  315. * Tags:: Task dependencies
  316. @end menu
  317. @node Initialization and Termination
  318. @section Initialization and Termination
  319. @menu
  320. * starpu_init:: Initialize StarPU
  321. * struct starpu_conf:: StarPU runtime configuration
  322. * starpu_shutdown:: Terminate StarPU
  323. @end menu
  324. @node starpu_init
  325. @subsection @code{starpu_init} -- Initialize StarPU
  326. @table @asis
  327. @item @emph{Description}:
  328. This is StarPU initialization method, which must be called prior to any other
  329. StarPU call. It is possible to specify StarPU's configuration (eg. scheduling
  330. policy, number of cores, ...) by passing a non-null argument. Default
  331. configuration is used if the passed argument is @code{NULL}.
  332. @item @emph{Return value}:
  333. Upon successful completion, this function returns 0. Otherwise, @code{-ENODEV}
  334. indicates that no worker was available (so that StarPU was not be initialized).
  335. @item @emph{Prototype}:
  336. @code{int starpu_init(struct starpu_conf *conf);}
  337. @end table
  338. @node struct starpu_conf
  339. @subsection @code{struct starpu_conf} -- StarPU runtime configuration
  340. @table @asis
  341. @item @emph{Description}:
  342. This structure is passed to the @code{starpu_init} function in order configure
  343. StarPU. When the default value is used, StarPU automatically select the number
  344. of processing units and takes the default scheduling policy. This parameters
  345. overwrite the equivalent environnement variables.
  346. @item @emph{Fields}:
  347. @table @asis
  348. @item @code{sched_policy} (default = NULL):
  349. This is the name of the scheduling policy. This can also be specified with the
  350. @code{STARPU_SCHED} environment variable.
  351. @item @code{ncpus} (default = -1):
  352. This is the maximum number of CPU cores that StarPU can use. This can also be
  353. specified with the @code{STARPU_NCPUS} environment variable.
  354. @item @code{ncuda} (default = -1):
  355. This is the maximum number of CUDA devices that StarPU can use. This can also be
  356. specified with the @code{STARPU_NCUDA} environment variable.
  357. @item @code{nspus} (default = -1):
  358. This is the maximum number of Cell SPUs that StarPU can use. This can also be
  359. specified with the @code{STARPU_NGORDON} environment variable.
  360. @item @code{calibrate} (default = 0):
  361. If this flag is set, StarPU will calibrate the performance models when
  362. executing tasks. This can also be specified with the @code{STARPU_CALIBRATE}
  363. environment variable.
  364. @end table
  365. @end table
  366. @node starpu_shutdown
  367. @subsection @code{starpu_shutdown} -- Terminate StarPU
  368. @table @asis
  369. @item @emph{Description}:
  370. This is StarPU termination method. It must be called at the end of the
  371. application: statistics and other post-mortem debugging information are not
  372. garanteed to be available until this method has been called.
  373. @item @emph{Prototype}:
  374. @code{void starpu_shutdown(void);}
  375. @end table
  376. @node Workers' Properties
  377. @section Workers' Properties
  378. @menu
  379. * starpu_get_worker_count:: Get the number of processing units
  380. * starpu_get_worker_id:: Get the identifier of the current worker
  381. * starpu_get_worker_type:: Get the type of processing unit associated to a worker
  382. * starpu_get_worker_name:: Get the name of a worker
  383. @end menu
  384. @node starpu_get_worker_count
  385. @subsection @code{starpu_get_worker_count} -- Get the number of processing units
  386. @table @asis
  387. @item @emph{Description}:
  388. This function returns the number of workers (ie. processing units executing
  389. StarPU tasks). The returned value should be at most @code{STARPU_NMAXWORKERS}.
  390. @item @emph{Prototype}:
  391. @code{unsigned starpu_get_worker_count(void);}
  392. @end table
  393. @node starpu_get_worker_id
  394. @subsection @code{starpu_get_worker_id} -- Get the identifier of the current worker
  395. @table @asis
  396. @item @emph{Description}:
  397. This function returns the identifier of the worker associated to the calling
  398. thread. The returned value is either -1 if the current context is not a StarPU
  399. worker (ie. when called from the application outside a task or a callback), or
  400. an integer between 0 and @code{starpu_get_worker_count() - 1}.
  401. @item @emph{Prototype}:
  402. @code{int starpu_get_worker_count(void);}
  403. @end table
  404. @node starpu_get_worker_type
  405. @subsection @code{starpu_get_worker_type} -- Get the type of processing unit associated to a worker
  406. @table @asis
  407. @item @emph{Description}:
  408. This function returns the type of worker associated to an identifier (as
  409. returned by the @code{starpu_get_worker_id} function). The returned value
  410. indicates the architecture of the worker: @code{STARPU_CPU_WORKER} for a CPU
  411. core, @code{STARPU_CUDA_WORKER} for a CUDA device, and
  412. @code{STARPU_GORDON_WORKER} for a Cell SPU. The value returned for an invalid
  413. identifier is unspecified.
  414. @item @emph{Prototype}:
  415. @code{enum starpu_archtype starpu_get_worker_type(int id);}
  416. @end table
  417. @node starpu_get_worker_name
  418. @subsection @code{starpu_get_worker_name} -- Get the name of a worker
  419. @table @asis
  420. @item @emph{Description}:
  421. StarPU associates a unique human readable string to each processing unit. This
  422. function copies at most the @code{maxlen} first bytes of the unique string
  423. associated to a worker identified by its identifier @code{id} into the
  424. @code{dst} buffer. The caller is responsible for ensuring that the @code{dst}
  425. is a valid pointer to a buffer of @code{maxlen} bytes at least. Calling this
  426. function on an invalid identifier results in an unspecified behaviour.
  427. @item @emph{Prototype}:
  428. @code{void starpu_get_worker_name(int id, char *dst, size_t maxlen);}
  429. @end table
  430. @node Data Library
  431. @section Data Library
  432. @c data_handle_t
  433. @c void starpu_delete_data(struct starpu_data_state_t *state);
  434. @c user interaction with the DSM
  435. @c void starpu_sync_data_with_mem(struct starpu_data_state_t *state);
  436. @c void starpu_notify_data_modification(struct starpu_data_state_t *state, uint32_t modifying_node);
  437. @node Codelets and Tasks
  438. @section Codelets and Tasks
  439. @menu
  440. * struct starpu_codelet:: StarPU codelet structure
  441. * struct starpu_task:: StarPU task structure
  442. * starpu_task_init:: Initialize a Task
  443. * starpu_task_create:: Allocate and Initialize a Task
  444. * starpu_task_destroy:: Destroy a dynamically allocated Task
  445. * starpu_submit_task:: Submit a Task
  446. * starpu_wait_task:: Wait for the termination of a Task
  447. * starpu_wait_all_tasks:: Wait for the termination of all Tasks
  448. @end menu
  449. @c struct starpu_task
  450. @c struct starpu_codelet
  451. @node struct starpu_codelet
  452. @subsection @code{struct starpu_codelet} -- StarPU codelet structure
  453. @table @asis
  454. @item @emph{Description}:
  455. The codelet structure describes a kernel that is possibly implemented on
  456. various targets.
  457. @item @emph{Fields}:
  458. @table @asis
  459. @item @code{where}:
  460. Indicates which types of processing units are able to execute that codelet.
  461. @code{CPU|CUDA} for instance indicates that the codelet is implemented for
  462. both CPU cores and CUDA devices while @code{GORDON} indicates that it is only
  463. available on Cell SPUs.
  464. @item @code{cpu_func} (optionnal):
  465. Is a function pointer to the CPU implementation of the codelet. Its prototype
  466. must be: @code{void cpu_func(starpu_data_interface_t *descr, void *arg)}. The
  467. first argument being the array of data managed by the data management library,
  468. and the second argument is a pointer to the argument (possibly a copy of it)
  469. passed from the @code{.cl_arg} field of the @code{starpu_task} structure. This
  470. pointer is ignored if @code{CPU} does not appear in the @code{.where} field,
  471. it must be non-null otherwise.
  472. @item @code{cuda_func} (optionnal):
  473. Is a function pointer to the CUDA implementation of the codelet. @emph{This
  474. must be a host-function written in the CUDA runtime API}. Its prototype must
  475. be: @code{void cuda_func(starpu_data_interface_t *descr, void *arg);}. This
  476. pointer is ignored if @code{CUDA} does not appear in the @code{.where} field,
  477. it must be non-null otherwise.
  478. @item @code{gordon_func} (optionnal):
  479. This is the index of the Cell SPU implementation within the Gordon library.
  480. TODO
  481. @item @code{nbuffers}:
  482. Specifies the number of arguments taken by the codelet. These arguments are
  483. managed by the DSM and are accessed from the @code{starpu_data_interface_t *}
  484. array. The constant argument passed with the @code{.cl_arg} field of the
  485. @code{starpu_task} structure is not counted in this number. This value should
  486. not be above @code{STARPU_NMAXBUFS}.
  487. @item @code{model} (optionnal):
  488. This is a pointer to the performance model associated to this codelet. This
  489. optionnal field is ignored when null. TODO
  490. @end table
  491. @end table
  492. @node struct starpu_task
  493. @subsection @code{struct starpu_task} -- StarPU task structure
  494. @table @asis
  495. @item @emph{Description}:
  496. The starpu_task structure describes a task that can be offloaded on the various
  497. processing units managed by StarPU. It instanciates a codelet. It can either be
  498. allocated dynamically with the @code{starpu_task_create} method, or declared
  499. statically. In the latter case, the programmer has to zero the
  500. @code{starpu_task} structure and to fill the different fields properly. The
  501. indicated default values correspond to the configuration of a task allocated
  502. with @code{starpu_task_create}.
  503. @item @emph{Fields}:
  504. @table @asis
  505. @item @code{cl}:
  506. Is a pointer to the corresponding @code{starpu_codelet} data structure. This
  507. describes where the kernel should be executed, and supplies the appropriate
  508. implementations. When set to @code{NULL}, no code is executed during the tasks,
  509. such empty tasks can be useful for synchronization purposes.
  510. @item @code{buffers}:
  511. TODO
  512. @item @code{cl_arg} (optional) (default = NULL):
  513. TODO
  514. @item @code{cl_arg_size} (optional):
  515. TODO
  516. @c ignored if only executable on CPUs or CUDA ...
  517. @item @code{callback_func} (optional) (default = @code{NULL}):
  518. This is a function pointer of prototype @code{void (*f)(void *)} which
  519. specifies a possible callback. If that pointer is non-null, the callback
  520. function is executed @emph{on the host} after the execution of the task. The
  521. callback is passed the value contained in the @code{callback_arg} field. No
  522. callback is executed if that field is null.
  523. @item @code{callback_arg} (optional) (default = @code{NULL}):
  524. This is the pointer passed to the callback function. This field is ignored if
  525. the @code{callback_func} is null.
  526. @item @code{use_tag} (optional) (default = 0):
  527. If set, this flag indicates that the task should be associated with the tag
  528. conained in the @code{tag_id} field. Tag allow the application to synchronize
  529. with the task and to express task dependencies easily.
  530. @item @code{tag_id}:
  531. This fields contains the tag associated to the tag if the @code{use_tag} field
  532. was set, it is ignored otherwise.
  533. @item @code{synchronous}:
  534. If this flag is set, the @code{starpu_submit_task} function is blocking and
  535. returns only when the task has been executed (or if no worker is able to
  536. process the task). Otherwise, @code{starpu_submit_task} returns immediately.
  537. @item @code{priority} (optionnal) (default = @code{DEFAULT_PRIO}):
  538. This field indicates a level of priority for the task. This is an integer value
  539. that must be selected between @code{MIN_PRIO} (for the least important tasks)
  540. and @code{MAX_PRIO} (for the most important tasks) included. Default priority
  541. is @code{DEFAULT_PRIO}. Scheduling strategies that take priorities into
  542. account can use this parameter to take better scheduling decisions, but the
  543. scheduling policy may also ignore it.
  544. @item @code{execute_on_a_specific_worker} (default = 0):
  545. If this flag is set, StarPU will bypass the scheduler and directly affect this
  546. task to the worker specified by the @code{workerid} field.
  547. @item @code{workerid} (optional):
  548. If the @code{execute_on_a_specific_worker} field is set, this field indicates
  549. which is the identifier of the worker that should process this task (as
  550. returned by @code{starpu_get_worker_id}). This field is ignored if
  551. @code{execute_on_a_specific_worker} field is set to 0.
  552. @item @code{detach} (optional) (default = 1):
  553. If this flag is set, it is not possible to synchronize with the task
  554. by the means of @code{starpu_wait_task} later on. Internal data structures
  555. are only garanteed to be liberated once @code{starpu_wait_task} is called
  556. if that flag is not set.
  557. @item @code{destroy} (optional) (default = 1):
  558. If that flag is set, the task structure will automatically be liberated, either
  559. after the execution of the callback if the task is detached, or during
  560. @code{starpu_task_wait} otherwise. If this flag is not set, dynamically allocated data
  561. structures will not be liberated until @code{starpu_task_destroy} is called
  562. explicitely. Setting this flag for a statically allocated task structure will
  563. result in undefined behaviour.
  564. @end table
  565. @end table
  566. @node starpu_task_init
  567. @subsection @code{starpu_task_init} -- Initialize a Task
  568. @table @asis
  569. @item @emph{Description}:
  570. TODO
  571. @item @emph{Prototype}:
  572. @code{void starpu_task_init(struct starpu_task *task);}
  573. @end table
  574. @node starpu_task_create
  575. @subsection @code{starpu_task_create} -- Allocate and Initialize a Task
  576. @table @asis
  577. @item @emph{Description}:
  578. TODO
  579. (Describe the different default fields ...)
  580. @item @emph{Prototype}:
  581. @code{struct starpu_task *starpu_task_create(void);}
  582. @end table
  583. @node starpu_task_destroy
  584. @subsection @code{starpu_task_destroy} -- Destroy a dynamically allocated Task
  585. @table @asis
  586. @item @emph{Description}:
  587. Liberate the ressource allocated during starpu_task_create. This function can
  588. be called automatically after the execution of a task by setting the
  589. @code{.destroy} flag of the @code{starpu_task} structure (default behaviour).
  590. Calling this function on a statically allocated task results in an undefined
  591. behaviour.
  592. @item @emph{Prototype}:
  593. @code{void starpu_task_destroy(struct starpu_task *task);}
  594. @end table
  595. @node starpu_wait_task
  596. @subsection @code{starpu_wait_task} -- Wait for the termination of a Task
  597. @table @asis
  598. @item @emph{Description}:
  599. This function blocks until the task was executed. It is not possible to
  600. synchronize with a task more than once. It is not possible to wait
  601. synchronous or detached tasks.
  602. @item @emph{Return value}:
  603. Upon successful completion, this function returns 0. Otherwise, @code{-EINVAL}
  604. indicates that the waited task was either synchronous or detached.
  605. @item @emph{Prototype}:
  606. @code{int starpu_wait_task(struct starpu_task *task);}
  607. @end table
  608. @node starpu_submit_task
  609. @subsection @code{starpu_submit_task} -- Submit a Task
  610. @table @asis
  611. @item @emph{Description}:
  612. This function submits task @code{task} to StarPU. Calling this function does
  613. not mean that the task will be executed immediatly as there can be data or task
  614. (tag) dependencies that are not fulfilled yet: StarPU will take care to
  615. schedule this task with respect to such dependencies.
  616. This function returns immediately if the @code{synchronous} field of the
  617. @code{starpu_task} structure was set to 0, and block until the termination of
  618. the task otherwise. It is also possible to synchronize the application with
  619. asynchronous tasks by the means of tags, using the @code{starpu_tag_wait}
  620. function for instance.
  621. In case of success, this function returns 0, a return value of @code{-ENODEV}
  622. means that there is no worker able to process that task (eg. there is no GPU
  623. available and this task is only implemented on top of CUDA).
  624. @item @emph{Prototype}:
  625. @code{int starpu_submit_task(struct starpu_task *task);}
  626. @end table
  627. @node starpu_wait_all_tasks
  628. @subsection @code{starpu_wait_all_tasks} -- Wait for the termination of all Tasks
  629. @table @asis
  630. @item @emph{Description}:
  631. This function blocks until all the tasks that were submitted are terminated.
  632. @item @emph{Prototype}:
  633. @code{void starpu_wait_all_tasks(void);}
  634. @end table
  635. @c Callbacks : what can we put in callbacks ?
  636. @node Tags
  637. @section Tags
  638. @menu
  639. * starpu_tag_t:: Task identifier
  640. * starpu_tag_declare_deps:: Declare the Dependencies of a Tag
  641. * starpu_tag_declare_deps_array:: Declare the Dependencies of a Tag
  642. * starpu_tag_wait:: Block until a Tag is terminated
  643. * starpu_tag_wait_array:: Block until a set of Tags is terminated
  644. * starpu_tag_remove:: Destroy a Tag
  645. * starpu_tag_notify_from_apps:: Feed a tag explicitely
  646. @end menu
  647. @node starpu_tag_t
  648. @subsection @code{starpu_tag_t} -- Task identifier
  649. @table @asis
  650. @item @emph{Description}:
  651. It is possible to associate a task with a unique "tag" and to express
  652. dependencies between tasks by the means of those tags. To do so, fill the
  653. @code{tag_id} field of the @code{starpu_task} structure with a tag number (can
  654. be arbitrary) and set the @code{use_tag} field to 1.
  655. If @code{starpu_tag_declare_deps} is called with that tag number, the task will
  656. not be started until the task which wears the declared dependency tags are
  657. complete.
  658. @end table
  659. @node starpu_tag_declare_deps
  660. @subsection @code{starpu_tag_declare_deps} -- Declare the Dependencies of a Tag
  661. @table @asis
  662. @item @emph{Description}:
  663. Specify the dependencies of the task identified by tag @code{id}. The first
  664. argument specifies the tag which is configured, the second argument gives the
  665. number of tag(s) on which @code{id} depends. The following arguments are the
  666. tags which have to terminated to unlock the task.
  667. This function must be called before the associated task is submitted to StarPU
  668. with @code{starpu_submit_task}.
  669. @item @emph{Remark}
  670. Because of the variable arity of @code{starpu_tag_declare_deps}, note that the
  671. last arguments @emph{must} be of type @code{starpu_tag_t}: constant values
  672. typically need to be explicitely casted. Using the
  673. @code{starpu_tag_declare_deps_array} function avoids this hazard.
  674. @item @emph{Prototype}:
  675. @code{void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...);}
  676. @item @emph{Example}:
  677. @example
  678. @c @cartouche
  679. /* Tag 0x1 depends on tags 0x32 and 0x52 */
  680. starpu_tag_declare_deps((starpu_tag_t)0x1,
  681. 2, (starpu_tag_t)0x32, (starpu_tag_t)0x52);
  682. @c @end cartouche
  683. @end example
  684. @end table
  685. @node starpu_tag_declare_deps_array
  686. @subsection @code{starpu_tag_declare_deps_array} -- Declare the Dependencies of a Tag
  687. @table @asis
  688. @item @emph{Description}:
  689. This function is similar to @code{starpu_tag_declare_deps}, except that its
  690. does not take a variable number of arguments but an array of tags of size
  691. @code{ndeps}.
  692. @item @emph{Prototype}:
  693. @code{void starpu_tag_declare_deps_array(starpu_tag_t id, unsigned ndeps, starpu_tag_t *array);}
  694. @item @emph{Example}:
  695. @example
  696. @c @cartouche
  697. /* Tag 0x1 depends on tags 0x32 and 0x52 */
  698. starpu_tag_t tag_array[2] = @{0x32, 0x52@};
  699. starpu_tag_declare_deps((starpu_tag_t)0x1, 2, tag_array);
  700. @c @end cartouche
  701. @end example
  702. @end table
  703. @node starpu_tag_wait
  704. @subsection @code{starpu_tag_wait} -- Block until a Tag is terminated
  705. @table @asis
  706. @item @emph{Description}:
  707. This function blocks until the task associated to tag @code{id} has been
  708. executed. This is a blocking call which must therefore not be called within
  709. tasks or callbacks, but only from the application directly. It is possible to
  710. synchronize with the same tag multiple times, as long as the
  711. @code{starpu_tag_remove} function is not called. Note that it is still
  712. possible to synchronize wih a tag associated to a task which @code{starpu_task}
  713. data structure was liberated (eg. if the @code{destroy} flag of the
  714. @code{starpu_task} was enabled).
  715. @item @emph{Prototype}:
  716. @code{void starpu_tag_wait(starpu_tag_t id);}
  717. @end table
  718. @node starpu_tag_wait_array
  719. @subsection @code{starpu_tag_wait_array} -- Block until a set of Tags is terminated
  720. @table @asis
  721. @item @emph{Description}:
  722. This function is similar to @code{starpu_tag_wait} except that it blocks until
  723. @emph{all} the @code{ntags} tags contained in the @code{id} array are
  724. terminated.
  725. @item @emph{Prototype}:
  726. @code{void starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id);}
  727. @end table
  728. @node starpu_tag_remove
  729. @subsection @code{starpu_tag_remove} -- Destroy a Tag
  730. @table @asis
  731. @item @emph{Description}:
  732. This function release the resources associated to tag @code{id}. It can be
  733. called once the corresponding task has been executed and when there is no tag
  734. that depend on that one anymore.
  735. @item @emph{Prototype}:
  736. @code{void starpu_tag_remove(starpu_tag_t id);}
  737. @end table
  738. @node starpu_tag_notify_from_apps
  739. @subsection @code{starpu_tag_notify_from_apps} -- Feed a Tag explicitely
  740. @table @asis
  741. @item @emph{Description}:
  742. This function explicitely unlocks tag @code{id}. It may be useful in the
  743. case of applications which execute part of their computation outside StarPU
  744. tasks (eg. third-party libraries). It is also provided as a
  745. convenient tool for the programmer, for instance to entirely construct the task
  746. DAG before actually giving StarPU the opportunity to execute the tasks.
  747. @item @emph{Prototype}:
  748. @code{void starpu_tag_notify_from_apps(starpu_tag_t id);}
  749. @end table
  750. @section Extensions
  751. @subsection CUDA extensions
  752. @c void starpu_malloc_pinned_if_possible(float **A, size_t dim);
  753. @subsection Cell extensions
  754. @c ---------------------------------------------------------------------
  755. @c Basic Examples
  756. @c ---------------------------------------------------------------------
  757. @node Basic Examples
  758. @chapter Basic Examples
  759. @menu
  760. * Compiling and linking:: Compiling and Linking Options
  761. * Hello World:: Submitting Tasks
  762. * Scaling a Vector:: Manipulating Data
  763. * Scaling a Vector (hybrid):: Handling Heterogeneous Architectures
  764. @end menu
  765. @node Compiling and linking
  766. @section Compiling and linking options
  767. The Makefile could for instance contain the following lines to define which
  768. options must be given to the compiler and to the linker:
  769. @example
  770. @c @cartouche
  771. CFLAGS+=$$(pkg-config --cflags libstarpu)
  772. LIBS+=$$(pkg-config --libs libstarpu)
  773. @c @end cartouche
  774. @end example
  775. @node Hello World
  776. @section Hello World
  777. In this section, we show how to implement a simple program that submits a task to StarPU.
  778. @subsection Required Headers
  779. The @code{starpu.h} header should be included in any code using StarPU.
  780. @example
  781. @c @cartouche
  782. #include <starpu.h>
  783. @c @end cartouche
  784. @end example
  785. @subsection Defining a Codelet
  786. @example
  787. @c @cartouche
  788. void cpu_func(starpu_data_interface_t *buffers, void *func_arg)
  789. @{
  790. float *array = func_arg;
  791. printf("Hello world (array = @{%f, %f@} )\n", array[0], array[1]);
  792. @}
  793. starpu_codelet cl =
  794. @{
  795. .where = CPU,
  796. .cpu_func = cpu_func,
  797. .nbuffers = 0
  798. @};
  799. @c @end cartouche
  800. @end example
  801. A codelet is a structure that represents a computational kernel. Such a codelet
  802. may contain an implementation of the same kernel on different architectures
  803. (eg. CUDA, Cell's SPU, x86, ...).
  804. The ''@code{.nbuffers}'' field specifies the number of data buffers that are
  805. manipulated by the codelet: here the codelet does not access or modify any data
  806. that is controlled by our data management library. Note that the argument
  807. passed to the codelet (the ''@code{.cl_arg}'' field of the @code{starpu_task}
  808. structure) does not count as a buffer since it is not managed by our data
  809. management library.
  810. @c TODO need a crossref to the proper description of "where" see bla for more ...
  811. We create a codelet which may only be executed on the CPUs. The ''@code{.where}''
  812. field is a bitmask that defines where the codelet may be executed. Here, the
  813. @code{CPU} value means that only CPUs can execute this codelet
  814. (@pxref{Codelets and Tasks} for more details on that field).
  815. When a CPU core executes a codelet, it calls the @code{.cpu_func} function,
  816. which @emph{must} have the following prototype:
  817. @code{void (*cpu_func)(starpu_data_interface_t *, void *)}
  818. In this example, we can ignore the first argument of this function which gives a
  819. description of the input and output buffers (eg. the size and the location of
  820. the matrices). The second argument is a pointer to a buffer passed as an
  821. argument to the codelet by the means of the ''@code{.cl_arg}'' field of the
  822. @code{starpu_task} structure. Be aware that this may be a pointer to a
  823. @emph{copy} of the actual buffer, and not the pointer given by the programmer:
  824. if the codelet modifies this buffer, there is no garantee that the initial
  825. buffer will be modified as well: this for instance implies that the buffer
  826. cannot be used as a synchronization medium.
  827. @subsection Submitting a Task
  828. @example
  829. @c @cartouche
  830. void callback_func(void *callback_arg)
  831. @{
  832. printf("Callback function (arg %x)\n", callback_arg);
  833. @}
  834. int main(int argc, char **argv)
  835. @{
  836. /* initialize StarPU */
  837. starpu_init(NULL);
  838. struct starpu_task *task = starpu_task_create();
  839. task->cl = &cl;
  840. float array[2] = @{1.0f, -1.0f@};
  841. task->cl_arg = &array;
  842. task->cl_arg_size = 2*sizeof(float);
  843. task->callback_func = callback_func;
  844. task->callback_arg = 0x42;
  845. /* starpu_submit_task will be a blocking call */
  846. task->synchronous = 1;
  847. /* submit the task to StarPU */
  848. starpu_submit_task(task);
  849. /* terminate StarPU */
  850. starpu_shutdown();
  851. return 0;
  852. @}
  853. @c @end cartouche
  854. @end example
  855. Before submitting any tasks to StarPU, @code{starpu_init} must be called. The
  856. @code{NULL} argument specifies that we use default configuration. Tasks cannot
  857. be submitted after the termination of StarPU by a call to
  858. @code{starpu_shutdown}.
  859. In the example above, a task structure is allocated by a call to
  860. @code{starpu_task_create}. This function only allocates and fills the
  861. corresponding structure with the default settings (@pxref{starpu_task_create}),
  862. but it does not submit the task to StarPU.
  863. @c not really clear ;)
  864. The ''@code{.cl}'' field is a pointer to the codelet which the task will
  865. execute: in other words, the codelet structure describes which computational
  866. kernel should be offloaded on the different architectures, and the task
  867. structure is a wrapper containing a codelet and the piece of data on which the
  868. codelet should operate.
  869. The optional ''@code{.cl_arg}'' field is a pointer to a buffer (of size
  870. @code{.cl_arg_size}) with some parameters for the kernel
  871. described by the codelet. For instance, if a codelet implements a computational
  872. kernel that multiplies its input vector by a constant, the constant could be
  873. specified by the means of this buffer.
  874. Once a task has been executed, an optional callback function can be called.
  875. While the computational kernel could be offloaded on various architectures, the
  876. callback function is always executed on a CPU. The ''@code{.callback_arg}''
  877. pointer is passed as an argument of the callback. The prototype of a callback
  878. function must be:
  879. @example
  880. void (*callback_function)(void *);
  881. @end example
  882. If the @code{.synchronous} field is non-null, task submission will be
  883. synchronous: the @code{starpu_submit_task} function will not return until the
  884. task was executed. Note that the @code{starpu_shutdown} method does not
  885. guarantee that asynchronous tasks have been executed before it returns.
  886. @node Scaling a Vector
  887. @section Manipulating Data: Scaling a Vector
  888. The previous example has shown how to submit tasks. In this section we show how
  889. StarPU tasks can manipulate data.
  890. Programmers can describe the data layout of their application so that StarPU is
  891. responsible for enforcing data coherency and availability accross the machine.
  892. Instead of handling complex (and non-portable) mechanisms to perform data
  893. movements, programmers only declare which piece of data is accessed and/or
  894. modified by a task, and StarPU makes sure that when a computational kernel
  895. starts somewhere (eg. on a GPU), its data are available locally.
  896. Before submitting those tasks, the programmer first needs to declare the
  897. different pieces of data to StarPU using the @code{starpu_register_*_data}
  898. functions. To ease the development of applications for StarPU, it is possible
  899. to describe multiple types of data layout. A type of data layout is called an
  900. @b{interface}. By default, there are different interfaces available in StarPU:
  901. here we will consider the @b{vector interface}.
  902. The following lines show how to declare an array of @code{n} elements of type
  903. @code{float} using the vector interface:
  904. @example
  905. float tab[n];
  906. starpu_data_handle tab_handle;
  907. starpu_register_vector_data(&tab_handle, 0, tab, n, sizeof(float));
  908. @end example
  909. The first argument, called the @b{data handle}, is an opaque pointer which
  910. designates the array in StarPU. This is also the structure which is used to
  911. describe which data is used by a task.
  912. @c TODO: what is 0 ?
  913. It is possible to construct a StarPU
  914. task that multiplies this vector by a constant factor:
  915. @example
  916. float factor;
  917. struct starpu_task *task = starpu_task_create();
  918. task->cl = &cl;
  919. task->buffers[0].handle = tab_handle;
  920. task->buffers[0].mode = STARPU_RW;
  921. task->cl_arg = &factor;
  922. task->cl_arg_size = sizeof(float);
  923. @end example
  924. Since the factor is constant, it does not need a preliminary declaration, and
  925. can just be passed through the @code{cl_arg} pointer like in the previous
  926. example. The vector parameter is described by its handle.
  927. There are two fields in each element of the @code{buffers} array.
  928. @code{.handle} is the handle of the data, and @code{.mode} specifies how the
  929. kernel will access the data (@code{STARPU_R} for read-only, @code{STARPU_W} for
  930. write-only and @code{STARPU_RW} for read and write access).
  931. The definition of the codelet can be written as follows:
  932. @example
  933. void scal_func(starpu_data_interface_t *buffers, void *arg)
  934. @{
  935. unsigned i;
  936. float *factor = arg;
  937. /* length of the vector */
  938. unsigned n = buffers[0].vector.nx;
  939. /* local copy of the vector pointer */
  940. float *val = (float *)buffers[0].vector.ptr;
  941. for (i = 0; i < n; i++)
  942. val[i] *= *factor;
  943. @}
  944. starpu_codelet cl = @{
  945. .where = CPU,
  946. .cpu_func = scal_func,
  947. .nbuffers = 1
  948. @};
  949. @end example
  950. The second argument of the @code{scal_func} function contains a pointer to the
  951. parameters of the codelet (given in @code{task->cl_arg}), so that we read the
  952. constant factor from this pointer. The first argument is an array that gives
  953. a description of every buffers passed in the @code{task->buffers}@ array, the
  954. number of which is given by the @code{.nbuffers} field of the codelet structure.
  955. In the @b{vector interface}, the location of the vector (resp. its length)
  956. is accessible in the @code{.vector.ptr} (resp. @code{.vector.nx}) of this
  957. array. Since the vector is accessed in a read-write fashion, any modification
  958. will automatically affect future accesses to that vector made by other tasks.
  959. @node Scaling a Vector (hybrid)
  960. @section Vector Scaling on an Hybrid CPU/GPU Machine
  961. Contrary to the previous examples, the task submitted in the example may not
  962. only be executed by the CPUs, but also by a CUDA device.
  963. TODO
  964. @c ---------------------------------------------------------------------
  965. @c Advanced Topics
  966. @c ---------------------------------------------------------------------
  967. @node Advanced Topics
  968. @chapter Advanced Topics
  969. @bye