starpu.texi 62 KB

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