starpu.texi 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837
  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 (e.g. 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. (i.e. CPUs and accelerators at the same time), but it also takes care of
  56. efficiently mapping and executing 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 manipulates 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 (i.e. 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 architectures 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. @menu
  107. * Configuration of StarPU::
  108. * Building and Installing StarPU::
  109. @end menu
  110. StarPU can be built and installed by the standard means of the GNU
  111. autotools. The following chapter is intended to briefly remind how these tools
  112. can be used to install StarPU.
  113. @node Configuration of StarPU
  114. @section Configuration of StarPU
  115. @menu
  116. * Generating Makefiles and configuration scripts::
  117. * Configuring StarPU::
  118. @end menu
  119. @node Generating Makefiles and configuration scripts
  120. @subsection Generating Makefiles and configuration scripts
  121. This step is not necessary when using the tarball releases of StarPU. If you
  122. are using the source code from the svn repository, you first need to generate
  123. the configure scripts and the Makefiles.
  124. @example
  125. $ autoreconf -vfi
  126. @end example
  127. @node Configuring StarPU
  128. @subsection Configuring StarPU
  129. @example
  130. $ ./configure
  131. @end example
  132. Details about options that are useful to give to @code{./configure} are given in
  133. @ref{Configuration options}.
  134. @node Building and Installing StarPU
  135. @section Building and Installing StarPU
  136. @menu
  137. * Building::
  138. * Sanity Checks::
  139. * Installing::
  140. * pkg-config configuration::
  141. @end menu
  142. @node Building
  143. @subsection Building
  144. @example
  145. $ make
  146. @end example
  147. @node Sanity Checks
  148. @subsection Sanity Checks
  149. In order to make sure that StarPU is working properly on the system, it is also
  150. possible to run a test suite.
  151. @example
  152. $ make check
  153. @end example
  154. @node Installing
  155. @subsection Installing
  156. In order to install StarPU at the location that was specified during
  157. configuration:
  158. @example
  159. $ make install
  160. @end example
  161. @node pkg-config configuration
  162. @subsection pkg-config configuration
  163. It is possible that compiling and linking an application against StarPU
  164. requires to use specific flags or libraries (for instance @code{CUDA} or
  165. @code{libspe2}). To this end, it is possible to use the @code{pkg-config} tool.
  166. If StarPU was not installed at some standard location, the path of StarPU's
  167. library must be specified in the @code{PKG_CONFIG_PATH} environment variable so
  168. that @code{pkg-config} can find it. For example if StarPU was installed in
  169. @code{$prefix_dir}:
  170. @example
  171. $ PKG_CONFIG_PATH = $PKG_CONFIG_PATH:$prefix_dir/lib/pkgconfig
  172. @end example
  173. The flags required to compile or link against StarPU are then
  174. accessible with the following commands:
  175. @example
  176. $ pkg-config --cflags libstarpu # options for the compiler
  177. $ pkg-config --libs libstarpu # options for the linker
  178. @end example
  179. @c ---------------------------------------------------------------------
  180. @c Configuration options
  181. @c ---------------------------------------------------------------------
  182. @node Configuration options
  183. @chapter Configuration options
  184. @table @asis
  185. @item @code{--disable-cpu}
  186. Disable the use of CPUs of the machine. Only GPUs etc. will be used.
  187. @item @code{--enable-maxcudadev=<number>}
  188. Defines the maximum number of CUDA devices that StarPU will support, then
  189. available as the STARPU_MAXCUDADEVS macro.
  190. @item @code{--disable-cuda}
  191. Disable the use of CUDA, even if the SDK is detected.
  192. @item @code{--enable-maxopencldev=<number>}
  193. Defines the maximum number of OpenCL devices that StarPU will support, then
  194. available as the STARPU_MAXOPENCLDEVS macro.
  195. @item @code{--disable-opencl}
  196. Disable the use of OpenCL, even if the SDK is detected.
  197. @item @code{--enable-gordon}
  198. Enable the use of the Gordon runtime for Cell SPUs.
  199. @c TODO: rather default to enabled when detected
  200. @item @code{--enable-debug}
  201. Enable debugging messages.
  202. @item @code{--enable-fast}
  203. Do not enforce assertions, saves a lot of time spent to compute them otherwise.
  204. @item @code{--enable-verbose}
  205. Augment the verbosity of the debugging messages.
  206. @item @code{--enable-coverage}
  207. Enable flags for the coverage tool.
  208. @item @code{--enable-perf-debug}
  209. Enable performance debugging.
  210. @item @code{--enable-model-debug}
  211. Enable performance model debugging.
  212. @item @code{--enable-stats}
  213. Enable statistics.
  214. @item @code{--enable-maxbuffers=<nbuffers>}
  215. Define the maximum number of buffers that tasks will be able to take as parameters, then available as the STARPU_NMAXBUFS macro.
  216. @item @code{--enable-allocation-cache}
  217. Enable the use of a data allocation cache to avoid the cost of it with
  218. CUDA. Still experimental.
  219. @item @code{--enable-opengl-render}
  220. Enable the use of OpenGL for the rendering of some examples.
  221. @c TODO: rather default to enabled when detected
  222. @item @code{--enable-blas-lib=<name>}
  223. Specify the blas library to be used by some of the examples. The
  224. library has to be 'atlas' or 'goto'.
  225. @item @code{--with-cuda-dir=<path>}
  226. Specify the location of the CUDA SDK resides. This directory should notably contain
  227. @code{include/cuda.h}.
  228. @item @code{--with-magma=<path>}
  229. Specify where magma is installed.
  230. @item @code{--with-opencl-dir=<path>}
  231. Specify the location of the OpenCL SDK. This directory should notably contain
  232. @code{include/CL/cl.h}.
  233. @item @code{--with-gordon-dir=<path>}
  234. Specify the location of the Gordon SDK.
  235. @item @code{--with-fxt=<path>}
  236. Specify the location of FxT (for generating traces and rendering them
  237. using ViTE). This directory should notably contain
  238. @code{include/fxt/fxt.h}.
  239. @item @code{--with-perf-model-dir=<dir>}
  240. Specify where performance models should be stored (instead of defaulting to the
  241. current user's home).
  242. @item @code{--with-mpicc=<path to mpicc>}
  243. Specify the location of the @code{mpicc} compiler to be used for starpumpi.
  244. @c TODO: also just use AC_PROG
  245. @item @code{--with-mpi}
  246. Enable building libstarpumpi.
  247. @c TODO: rather just use the availability of mpicc instead of a second option
  248. @item @code{--with-goto-dir=<dir>}
  249. Specify the location of GotoBLAS.
  250. @item @code{--with-atlas-dir=<dir>}
  251. Specify the location of ATLAS. This directory should notably contain
  252. @code{include/cblas.h}.
  253. @end table
  254. @c ---------------------------------------------------------------------
  255. @c Environment variables
  256. @c ---------------------------------------------------------------------
  257. @node Environment variables
  258. @chapter Environment variables
  259. @menu
  260. * Workers:: Configuring workers
  261. * Scheduling:: Configuring the Scheduling engine
  262. * Misc:: Miscellaneous and debug
  263. @end menu
  264. Note: the values given in @code{starpu_conf} structure passed when
  265. calling @code{starpu_init} will override the values of the environment
  266. variables.
  267. @node Workers
  268. @section Configuring workers
  269. @menu
  270. * STARPU_NCPUS :: Number of CPU workers
  271. * STARPU_NCUDA :: Number of CUDA workers
  272. * STARPU_NOPENCL :: Number of OpenCL workers
  273. * STARPU_NGORDON :: Number of SPU workers (Cell)
  274. * STARPU_WORKERS_CPUID :: Bind workers to specific CPUs
  275. * STARPU_WORKERS_CUDAID :: Select specific CUDA devices
  276. * STARPU_WORKERS_OPENCLID :: Select specific OpenCL devices
  277. @end menu
  278. @node STARPU_NCPUS
  279. @subsection @code{STARPU_NCPUS} -- Number of CPU workers
  280. @table @asis
  281. @item @emph{Description}:
  282. Specify the maximum number of CPU workers. Note that StarPU will not allocate
  283. more CPUs than there are physical CPUs, and that some CPUs are used to control
  284. the accelerators.
  285. @end table
  286. @node STARPU_NCUDA
  287. @subsection @code{STARPU_NCUDA} -- Number of CUDA workers
  288. @table @asis
  289. @item @emph{Description}:
  290. Specify the maximum number of CUDA devices that StarPU can use. If
  291. @code{STARPU_NCUDA} is lower than the number of physical devices, it is
  292. possible to select which CUDA devices should be used by the means of the
  293. @code{STARPU_WORKERS_CUDAID} environment variable.
  294. @end table
  295. @node STARPU_NOPENCL
  296. @subsection @code{STARPU_NOPENCL} -- Number of OpenCL workers
  297. @table @asis
  298. @item @emph{Description}:
  299. OpenCL equivalent of the @code{STARPU_NCUDA} environment variable.
  300. @end table
  301. @node STARPU_NGORDON
  302. @subsection @code{STARPU_NGORDON} -- Number of SPU workers (Cell)
  303. @table @asis
  304. @item @emph{Description}:
  305. Specify the maximum number of SPUs that StarPU can use.
  306. @end table
  307. @node STARPU_WORKERS_CPUID
  308. @subsection @code{STARPU_WORKERS_CPUID} -- Bind workers to specific CPUs
  309. @table @asis
  310. @item @emph{Description}:
  311. Passing an array of integers (starting from 0) in @code{STARPU_WORKERS_CPUID}
  312. specifies on which logical CPU the different workers should be
  313. bound. For instance, if @code{STARPU_WORKERS_CPUID = "1 3 0 2"}, the first
  314. worker will be bound to logical CPU #1, the second CPU worker will be bound to
  315. logical CPU #3 and so on. Note that the logical ordering of the CPUs is either
  316. determined by the OS, or provided by the @code{hwloc} library in case it is
  317. available.
  318. Note that the first workers correspond to the CUDA workers, then come the
  319. OpenCL and the SPU, and finally the CPU workers. For example if
  320. we have @code{STARPU_NCUDA=1}, @code{STARPU_NOPENCL=1}, @code{STARPU_NCPUS=2}
  321. and @code{STARPU_WORKERS_CPUID = "0 2 1 3"}, the CUDA device will be controlled
  322. by logical CPU #0, the OpenCL device will be controlled by logical CPU #2, and
  323. the logical CPUs #1 and #3 will be used by the CPU workers.
  324. If the number of workers is larger than the array given in
  325. @code{STARPU_WORKERS_CPUID}, the workers are bound to the logical CPUs in a
  326. round-robin fashion: if @code{STARPU_WORKERS_CPUID = "0 1"}, the first and the
  327. third (resp. second and fourth) workers will be put on CPU #0 (resp. CPU #1).
  328. @end table
  329. @node STARPU_WORKERS_CUDAID
  330. @subsection @code{STARPU_WORKERS_CUDAID} -- Select specific CUDA devices
  331. @table @asis
  332. @item @emph{Description}:
  333. Similarly to the @code{STARPU_WORKERS_CPUID} environment variable, it is
  334. possible to select which CUDA devices should be used by StarPU. On a machine
  335. equipped with 4 GPUs, setting @code{STARPU_WORKERS_CUDAID = "1 3"} and
  336. @code{STARPU_NCUDA=2} specifies that 2 CUDA workers should be created, and that
  337. they should use CUDA devices #1 and #3 (the logical ordering of the devices is
  338. the one reported by CUDA).
  339. @end table
  340. @node STARPU_WORKERS_OPENCLID
  341. @subsection @code{STARPU_WORKERS_OPENCLID} -- Select specific OpenCL devices
  342. @table @asis
  343. @item @emph{Description}:
  344. OpenCL equivalent of the @code{STARPU_WORKERS_CUDAID} environment variable.
  345. @end table
  346. @node Scheduling
  347. @section Configuring the Scheduling engine
  348. @menu
  349. * STARPU_SCHED :: Scheduling policy
  350. * STARPU_CALIBRATE :: Calibrate performance models
  351. * STARPU_PREFETCH :: Use data prefetch
  352. * STARPU_SCHED_ALPHA :: Computation factor
  353. * STARPU_SCHED_BETA :: Communication factor
  354. @end menu
  355. @node STARPU_SCHED
  356. @subsection @code{STARPU_SCHED} -- Scheduling policy
  357. @table @asis
  358. @item @emph{Description}:
  359. This chooses between the different scheduling policies proposed by StarPU: work
  360. random, stealing, greedy, with performance models, etc.
  361. Use @code{STARPU_SCHED=help} to get the list of available schedulers.
  362. @end table
  363. @node STARPU_CALIBRATE
  364. @subsection @code{STARPU_CALIBRATE} -- Calibrate performance models
  365. @table @asis
  366. @item @emph{Description}:
  367. If this variable is set to 1, the performance models are calibrated during
  368. the execution. If it is set to 2, the previous values are dropped to restart
  369. calibration from scratch.
  370. Note: this currently only applies to dm and dmda scheduling policies.
  371. @end table
  372. @node STARPU_PREFETCH
  373. @subsection @code{STARPU_PREFETCH} -- Use data prefetch
  374. @table @asis
  375. @item @emph{Description}:
  376. If this variable is set, data prefetching will be enabled, that is when a task is
  377. scheduled to be executed e.g. on a GPU, StarPU will request an asynchronous
  378. transfer in advance, so that data is already present on the GPU when the task
  379. starts. As a result, computation and data transfers are overlapped.
  380. @end table
  381. @node STARPU_SCHED_ALPHA
  382. @subsection @code{STARPU_SCHED_ALPHA} -- Computation factor
  383. @table @asis
  384. @item @emph{Description}:
  385. To estimate the cost of a task StarPU takes into account the estimated
  386. computation time (obtained thanks to performance models). The alpha factor is
  387. the coefficient to be applied to it before adding it to the communication part.
  388. @end table
  389. @node STARPU_SCHED_BETA
  390. @subsection @code{STARPU_SCHED_BETA} -- Communication factor
  391. @table @asis
  392. @item @emph{Description}:
  393. To estimate the cost of a task StarPU takes into account the estimated
  394. data transfer time (obtained thanks to performance models). The beta factor is
  395. the coefficient to be applied to it before adding it to the computation part.
  396. @end table
  397. @node Misc
  398. @section Miscellaneous and debug
  399. @menu
  400. * STARPU_LOGFILENAME :: Select debug file name
  401. @end menu
  402. @node STARPU_LOGFILENAME
  403. @subsection @code{STARPU_LOGFILENAME} -- Select debug file name
  404. @table @asis
  405. @item @emph{Description}:
  406. This variable specify in which file the debugging output should be saved to.
  407. @end table
  408. @c ---------------------------------------------------------------------
  409. @c StarPU API
  410. @c ---------------------------------------------------------------------
  411. @node StarPU API
  412. @chapter StarPU API
  413. @menu
  414. * Initialization and Termination:: Initialization and Termination methods
  415. * Workers' Properties:: Methods to enumerate workers' properties
  416. * Data Library:: Methods to manipulate data
  417. * Codelets and Tasks:: Methods to construct tasks
  418. * Tags:: Task dependencies
  419. * CUDA extensions:: CUDA extensions
  420. * OpenCL extensions:: OpenCL extensions
  421. * Cell extensions:: Cell extensions
  422. * Miscellaneous:: Miscellaneous helpers
  423. @end menu
  424. @node Initialization and Termination
  425. @section Initialization and Termination
  426. @menu
  427. * starpu_init:: Initialize StarPU
  428. * struct starpu_conf:: StarPU runtime configuration
  429. * starpu_shutdown:: Terminate StarPU
  430. @end menu
  431. @node starpu_init
  432. @subsection @code{starpu_init} -- Initialize StarPU
  433. @table @asis
  434. @item @emph{Description}:
  435. This is StarPU initialization method, which must be called prior to any other
  436. StarPU call. It is possible to specify StarPU's configuration (e.g. scheduling
  437. policy, number of cores, ...) by passing a non-null argument. Default
  438. configuration is used if the passed argument is @code{NULL}.
  439. @item @emph{Return value}:
  440. Upon successful completion, this function returns 0. Otherwise, @code{-ENODEV}
  441. indicates that no worker was available (so that StarPU was not initialized).
  442. @item @emph{Prototype}:
  443. @code{int starpu_init(struct starpu_conf *conf);}
  444. @end table
  445. @node struct starpu_conf
  446. @subsection @code{struct starpu_conf} -- StarPU runtime configuration
  447. @table @asis
  448. @item @emph{Description}:
  449. This structure is passed to the @code{starpu_init} function in order
  450. to configure StarPU.
  451. When the default value is used, StarPU automatically selects the number
  452. of processing units and takes the default scheduling policy. This parameter
  453. overwrites the equivalent environment variables.
  454. @item @emph{Fields}:
  455. @table @asis
  456. @item @code{sched_policy} (default = NULL):
  457. This is the name of the scheduling policy. This can also be specified with the
  458. @code{STARPU_SCHED} environment variable.
  459. @item @code{ncpus} (default = -1):
  460. This is the maximum number of CPU cores that StarPU can use. This can also be
  461. specified with the @code{STARPU_NCPUS} environment variable.
  462. @item @code{ncuda} (default = -1):
  463. This is the maximum number of CUDA devices that StarPU can use. This can also be
  464. specified with the @code{STARPU_NCUDA} environment variable.
  465. @item @code{nopencl} (default = -1):
  466. This is the maximum number of OpenCL devices that StarPU can use. This can also be
  467. specified with the @code{STARPU_NOPENCL} environment variable.
  468. @item @code{nspus} (default = -1):
  469. This is the maximum number of Cell SPUs that StarPU can use. This can also be
  470. specified with the @code{STARPU_NGORDON} environment variable.
  471. @item @code{calibrate} (default = 0):
  472. If this flag is set, StarPU will calibrate the performance models when
  473. executing tasks. This can also be specified with the @code{STARPU_CALIBRATE}
  474. environment variable.
  475. @end table
  476. @end table
  477. @node starpu_shutdown
  478. @subsection @code{starpu_shutdown} -- Terminate StarPU
  479. @table @asis
  480. @item @emph{Description}:
  481. This is StarPU termination method. It must be called at the end of the
  482. application: statistics and other post-mortem debugging information are not
  483. guaranteed to be available until this method has been called.
  484. @item @emph{Prototype}:
  485. @code{void starpu_shutdown(void);}
  486. @end table
  487. @node Workers' Properties
  488. @section Workers' Properties
  489. @menu
  490. * starpu_worker_get_count:: Get the number of processing units
  491. * starpu_cpu_worker_get_count:: Get the number of CPU controlled by StarPU
  492. * starpu_cuda_worker_get_count:: Get the number of CUDA devices controlled by StarPU
  493. * starpu_opencl_worker_get_count:: Get the number of OpenCL devices controlled by StarPU
  494. * starpu_spu_worker_get_count:: Get the number of Cell SPUs controlled by StarPU
  495. * starpu_worker_get_id:: Get the identifier of the current worker
  496. * starpu_worker_get_type:: Get the type of processing unit associated to a worker
  497. * starpu_worker_get_name:: Get the name of a worker
  498. @end menu
  499. @node starpu_worker_get_count
  500. @subsection @code{starpu_worker_get_count} -- Get the number of processing units
  501. @table @asis
  502. @item @emph{Description}:
  503. This function returns the number of workers (i.e. processing units executing
  504. StarPU tasks). The returned value should be at most @code{STARPU_NMAXWORKERS}.
  505. @item @emph{Prototype}:
  506. @code{unsigned starpu_worker_get_count(void);}
  507. @end table
  508. @node starpu_cpu_worker_get_count
  509. @subsection @code{starpu_cpu_worker_get_count} -- Get the number of CPU controlled by StarPU
  510. @table @asis
  511. @item @emph{Description}:
  512. This function returns the number of CPUs controlled by StarPU. The returned
  513. value should be at most @code{STARPU_NMAXCPUS}.
  514. @item @emph{Prototype}:
  515. @code{unsigned starpu_cpu_worker_get_count(void);}
  516. @end table
  517. @node starpu_cuda_worker_get_count
  518. @subsection @code{starpu_cuda_worker_get_count} -- Get the number of CUDA devices controlled by StarPU
  519. @table @asis
  520. @item @emph{Description}:
  521. This function returns the number of CUDA devices controlled by StarPU. The returned
  522. value should be at most @code{STARPU_MAXCUDADEVS}.
  523. @item @emph{Prototype}:
  524. @code{unsigned starpu_cuda_worker_get_count(void);}
  525. @end table
  526. @node starpu_opencl_worker_get_count
  527. @subsection @code{starpu_opencl_worker_get_count} -- Get the number of OpenCL devices controlled by StarPU
  528. @table @asis
  529. @item @emph{Description}:
  530. This function returns the number of OpenCL devices controlled by StarPU. The returned
  531. value should be at most @code{STARPU_MAXOPENCLDEVS}.
  532. @item @emph{Prototype}:
  533. @code{unsigned starpu_opencl_worker_get_count(void);}
  534. @end table
  535. @node starpu_spu_worker_get_count
  536. @subsection @code{starpu_spu_worker_get_count} -- Get the number of Cell SPUs controlled by StarPU
  537. @table @asis
  538. @item @emph{Description}:
  539. This function returns the number of Cell SPUs controlled by StarPU.
  540. @item @emph{Prototype}:
  541. @code{unsigned starpu_opencl_worker_get_count(void);}
  542. @end table
  543. @node starpu_worker_get_id
  544. @subsection @code{starpu_worker_get_id} -- Get the identifier of the current worker
  545. @table @asis
  546. @item @emph{Description}:
  547. This function returns the identifier of the worker associated to the calling
  548. thread. The returned value is either -1 if the current context is not a StarPU
  549. worker (i.e. when called from the application outside a task or a callback), or
  550. an integer between 0 and @code{starpu_worker_get_count() - 1}.
  551. @item @emph{Prototype}:
  552. @code{int starpu_worker_get_id(void);}
  553. @end table
  554. @node starpu_worker_get_type
  555. @subsection @code{starpu_worker_get_type} -- Get the type of processing unit associated to a worker
  556. @table @asis
  557. @item @emph{Description}:
  558. This function returns the type of worker associated to an identifier (as
  559. returned by the @code{starpu_worker_get_id} function). The returned value
  560. indicates the architecture of the worker: @code{STARPU_CPU_WORKER} for a CPU
  561. core, @code{STARPU_CUDA_WORKER} for a CUDA device,
  562. @code{STARPU_OPENCL_WORKER} for a OpenCL device, and
  563. @code{STARPU_GORDON_WORKER} for a Cell SPU. The value returned for an invalid
  564. identifier is unspecified.
  565. @item @emph{Prototype}:
  566. @code{enum starpu_archtype starpu_worker_get_type(int id);}
  567. @end table
  568. @node starpu_worker_get_name
  569. @subsection @code{starpu_worker_get_name} -- Get the name of a worker
  570. @table @asis
  571. @item @emph{Description}:
  572. StarPU associates a unique human readable string to each processing unit. This
  573. function copies at most the @code{maxlen} first bytes of the unique string
  574. associated to a worker identified by its identifier @code{id} into the
  575. @code{dst} buffer. The caller is responsible for ensuring that the @code{dst}
  576. is a valid pointer to a buffer of @code{maxlen} bytes at least. Calling this
  577. function on an invalid identifier results in an unspecified behaviour.
  578. @item @emph{Prototype}:
  579. @code{void starpu_worker_get_name(int id, char *dst, size_t maxlen);}
  580. @end table
  581. @node Data Library
  582. @section Data Library
  583. This section describes the data management facilities provided by StarPU.
  584. TODO: We show how to use existing data interfaces in [ref], but developers can
  585. design their own data interfaces if required.
  586. @menu
  587. * starpu_data_handle:: StarPU opaque data handle
  588. * void *interface:: StarPU data interface
  589. @end menu
  590. @node starpu_data_handle
  591. @subsection @code{starpu_data_handle} -- StarPU opaque data handle
  592. @table @asis
  593. @item @emph{Description}:
  594. StarPU uses @code{starpu_data_handle} as an opaque handle to manage a piece of
  595. data. Once a piece of data has been registered to StarPU, it is associated to a
  596. @code{starpu_data_handle} which keeps track of the state of the piece of data
  597. over the entire machine, so that we can maintain data consistency and locate
  598. data replicates for instance.
  599. @end table
  600. @node void *interface
  601. @subsection @code{void *interface} -- StarPU data interface
  602. @table @asis
  603. @item @emph{Description}:
  604. Data management is done at a high-level in StarPU: rather than accessing a mere
  605. list of contiguous buffers, the tasks may manipulate data that are described by
  606. a high-level construct which we call data interface.
  607. TODO
  608. @end table
  609. @c void starpu_data_unregister(struct starpu_data_state_t *state);
  610. @c starpu_worker_get_memory_node TODO
  611. @c
  612. @c user interaction with the DSM
  613. @c void starpu_data_sync_with_mem(struct starpu_data_state_t *state);
  614. @c void starpu_notify_data_modification(struct starpu_data_state_t *state, uint32_t modifying_node);
  615. @node Codelets and Tasks
  616. @section Codelets and Tasks
  617. @menu
  618. * struct starpu_codelet:: StarPU codelet structure
  619. * struct starpu_task:: StarPU task structure
  620. * starpu_task_init:: Initialize a Task
  621. * starpu_task_create:: Allocate and Initialize a Task
  622. * starpu_task_deinit:: Release all the resources used by a Task
  623. * starpu_task_destroy:: Destroy a dynamically allocated Task
  624. * starpu_task_submit:: Submit a Task
  625. * starpu_task_wait:: Wait for the termination of a Task
  626. * starpu_task_wait_for_all:: Wait for the termination of all Tasks
  627. @end menu
  628. @node struct starpu_codelet
  629. @subsection @code{struct starpu_codelet} -- StarPU codelet structure
  630. @table @asis
  631. @item @emph{Description}:
  632. The codelet structure describes a kernel that is possibly implemented on
  633. various targets.
  634. @item @emph{Fields}:
  635. @table @asis
  636. @item @code{where}:
  637. Indicates which types of processing units are able to execute the codelet.
  638. @code{STARPU_CPU|STARPU_CUDA} for instance indicates that the codelet is
  639. implemented for both CPU cores and CUDA devices while @code{STARPU_GORDON}
  640. indicates that it is only available on Cell SPUs.
  641. @item @code{cpu_func} (optional):
  642. Is a function pointer to the CPU implementation of the codelet. Its prototype
  643. must be: @code{void cpu_func(void *buffers[], void *cl_arg)}. The first
  644. argument being the array of data managed by the data management library, and
  645. the second argument is a pointer to the argument passed from the @code{cl_arg}
  646. field of the @code{starpu_task} structure.
  647. The @code{cpu_func} field is ignored if @code{STARPU_CPU} does not appear in
  648. the @code{where} field, it must be non-null otherwise.
  649. @item @code{cuda_func} (optional):
  650. Is a function pointer to the CUDA implementation of the codelet. @emph{This
  651. must be a host-function written in the CUDA runtime API}. Its prototype must
  652. be: @code{void cuda_func(void *buffers[], void *cl_arg);}. The @code{cuda_func}
  653. field is ignored if @code{STARPU_CUDA} does not appear in the @code{where}
  654. field, it must be non-null otherwise.
  655. @item @code{opencl_func} (optional):
  656. Is a function pointer to the OpenCL implementation of the codelet. Its
  657. prototype must be:
  658. @code{void opencl_func(starpu_data_interface_t *descr, void *arg);}.
  659. This pointer is ignored if @code{OPENCL} does not appear in the
  660. @code{where} field, it must be non-null otherwise.
  661. @item @code{gordon_func} (optional):
  662. This is the index of the Cell SPU implementation within the Gordon library.
  663. TODO
  664. @item @code{nbuffers}:
  665. Specifies the number of arguments taken by the codelet. These arguments are
  666. managed by the DSM and are accessed from the @code{void *buffers[]}
  667. array. The constant argument passed with the @code{cl_arg} field of the
  668. @code{starpu_task} structure is not counted in this number. This value should
  669. not be above @code{STARPU_NMAXBUFS}.
  670. @item @code{model} (optional):
  671. This is a pointer to the performance model associated to this codelet. This
  672. optional field is ignored when null. TODO
  673. @end table
  674. @end table
  675. @node struct starpu_task
  676. @subsection @code{struct starpu_task} -- StarPU task structure
  677. @table @asis
  678. @item @emph{Description}:
  679. The @code{starpu_task} structure describes a task that can be offloaded on the various
  680. processing units managed by StarPU. It instantiates a codelet. It can either be
  681. allocated dynamically with the @code{starpu_task_create} method, or declared
  682. statically. In the latter case, the programmer has to zero the
  683. @code{starpu_task} structure and to fill the different fields properly. The
  684. indicated default values correspond to the configuration of a task allocated
  685. with @code{starpu_task_create}.
  686. @item @emph{Fields}:
  687. @table @asis
  688. @item @code{cl}:
  689. Is a pointer to the corresponding @code{starpu_codelet} data structure. This
  690. describes where the kernel should be executed, and supplies the appropriate
  691. implementations. When set to @code{NULL}, no code is executed during the tasks,
  692. such empty tasks can be useful for synchronization purposes.
  693. @item @code{buffers}:
  694. TODO
  695. @item @code{cl_arg} (optional) (default = NULL):
  696. This pointer is passed to the codelet through the second argument
  697. of the codelet implementation (e.g. @code{cpu_func} or @code{cuda_func}).
  698. In the specific case of the Cell processor, see the @code{cl_arg_size}
  699. argument.
  700. @item @code{cl_arg_size} (optional, Cell specific):
  701. In the case of the Cell processor, the @code{cl_arg} pointer is not directly
  702. given to the SPU function. A buffer of size @code{cl_arg_size} is allocated on
  703. the SPU. This buffer is then filled with the @code{cl_arg_size} bytes starting
  704. at address @code{cl_arg}. In this case, the argument given to the SPU codelet
  705. is therefore not the @code{cl_arg} pointer, but the address of the buffer in
  706. local store (LS) instead. This field is ignored for CPU, CUDA and OpenCL
  707. codelets.
  708. @item @code{callback_func} (optional) (default = @code{NULL}):
  709. This is a function pointer of prototype @code{void (*f)(void *)} which
  710. specifies a possible callback. If this pointer is non-null, the callback
  711. function is executed @emph{on the host} after the execution of the task. The
  712. callback is passed the value contained in the @code{callback_arg} field. No
  713. callback is executed if the field is null.
  714. @item @code{callback_arg} (optional) (default = @code{NULL}):
  715. This is the pointer passed to the callback function. This field is ignored if
  716. the @code{callback_func} is null.
  717. @item @code{use_tag} (optional) (default = 0):
  718. If set, this flag indicates that the task should be associated with the tag
  719. contained in the @code{tag_id} field. Tag allow the application to synchronize
  720. with the task and to express task dependencies easily.
  721. @item @code{tag_id}:
  722. This fields contains the tag associated to the task if the @code{use_tag} field
  723. was set, it is ignored otherwise.
  724. @item @code{synchronous}:
  725. If this flag is set, the @code{starpu_task_submit} function is blocking and
  726. returns only when the task has been executed (or if no worker is able to
  727. process the task). Otherwise, @code{starpu_task_submit} returns immediately.
  728. @item @code{priority} (optional) (default = @code{STARPU_DEFAULT_PRIO}):
  729. This field indicates a level of priority for the task. This is an integer value
  730. that must be set between @code{STARPU_MIN_PRIO} (for the least important
  731. tasks) and @code{STARPU_MAX_PRIO} (for the most important tasks) included.
  732. Default priority is @code{STARPU_DEFAULT_PRIO}. Scheduling strategies that
  733. take priorities into account can use this parameter to take better scheduling
  734. decisions, but the scheduling policy may also ignore it.
  735. @item @code{execute_on_a_specific_worker} (default = 0):
  736. If this flag is set, StarPU will bypass the scheduler and directly affect this
  737. task to the worker specified by the @code{workerid} field.
  738. @item @code{workerid} (optional):
  739. If the @code{execute_on_a_specific_worker} field is set, this field indicates
  740. which is the identifier of the worker that should process this task (as
  741. returned by @code{starpu_worker_get_id}). This field is ignored if
  742. @code{execute_on_a_specific_worker} field is set to 0.
  743. @item @code{detach} (optional) (default = 1):
  744. If this flag is set, it is not possible to synchronize with the task
  745. by the means of @code{starpu_task_wait} later on. Internal data structures
  746. are only guaranteed to be freed once @code{starpu_task_wait} is called if the
  747. flag is not set.
  748. @item @code{destroy} (optional) (default = 1):
  749. If this flag is set, the task structure will automatically be freed, either
  750. after the execution of the callback if the task is detached, or during
  751. @code{starpu_task_wait} otherwise. If this flag is not set, dynamically
  752. allocated data structures will not be freed until @code{starpu_task_destroy} is
  753. called explicitly. Setting this flag for a statically allocated task structure
  754. will result in undefined behaviour.
  755. @end table
  756. @end table
  757. @node starpu_task_init
  758. @subsection @code{starpu_task_init} -- Initialize a Task
  759. @table @asis
  760. @item @emph{Description}:
  761. Initialize a task structure with default values. This function is implicitly
  762. called by @code{starpu_task_create}. By default, tasks initialized with
  763. @code{starpu_task_init} must be deinitialized explicitly with
  764. @code{starpu_task_deinit}. Tasks can also be initialized statically, using the
  765. constant @code{STARPU_TASK_INITIALIZER}.
  766. @item @emph{Prototype}:
  767. @code{void starpu_task_init(struct starpu_task *task);}
  768. @end table
  769. @node starpu_task_create
  770. @subsection @code{starpu_task_create} -- Allocate and Initialize a Task
  771. @table @asis
  772. @item @emph{Description}:
  773. Allocate a task structure and initialize it with default values. Tasks
  774. allocated dynamically with @code{starpu_task_create} are automatically freed when the
  775. task is terminated. If the destroy flag is explicitly unset, the resources used
  776. by the task are freed by calling
  777. @code{starpu_task_destroy}.
  778. @item @emph{Prototype}:
  779. @code{struct starpu_task *starpu_task_create(void);}
  780. @end table
  781. @node starpu_task_deinit
  782. @subsection @code{starpu_task_deinit} -- Release all the resources used by a Task
  783. @table @asis
  784. @item @emph{Description}:
  785. Release all the structures automatically allocated to execute the task. This is
  786. called automatically by @code{starpu_task_destroy}, but the task structure itself is not
  787. freed. This should be used for statically allocated tasks for instance.
  788. @item @emph{Prototype}:
  789. @code{void starpu_task_deinit(struct starpu_task *task);}
  790. @end table
  791. @node starpu_task_destroy
  792. @subsection @code{starpu_task_destroy} -- Destroy a dynamically allocated Task
  793. @table @asis
  794. @item @emph{Description}:
  795. Free the resource allocated during @code{starpu_task_create}. This function can be
  796. called automatically after the execution of a task by setting the
  797. @code{destroy} flag of the @code{starpu_task} structure (default behaviour).
  798. Calling this function on a statically allocated task results in an undefined
  799. behaviour.
  800. @item @emph{Prototype}:
  801. @code{void starpu_task_destroy(struct starpu_task *task);}
  802. @end table
  803. @node starpu_task_wait
  804. @subsection @code{starpu_task_wait} -- Wait for the termination of a Task
  805. @table @asis
  806. @item @emph{Description}:
  807. This function blocks until the task has been executed. It is not possible to
  808. synchronize with a task more than once. It is not possible to wait for
  809. synchronous or detached tasks.
  810. @item @emph{Return value}:
  811. Upon successful completion, this function returns 0. Otherwise, @code{-EINVAL}
  812. indicates that the specified task was either synchronous or detached.
  813. @item @emph{Prototype}:
  814. @code{int starpu_task_wait(struct starpu_task *task);}
  815. @end table
  816. @node starpu_task_submit
  817. @subsection @code{starpu_task_submit} -- Submit a Task
  818. @table @asis
  819. @item @emph{Description}:
  820. This function submits a task to StarPU. Calling this function does
  821. not mean that the task will be executed immediately as there can be data or task
  822. (tag) dependencies that are not fulfilled yet: StarPU will take care of
  823. scheduling this task with respect to such dependencies.
  824. This function returns immediately if the @code{synchronous} field of the
  825. @code{starpu_task} structure was set to 0, and block until the termination of
  826. the task otherwise. It is also possible to synchronize the application with
  827. asynchronous tasks by the means of tags, using the @code{starpu_tag_wait}
  828. function for instance.
  829. @item @emph{Return value}:
  830. In case of success, this function returns 0, a return value of @code{-ENODEV}
  831. means that there is no worker able to process this task (e.g. there is no GPU
  832. available and this task is only implemented for CUDA devices).
  833. @item @emph{Prototype}:
  834. @code{int starpu_task_submit(struct starpu_task *task);}
  835. @end table
  836. @node starpu_task_wait_for_all
  837. @subsection @code{starpu_task_wait_for_all} -- Wait for the termination of all Tasks
  838. @table @asis
  839. @item @emph{Description}:
  840. This function blocks until all the tasks that were submitted are terminated.
  841. @item @emph{Prototype}:
  842. @code{void starpu_task_wait_for_all(void);}
  843. @end table
  844. @c Callbacks : what can we put in callbacks ?
  845. @node Tags
  846. @section Tags
  847. @menu
  848. * starpu_tag_t:: Task identifier
  849. * starpu_tag_declare_deps:: Declare the Dependencies of a Tag
  850. * starpu_tag_declare_deps_array:: Declare the Dependencies of a Tag
  851. * starpu_tag_wait:: Block until a Tag is terminated
  852. * starpu_tag_wait_array:: Block until a set of Tags is terminated
  853. * starpu_tag_remove:: Destroy a Tag
  854. * starpu_tag_notify_from_apps:: Feed a tag explicitly
  855. @end menu
  856. @node starpu_tag_t
  857. @subsection @code{starpu_tag_t} -- Task identifier
  858. @table @asis
  859. @item @emph{Description}:
  860. It is possible to associate a task with a unique ``tag'' and to express
  861. dependencies between tasks by the means of those tags. To do so, fill the
  862. @code{tag_id} field of the @code{starpu_task} structure with a tag number (can
  863. be arbitrary) and set the @code{use_tag} field to 1.
  864. If @code{starpu_tag_declare_deps} is called with this tag number, the task will
  865. not be started until the tasks which holds the declared dependency tags are
  866. completed.
  867. @end table
  868. @node starpu_tag_declare_deps
  869. @subsection @code{starpu_tag_declare_deps} -- Declare the Dependencies of a Tag
  870. @table @asis
  871. @item @emph{Description}:
  872. Specify the dependencies of the task identified by tag @code{id}. The first
  873. argument specifies the tag which is configured, the second argument gives the
  874. number of tag(s) on which @code{id} depends. The following arguments are the
  875. tags which have to be terminated to unlock the task.
  876. This function must be called before the associated task is submitted to StarPU
  877. with @code{starpu_task_submit}.
  878. @item @emph{Remark}
  879. Because of the variable arity of @code{starpu_tag_declare_deps}, note that the
  880. last arguments @emph{must} be of type @code{starpu_tag_t}: constant values
  881. typically need to be explicitly casted. Using the
  882. @code{starpu_tag_declare_deps_array} function avoids this hazard.
  883. @item @emph{Prototype}:
  884. @code{void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...);}
  885. @item @emph{Example}:
  886. @cartouche
  887. @example
  888. /* Tag 0x1 depends on tags 0x32 and 0x52 */
  889. starpu_tag_declare_deps((starpu_tag_t)0x1,
  890. 2, (starpu_tag_t)0x32, (starpu_tag_t)0x52);
  891. @end example
  892. @end cartouche
  893. @end table
  894. @node starpu_tag_declare_deps_array
  895. @subsection @code{starpu_tag_declare_deps_array} -- Declare the Dependencies of a Tag
  896. @table @asis
  897. @item @emph{Description}:
  898. This function is similar to @code{starpu_tag_declare_deps}, except that its
  899. does not take a variable number of arguments but an array of tags of size
  900. @code{ndeps}.
  901. @item @emph{Prototype}:
  902. @code{void starpu_tag_declare_deps_array(starpu_tag_t id, unsigned ndeps, starpu_tag_t *array);}
  903. @item @emph{Example}:
  904. @cartouche
  905. @example
  906. /* Tag 0x1 depends on tags 0x32 and 0x52 */
  907. starpu_tag_t tag_array[2] = @{0x32, 0x52@};
  908. starpu_tag_declare_deps_array((starpu_tag_t)0x1, 2, tag_array);
  909. @end example
  910. @end cartouche
  911. @end table
  912. @node starpu_tag_wait
  913. @subsection @code{starpu_tag_wait} -- Block until a Tag is terminated
  914. @table @asis
  915. @item @emph{Description}:
  916. This function blocks until the task associated to tag @code{id} has been
  917. executed. This is a blocking call which must therefore not be called within
  918. tasks or callbacks, but only from the application directly. It is possible to
  919. synchronize with the same tag multiple times, as long as the
  920. @code{starpu_tag_remove} function is not called. Note that it is still
  921. possible to synchronize with a tag associated to a task which @code{starpu_task}
  922. data structure was freed (e.g. if the @code{destroy} flag of the
  923. @code{starpu_task} was enabled).
  924. @item @emph{Prototype}:
  925. @code{void starpu_tag_wait(starpu_tag_t id);}
  926. @end table
  927. @node starpu_tag_wait_array
  928. @subsection @code{starpu_tag_wait_array} -- Block until a set of Tags is terminated
  929. @table @asis
  930. @item @emph{Description}:
  931. This function is similar to @code{starpu_tag_wait} except that it blocks until
  932. @emph{all} the @code{ntags} tags contained in the @code{id} array are
  933. terminated.
  934. @item @emph{Prototype}:
  935. @code{void starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id);}
  936. @end table
  937. @node starpu_tag_remove
  938. @subsection @code{starpu_tag_remove} -- Destroy a Tag
  939. @table @asis
  940. @item @emph{Description}:
  941. This function releases the resources associated to tag @code{id}. It can be
  942. called once the corresponding task has been executed and when there is
  943. no other tag that depend on this tag anymore.
  944. @item @emph{Prototype}:
  945. @code{void starpu_tag_remove(starpu_tag_t id);}
  946. @end table
  947. @node starpu_tag_notify_from_apps
  948. @subsection @code{starpu_tag_notify_from_apps} -- Feed a Tag explicitly
  949. @table @asis
  950. @item @emph{Description}:
  951. This function explicitly unlocks tag @code{id}. It may be useful in the
  952. case of applications which execute part of their computation outside StarPU
  953. tasks (e.g. third-party libraries). It is also provided as a
  954. convenient tool for the programmer, for instance to entirely construct the task
  955. DAG before actually giving StarPU the opportunity to execute the tasks.
  956. @item @emph{Prototype}:
  957. @code{void starpu_tag_notify_from_apps(starpu_tag_t id);}
  958. @end table
  959. @node CUDA extensions
  960. @section CUDA extensions
  961. @c void starpu_data_malloc_pinned_if_possible(float **A, size_t dim);
  962. @c starpu_helper_cublas_init TODO
  963. @c starpu_helper_cublas_shutdown TODO
  964. @menu
  965. * starpu_cuda_get_local_stream:: Get current worker's CUDA stream
  966. * starpu_helper_cublas_init:: Initialize CUBLAS on every CUDA device
  967. * starpu_helper_cublas_shutdown:: Deinitialize CUBLAS on every CUDA device
  968. @end menu
  969. @node starpu_cuda_get_local_stream
  970. @subsection @code{starpu_cuda_get_local_stream} -- Get current worker's CUDA stream
  971. @table @asis
  972. @item @emph{Description}:
  973. StarPU provides a stream for every CUDA device controlled by StarPU. This
  974. function is only provided for convenience so that programmers can easily use
  975. asynchronous operations within codelets without having to create a stream by
  976. hand. Note that the application is not forced to use the stream provided by
  977. @code{starpu_cuda_get_local_stream} and may also create its own streams.
  978. @item @emph{Prototype}:
  979. @code{cudaStream_t *starpu_cuda_get_local_stream(void);}
  980. @end table
  981. @node starpu_helper_cublas_init
  982. @subsection @code{starpu_helper_cublas_init} -- Initialize CUBLAS on every CUDA device
  983. @table @asis
  984. @item @emph{Description}:
  985. The CUBLAS library must be initialized prior to any CUBLAS call. Calling
  986. @code{starpu_helper_cublas_init} will initialize CUBLAS on every CUDA device
  987. controlled by StarPU. This call blocks until CUBLAS has been properly
  988. initialized on every device.
  989. @item @emph{Prototype}:
  990. @code{void starpu_helper_cublas_init(void);}
  991. @end table
  992. @node starpu_helper_cublas_shutdown
  993. @subsection @code{starpu_helper_cublas_shutdown} -- Deinitialize CUBLAS on every CUDA device
  994. @table @asis
  995. @item @emph{Description}:
  996. This function synchronously deinitializes the CUBLAS library on every CUDA device.
  997. @item @emph{Prototype}:
  998. @code{void starpu_helper_cublas_shutdown(void);}
  999. @end table
  1000. @node OpenCL extensions
  1001. @section OpenCL extensions
  1002. @menu
  1003. * Enabling OpenCL:: Enabling OpenCL
  1004. * Compiling OpenCL codelets:: Compiling OpenCL codelets
  1005. @end menu
  1006. @node Enabling OpenCL
  1007. @subsection Enabling OpenCL
  1008. On GPU devices which can run both CUDA and OpenCL, CUDA will be
  1009. enabled by default. To enable OpenCL, you need either to disable CUDA
  1010. when configuring StarPU:
  1011. @example
  1012. $ ./configure --disable-cuda
  1013. @end example
  1014. or when running applications:
  1015. @example
  1016. $ STARPU_NCUDA=0 ./application
  1017. @end example
  1018. OpenCL will automatically be started on any device not yet used by
  1019. CUDA. So on a machine running 4 GPUS, it is therefore possible to
  1020. enable CUDA on 2 devices, and OpenCL on the 2 other devices by doing
  1021. so:
  1022. @example
  1023. $ STARPU_NCUDA=2 ./application
  1024. @end example
  1025. @node Compiling OpenCL codelets
  1026. @subsection Compiling OpenCL codelets
  1027. TODO
  1028. @node Cell extensions
  1029. @section Cell extensions
  1030. nothing yet.
  1031. @node Miscellaneous
  1032. @section Miscellaneous helpers
  1033. @menu
  1034. * starpu_execute_on_each_worker:: Execute a function on a subset of workers
  1035. @end menu
  1036. @node starpu_execute_on_each_worker
  1037. @subsection @code{starpu_execute_on_each_worker} -- Execute a function on a subset of workers
  1038. @table @asis
  1039. @item @emph{Description}:
  1040. When calling this method, the offloaded function specified by the first argument is
  1041. executed by every StarPU worker that may execute the function.
  1042. The second argument is passed to the offloaded function.
  1043. The last argument specifies on which types of processing units the function
  1044. should be executed. Similarly to the @code{where} field of the
  1045. @code{starpu_codelet} structure, it is possible to specify that the function
  1046. should be executed on every CUDA device and every CPU by passing
  1047. @code{STARPU_CPU|STARPU_CUDA}.
  1048. This function blocks until the function has been executed on every appropriate
  1049. processing units, so that it may not be called from a callback function for
  1050. instance.
  1051. @item @emph{Prototype}:
  1052. @code{void starpu_execute_on_each_worker(void (*func)(void *), void *arg, uint32_t where);}
  1053. @end table
  1054. @c ---------------------------------------------------------------------
  1055. @c Basic Examples
  1056. @c ---------------------------------------------------------------------
  1057. @node Basic Examples
  1058. @chapter Basic Examples
  1059. @menu
  1060. * Compiling and linking:: Compiling and Linking Options
  1061. * Hello World:: Submitting Tasks
  1062. * Scaling a Vector:: Manipulating Data
  1063. * Scaling a Vector (hybrid):: Handling Heterogeneous Architectures
  1064. @end menu
  1065. @node Compiling and linking
  1066. @section Compiling and linking options
  1067. The Makefile could for instance contain the following lines to define which
  1068. options must be given to the compiler and to the linker:
  1069. @cartouche
  1070. @example
  1071. CFLAGS+=$$(pkg-config --cflags libstarpu)
  1072. LIBS+=$$(pkg-config --libs libstarpu)
  1073. @end example
  1074. @end cartouche
  1075. @node Hello World
  1076. @section Hello World
  1077. In this section, we show how to implement a simple program that submits a task to StarPU.
  1078. @subsection Required Headers
  1079. The @code{starpu.h} header should be included in any code using StarPU.
  1080. @cartouche
  1081. @example
  1082. #include <starpu.h>
  1083. @end example
  1084. @end cartouche
  1085. @subsection Defining a Codelet
  1086. @cartouche
  1087. @example
  1088. void cpu_func(void *buffers[], void *cl_arg)
  1089. @{
  1090. float *array = cl_arg;
  1091. printf("Hello world (array = @{%f, %f@} )\n", array[0], array[1]);
  1092. @}
  1093. starpu_codelet cl =
  1094. @{
  1095. .where = STARPU_CPU,
  1096. .cpu_func = cpu_func,
  1097. .nbuffers = 0
  1098. @};
  1099. @end example
  1100. @end cartouche
  1101. A codelet is a structure that represents a computational kernel. Such a codelet
  1102. may contain an implementation of the same kernel on different architectures
  1103. (e.g. CUDA, Cell's SPU, x86, ...).
  1104. The @code{nbuffers} field specifies the number of data buffers that are
  1105. manipulated by the codelet: here the codelet does not access or modify any data
  1106. that is controlled by our data management library. Note that the argument
  1107. passed to the codelet (the @code{cl_arg} field of the @code{starpu_task}
  1108. structure) does not count as a buffer since it is not managed by our data
  1109. management library.
  1110. @c TODO need a crossref to the proper description of "where" see bla for more ...
  1111. We create a codelet which may only be executed on the CPUs. The @code{where}
  1112. field is a bitmask that defines where the codelet may be executed. Here, the
  1113. @code{STARPU_CPU} value means that only CPUs can execute this codelet
  1114. (@pxref{Codelets and Tasks} for more details on this field).
  1115. When a CPU core executes a codelet, it calls the @code{cpu_func} function,
  1116. which @emph{must} have the following prototype:
  1117. @code{void (*cpu_func)(void *buffers[], void *cl_arg)}
  1118. In this example, we can ignore the first argument of this function which gives a
  1119. description of the input and output buffers (e.g. the size and the location of
  1120. the matrices). The second argument is a pointer to a buffer passed as an
  1121. argument to the codelet by the means of the @code{cl_arg} field of the
  1122. @code{starpu_task} structure.
  1123. @c TODO rewrite so that it is a little clearer ?
  1124. Be aware that this may be a pointer to a
  1125. @emph{copy} of the actual buffer, and not the pointer given by the programmer:
  1126. if the codelet modifies this buffer, there is no guarantee that the initial
  1127. buffer will be modified as well: this for instance implies that the buffer
  1128. cannot be used as a synchronization medium.
  1129. @subsection Submitting a Task
  1130. @cartouche
  1131. @example
  1132. void callback_func(void *callback_arg)
  1133. @{
  1134. printf("Callback function (arg %x)\n", callback_arg);
  1135. @}
  1136. int main(int argc, char **argv)
  1137. @{
  1138. /* initialize StarPU */
  1139. starpu_init(NULL);
  1140. struct starpu_task *task = starpu_task_create();
  1141. task->cl = &cl;
  1142. float *array[2] = @{1.0f, -1.0f@};
  1143. task->cl_arg = &array;
  1144. task->cl_arg_size = 2*sizeof(float);
  1145. task->callback_func = callback_func;
  1146. task->callback_arg = 0x42;
  1147. /* starpu_task_submit will be a blocking call */
  1148. task->synchronous = 1;
  1149. /* submit the task to StarPU */
  1150. starpu_task_submit(task);
  1151. /* terminate StarPU */
  1152. starpu_shutdown();
  1153. return 0;
  1154. @}
  1155. @end example
  1156. @end cartouche
  1157. Before submitting any tasks to StarPU, @code{starpu_init} must be called. The
  1158. @code{NULL} argument specifies that we use default configuration. Tasks cannot
  1159. be submitted after the termination of StarPU by a call to
  1160. @code{starpu_shutdown}.
  1161. In the example above, a task structure is allocated by a call to
  1162. @code{starpu_task_create}. This function only allocates and fills the
  1163. corresponding structure with the default settings (@pxref{starpu_task_create}),
  1164. but it does not submit the task to StarPU.
  1165. @c not really clear ;)
  1166. The @code{cl} field is a pointer to the codelet which the task will
  1167. execute: in other words, the codelet structure describes which computational
  1168. kernel should be offloaded on the different architectures, and the task
  1169. structure is a wrapper containing a codelet and the piece of data on which the
  1170. codelet should operate.
  1171. The optional @code{cl_arg} field is a pointer to a buffer (of size
  1172. @code{cl_arg_size}) with some parameters for the kernel
  1173. described by the codelet. For instance, if a codelet implements a computational
  1174. kernel that multiplies its input vector by a constant, the constant could be
  1175. specified by the means of this buffer.
  1176. Once a task has been executed, an optional callback function can be called.
  1177. While the computational kernel could be offloaded on various architectures, the
  1178. callback function is always executed on a CPU. The @code{callback_arg}
  1179. pointer is passed as an argument of the callback. The prototype of a callback
  1180. function must be:
  1181. @cartouche
  1182. @example
  1183. void (*callback_function)(void *);
  1184. @end example
  1185. @end cartouche
  1186. If the @code{synchronous} field is non-null, task submission will be
  1187. synchronous: the @code{starpu_task_submit} function will not return until the
  1188. task was executed. Note that the @code{starpu_shutdown} method does not
  1189. guarantee that asynchronous tasks have been executed before it returns.
  1190. @node Scaling a Vector
  1191. @section Manipulating Data: Scaling a Vector
  1192. The previous example has shown how to submit tasks. In this section we show how
  1193. StarPU tasks can manipulate data.
  1194. Programmers can describe the data layout of their application so that StarPU is
  1195. responsible for enforcing data coherency and availability across the machine.
  1196. Instead of handling complex (and non-portable) mechanisms to perform data
  1197. movements, programmers only declare which piece of data is accessed and/or
  1198. modified by a task, and StarPU makes sure that when a computational kernel
  1199. starts somewhere (e.g. on a GPU), its data are available locally.
  1200. Before submitting those tasks, the programmer first needs to declare the
  1201. different pieces of data to StarPU using the @code{starpu_*_data_register}
  1202. functions. To ease the development of applications for StarPU, it is possible
  1203. to describe multiple types of data layout. A type of data layout is called an
  1204. @b{interface}. By default, there are different interfaces available in StarPU:
  1205. here we will consider the @b{vector interface}.
  1206. The following lines show how to declare an array of @code{n} elements of type
  1207. @code{float} using the vector interface:
  1208. @cartouche
  1209. @example
  1210. float tab[n];
  1211. starpu_data_handle tab_handle;
  1212. starpu_vector_data_register(&tab_handle, 0, tab, n, sizeof(float));
  1213. @end example
  1214. @end cartouche
  1215. The first argument, called the @b{data handle}, is an opaque pointer which
  1216. designates the array in StarPU. This is also the structure which is used to
  1217. describe which data is used by a task. The second argument is the node number
  1218. where the data currently resides. Here it is 0 since the @code{tab} array is in
  1219. the main memory. Then comes the pointer @code{tab} where the data can be found,
  1220. the number of elements in the vector and the size of each element.
  1221. It is possible to construct a StarPU
  1222. task that multiplies this vector by a constant factor:
  1223. @cartouche
  1224. @example
  1225. float factor = 3.0;
  1226. struct starpu_task *task = starpu_task_create();
  1227. task->cl = &cl;
  1228. task->buffers[0].handle = tab_handle;
  1229. task->buffers[0].mode = STARPU_RW;
  1230. task->cl_arg = &factor;
  1231. task->cl_arg_size = sizeof(float);
  1232. task->synchronous = 1;
  1233. starpu_task_submit(task);
  1234. @end example
  1235. @end cartouche
  1236. Since the factor is constant, it does not need a preliminary declaration, and
  1237. can just be passed through the @code{cl_arg} pointer like in the previous
  1238. example. The vector parameter is described by its handle.
  1239. There are two fields in each element of the @code{buffers} array.
  1240. @code{handle} is the handle of the data, and @code{mode} specifies how the
  1241. kernel will access the data (@code{STARPU_R} for read-only, @code{STARPU_W} for
  1242. write-only and @code{STARPU_RW} for read and write access).
  1243. The definition of the codelet can be written as follows:
  1244. @cartouche
  1245. @example
  1246. void scal_func(void *buffers[], void *cl_arg)
  1247. @{
  1248. unsigned i;
  1249. float *factor = cl_arg;
  1250. struct starpu_vector_interface_s *vector = buffers[0];
  1251. /* length of the vector */
  1252. unsigned n = STARPU_GET_VECTOR_NX(vector);
  1253. /* local copy of the vector pointer */
  1254. float *val = (float *)STARPU_GET_VECTOR_PTR(vector);
  1255. for (i = 0; i < n; i++)
  1256. val[i] *= *factor;
  1257. @}
  1258. starpu_codelet cl = @{
  1259. .where = STARPU_CPU,
  1260. .cpu_func = scal_func,
  1261. .nbuffers = 1
  1262. @};
  1263. @end example
  1264. @end cartouche
  1265. The second argument of the @code{scal_func} function contains a pointer to the
  1266. parameters of the codelet (given in @code{task->cl_arg}), so that we read the
  1267. constant factor from this pointer. The first argument is an array that gives
  1268. a description of every buffers passed in the @code{task->buffers}@ array. The
  1269. size of this array is given by the @code{nbuffers} field of the codelet
  1270. structure. For the sake of generality, this array contains pointers to the
  1271. different interfaces describing each buffer. In the case of the @b{vector
  1272. interface}, the location of the vector (resp. its length) is accessible in the
  1273. @code{ptr} (resp. @code{nx}) of this array. Since the vector is accessed in a
  1274. read-write fashion, any modification will automatically affect future accesses
  1275. to this vector made by other tasks.
  1276. @node Scaling a Vector (hybrid)
  1277. @section Vector Scaling on an Hybrid CPU/GPU Machine
  1278. Contrary to the previous examples, the task submitted in this example may not
  1279. only be executed by the CPUs, but also by a CUDA device.
  1280. @menu
  1281. * Source code:: Source of the StarPU application
  1282. * Compilation and execution:: Executing the StarPU application
  1283. @end menu
  1284. @node Source code
  1285. @subsection Source code
  1286. The CUDA implementation can be written as follows. It needs to be
  1287. compiled with a CUDA compiler such as nvcc, the NVIDIA CUDA compiler
  1288. driver.
  1289. @cartouche
  1290. @example
  1291. #include <starpu.h>
  1292. static __global__ void vector_mult_cuda(float *val, unsigned n,
  1293. float factor)
  1294. @{
  1295. unsigned i;
  1296. for(i = 0 ; i < n ; i++)
  1297. val[i] *= factor;
  1298. @}
  1299. extern "C" void scal_cuda_func(void *buffers[], void *_args)
  1300. @{
  1301. float *factor = (float *)_args;
  1302. struct starpu_vector_interface_s *vector = (struct starpu_vector_interface_s *) buffers[0];
  1303. /* length of the vector */
  1304. unsigned n = STARPU_GET_VECTOR_NX(vector);
  1305. /* local copy of the vector pointer */
  1306. float *val = (float *)STARPU_GET_VECTOR_PTR(vector);
  1307. /* TODO: use more blocks and threads in blocks */
  1308. vector_mult_cuda<<<1,1>>>(val, n, *factor);
  1309. cudaThreadSynchronize();
  1310. @}
  1311. @end example
  1312. @end cartouche
  1313. The CPU implementation is the same as in the previous section.
  1314. Here is the source of the main application. You can notice the value of the
  1315. field @code{where} for the codelet. We specify
  1316. @code{STARPU_CPU|STARPU_CUDA} to indicate to StarPU that the codelet
  1317. can be executed either on a CPU or on a CUDA device.
  1318. @cartouche
  1319. @example
  1320. #include <starpu.h>
  1321. #define NX 5
  1322. extern void scal_cuda_func(void *buffers[], void *_args);
  1323. extern void scal_func(void *buffers[], void *_args);
  1324. /* @b{Definition of the codelet} */
  1325. static starpu_codelet cl = @{
  1326. .where = STARPU_CPU|STARPU_CUDA; /* @b{It can be executed on a CPU} */
  1327. /* @b{or on a CUDA device} */
  1328. .cuda_func = scal_cuda_func;
  1329. .cpu_func = scal_func;
  1330. .nbuffers = 1;
  1331. @}
  1332. int main(int argc, char **argv)
  1333. @{
  1334. float *vector;
  1335. int i, ret;
  1336. float factor=3.0;
  1337. struct starpu_task *task;
  1338. starpu_data_handle tab_handle;
  1339. starpu_init(NULL); /* @b{Initialising StarPU} */
  1340. vector = (float*)malloc(NX*sizeof(float));
  1341. assert(vector);
  1342. for(i=0 ; i<NX ; i++) vector[i] = i;
  1343. @end example
  1344. @end cartouche
  1345. @cartouche
  1346. @example
  1347. /* @b{Registering data within StarPU} */
  1348. starpu_vector_data_register(&tab_handle, 0, (uintptr_t)vector,
  1349. NX, sizeof(float));
  1350. /* @b{Definition of the task} */
  1351. task = starpu_task_create();
  1352. task->cl = &cl;
  1353. task->callback_func = NULL;
  1354. task->buffers[0].handle = tab_handle;
  1355. task->buffers[0].mode = STARPU_RW;
  1356. task->cl_arg = &factor;
  1357. @end example
  1358. @end cartouche
  1359. @cartouche
  1360. @example
  1361. /* @b{Submitting the task} */
  1362. ret = starpu_task_submit(task);
  1363. if (ret == -ENODEV) @{
  1364. fprintf(stderr, "No worker may execute this task\n");
  1365. return 1;
  1366. @}
  1367. /* @b{Waiting for its termination} */
  1368. starpu_task_wait_for_all();
  1369. /* @b{Update the vector in RAM} */
  1370. starpu_data_sync_with_mem(tab_handle, STARPU_R);
  1371. @end example
  1372. @end cartouche
  1373. @cartouche
  1374. @example
  1375. /* @b{Access the data} */
  1376. for(i=0 ; i<NX; i++) @{
  1377. fprintf(stderr, "%f ", vector[i]);
  1378. @}
  1379. fprintf(stderr, "\n");
  1380. /* @b{Release the data and shutdown StarPU} */
  1381. starpu_data_release_from_mem(tab_handle);
  1382. starpu_shutdown();
  1383. return 0;
  1384. @}
  1385. @end example
  1386. @end cartouche
  1387. @node Compilation and execution
  1388. @subsection Compilation and execution
  1389. Let's suppose StarPU has been installed in the directory
  1390. @code{$STARPU_DIR}. As explained in @ref{pkg-config configuration},
  1391. the variable @code{PKG_CONFIG_PATH} needs to be set. It is also
  1392. necessary to set the variable @code{LD_LIBRARY_PATH} to locate dynamic
  1393. libraries at runtime.
  1394. @example
  1395. $ PKG_CONFIG_PATH=$STARPU_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
  1396. $ LD_LIBRARY_PATH=$STARPU_DIR/lib:$LD_LIBRARY_PATH
  1397. @end example
  1398. It is then possible to compile the application using the following
  1399. makefile:
  1400. @cartouche
  1401. @example
  1402. CFLAGS += $(shell pkg-config --cflags libstarpu)
  1403. LDFLAGS += $(shell pkg-config --libs libstarpu)
  1404. CC = gcc
  1405. vector: vector.o vector_cpu.o vector_cuda.o
  1406. %.o: %.cu
  1407. nvcc $(CFLAGS) $< -c $@
  1408. clean:
  1409. rm -f vector *.o
  1410. @end example
  1411. @end cartouche
  1412. @example
  1413. $ make
  1414. @end example
  1415. and to execute it, with the default configuration:
  1416. @example
  1417. $ ./vector
  1418. 0.000000 3.000000 6.000000 9.000000 12.000000
  1419. @end example
  1420. or for example, by disabling CPU devices:
  1421. @example
  1422. $ STARPU_NCPUS=0 ./vector
  1423. 0.000000 3.000000 6.000000 9.000000 12.000000
  1424. @end example
  1425. or by disabling CUDA devices:
  1426. @example
  1427. $ STARPU_NCUDA=0 ./vector
  1428. 0.000000 3.000000 6.000000 9.000000 12.000000
  1429. @end example
  1430. @c TODO: Add performance model example (and update basic_examples)
  1431. @c ---------------------------------------------------------------------
  1432. @c Advanced Topics
  1433. @c ---------------------------------------------------------------------
  1434. @node Advanced Topics
  1435. @chapter Advanced Topics
  1436. @bye