000_introduction.doxy 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2019 CNRS
  4. * Copyright (C) 2011-2013,2016 Inria
  5. * Copyright (C) 2009-2011,2014,2016,2019 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. /*! \mainpage Introduction
  19. \htmlonly
  20. <h1><a class="anchor" id="Foreword"></a>Foreword</h1>
  21. \endhtmlonly
  22. \htmlinclude version.html
  23. \htmlinclude foreword.html
  24. \section Motivation Motivation
  25. // This is a comment and it will be removed before the file is processed by doxygen
  26. // complex machines with heterogeneous cores/devices
  27. The use of specialized hardware such as accelerators or coprocessors offers an
  28. interesting approach to overcome the physical limits encountered by processor
  29. architects. As a result, many machines are now equipped with one or several
  30. accelerators (e.g. a GPU), in addition to the usual processor(s). While a lot of
  31. efforts have been devoted to offload computation onto such accelerators, very
  32. little attention as been paid to portability concerns on the one hand, and to the
  33. possibility of having heterogeneous accelerators and processors to interact on the other hand.
  34. StarPU is a runtime system that offers support for heterogeneous multicore
  35. architectures, it not only offers a unified view of the computational resources
  36. (i.e. CPUs and accelerators at the same time), but it also takes care of
  37. efficiently mapping and executing tasks onto an heterogeneous machine while
  38. transparently handling low-level issues such as data transfers in a portable
  39. fashion.
  40. // this leads to a complicated distributed memory design
  41. // which is not (easily) manageable by hand
  42. // added value/benefits of StarPU
  43. // - portability
  44. // - scheduling, perf. portability
  45. \section StarPUInANutshell StarPU in a Nutshell
  46. StarPU is a software tool aiming to allow programmers to exploit the
  47. computing power of the available CPUs and GPUs, while relieving them
  48. from the need to specially adapt their programs to the target machine
  49. and processing units.
  50. At the core of StarPU is its runtime support library, which is
  51. responsible for scheduling application-provided tasks on heterogeneous
  52. CPU/GPU machines. In addition, StarPU comes with programming language
  53. support, in the form of an OpenCL front-end (\ref SOCLOpenclExtensions).
  54. StarPU's runtime and programming language extensions support a
  55. task-based programming model. Applications submit computational
  56. tasks, with CPU and/or GPU implementations, and StarPU schedules these
  57. tasks and associated data transfers on available CPUs and GPUs. The
  58. data that a task manipulates are automatically transferred among
  59. accelerators and the main memory, so that programmers are freed from the
  60. scheduling issues and technical details associated with these transfers.
  61. StarPU takes particular care of scheduling tasks efficiently, using
  62. well-known algorithms from the literature (\ref TaskSchedulingPolicy).
  63. In addition, it allows scheduling experts, such as compiler or
  64. computational library developers, to implement custom scheduling
  65. policies in a portable fashion (\ref HowToDefineANewSchedulingPolicy).
  66. The remainder of this section describes the main concepts used in StarPU.
  67. A video is available on the StarPU website
  68. http://starpu.gforge.inria.fr/ that presents these concepts in 26 minutes.
  69. Some tutorials are also available on http://starpu.gforge.inria.fr/tutorials/
  70. // explain the notion of codelet and task (i.e. g(A, B)
  71. \subsection CodeletAndTasks Codelet and Tasks
  72. One of the StarPU primary data structures is the \b codelet. A codelet describes a
  73. computational kernel that can possibly be implemented on multiple architectures
  74. such as a CPU, a CUDA device or an OpenCL device.
  75. // TODO insert illustration f: f_spu, f_cpu, ...
  76. Another important data structure is the \b task. Executing a StarPU task
  77. consists in applying a codelet on a data set, on one of the architectures on
  78. which the codelet is implemented. A task thus describes the codelet that it
  79. uses, but also which data are accessed, and how they are
  80. accessed during the computation (read and/or write).
  81. StarPU tasks are asynchronous: submitting a task to StarPU is a non-blocking
  82. operation. The task structure can also specify a \b callback function that is
  83. called once StarPU has properly executed the task. It also contains optional
  84. fields that the application may use to give hints to the scheduler (such as
  85. priority levels).
  86. By default, task dependencies are inferred from data dependency (sequential
  87. coherency) by StarPU. The application can however disable sequential coherency
  88. for some data, and dependencies can be specifically expressed.
  89. A task may be identified by a unique 64-bit number chosen by the application
  90. which we refer as a \b tag.
  91. Task dependencies can be enforced either by the means of callback functions, by
  92. submitting other tasks, or by expressing dependencies
  93. between tags (which can thus correspond to tasks that have not yet been submitted).
  94. // TODO insert illustration f(Ar, Brw, Cr) + ..
  95. // DSM
  96. \subsection StarPUDataManagementLibrary StarPU Data Management Library
  97. Because StarPU schedules tasks at runtime, data transfers have to be
  98. done automatically and ``just-in-time'' between processing units,
  99. relieving application programmers from explicit data transfers.
  100. Moreover, to avoid unnecessary transfers, StarPU keeps data
  101. where it was last needed, even if was modified there, and it
  102. allows multiple copies of the same data to reside at the same time on
  103. several processing units as long as it is not modified.
  104. \section ApplicationTaskification Application Taskification
  105. TODO
  106. // TODO: section describing what taskifying an application means: before
  107. // porting to StarPU, turn the program into:
  108. // "pure" functions, which only access data from their passed parameters
  109. // a main function which just calls these pure functions
  110. // and then it's trivial to use StarPU or any other kind of task-based library:
  111. // simply replace calling the function with submitting a task.
  112. \section Glossary Glossary
  113. A \b codelet records pointers to various implementations of the same
  114. theoretical function.
  115. A <b>memory node</b> can be either the main RAM, GPU-embedded memory or a disk memory.
  116. A \b bus is a link between memory nodes.
  117. A <b>data handle</b> keeps track of replicates of the same data (\b registered by the
  118. application) over various memory nodes. The data management library manages to
  119. keep them coherent.
  120. The \b home memory node of a data handle is the memory node from which the data
  121. was registered (usually the main memory node).
  122. A \b task represents a scheduled execution of a codelet on some data handles.
  123. A \b tag is a rendez-vous point. Tasks typically have their own tag, and can
  124. depend on other tags. The value is chosen by the application.
  125. A \b worker execute tasks. There is typically one per CPU computation core and
  126. one per accelerator (for which a whole CPU core is dedicated).
  127. A \b driver drives a given kind of workers. There are currently CPU, CUDA,
  128. and OpenCL drivers. They usually start several workers to actually drive
  129. them.
  130. A <b>performance model</b> is a (dynamic or static) model of the performance of a
  131. given codelet. Codelets can have execution time performance model as well as
  132. energy consumption performance models.
  133. A data \b interface describes the layout of the data: for a vector, a pointer
  134. for the start, the number of elements and the size of elements ; for a matrix, a
  135. pointer for the start, the number of elements per row, the offset between rows,
  136. and the size of each element ; etc. To access their data, codelet functions are
  137. given interfaces for the local memory node replicates of the data handles of the
  138. scheduled task.
  139. \b Partitioning data means dividing the data of a given data handle (called
  140. \b father) into a series of \b children data handles which designate various
  141. portions of the former.
  142. A \b filter is the function which computes children data handles from a father
  143. data handle, and thus describes how the partitioning should be done (horizontal,
  144. vertical, etc.)
  145. \b Acquiring a data handle can be done from the main application, to safely
  146. access the data of a data handle from its home node, without having to
  147. unregister it.
  148. \section ResearchPapers Research Papers
  149. Research papers about StarPU can be found at
  150. http://starpu.gforge.inria.fr/publications/.
  151. A good overview is available in the research report at
  152. http://hal.archives-ouvertes.fr/inria-00467677.
  153. \section StarPUApplications StarPU Applications
  154. You can first have a look at the chapters \ref BasicExamples and \ref AdvancedExamples.
  155. A tutorial is also installed in the directory <c>share/doc/starpu/tutorial/</c>.
  156. Many examples are also available in the StarPU sources in the directory
  157. <c>examples/</c>. Simple examples include:
  158. <dl>
  159. <dt> <c>incrementer/</c> </dt>
  160. <dd> Trivial incrementation test. </dd>
  161. <dt> <c>basic_examples/</c> </dt>
  162. <dd>
  163. Simple documented Hello world and vector/scalar product (as
  164. shown in \ref BasicExamples), matrix
  165. product examples (as shown in \ref PerformanceModelExample), an example using the blocked matrix data
  166. interface, an example using the variable data interface, and an example
  167. using different formats on CPUs and GPUs.
  168. </dd>
  169. <dt> <c>matvecmult/</c></dt>
  170. <dd>
  171. OpenCL example from NVidia, adapted to StarPU.
  172. </dd>
  173. <dt> <c>axpy/</c></dt>
  174. <dd>
  175. AXPY CUBLAS operation adapted to StarPU.
  176. </dd>
  177. <dt> <c>native_fortran/</c> </dt>
  178. <dd>
  179. Example of using StarPU's native Fortran support.
  180. </dd>
  181. <dt> <c>fortran90/</c> </dt>
  182. <dd>
  183. Example of Fortran 90 bindings, using C marshalling wrappers.
  184. </dd>
  185. <dt> <c>fortran/</c> </dt>
  186. <dd>
  187. Example of Fortran 77 bindings, using C marshalling wrappers.
  188. </dd>
  189. </dl>
  190. More advanced examples include:
  191. <dl>
  192. <dt><c>filters/</c></dt>
  193. <dd>
  194. Examples using filters, as shown in \ref PartitioningData.
  195. </dd>
  196. <dt><c>lu/</c></dt>
  197. <dd>
  198. LU matrix factorization, see for instance <c>xlu_implicit.c</c>
  199. </dd>
  200. <dt><c>cholesky/</c></dt>
  201. <dd>
  202. Cholesky matrix factorization, see for instance <c>cholesky_implicit.c</c>.
  203. </dd>
  204. </dl>
  205. \section FurtherReading Further Reading
  206. The documentation chapters include
  207. <ul>
  208. <li> Part 1: StarPU Basics
  209. <ul>
  210. <li> \ref BuildingAndInstallingStarPU
  211. <li> \ref BasicExamples
  212. </ul>
  213. <li> Part 2: StarPU Quick Programming Guide
  214. <ul>
  215. <li> \ref AdvancedExamples
  216. <li> \ref CheckListWhenPerformanceAreNotThere
  217. </ul>
  218. <li> Part 3: StarPU Inside
  219. <ul>
  220. <li> \ref TasksInStarPU
  221. <li> \ref DataManagement
  222. <li> \ref Scheduling
  223. <li> \ref SchedulingContexts
  224. <li> \ref SchedulingContextHypervisor
  225. <li> \ref HowToDefineANewSchedulingPolicy
  226. <li> \ref DebuggingTools
  227. <li> \ref OnlinePerformanceTools
  228. <li> \ref OfflinePerformanceTools
  229. <li> \ref FrequentlyAskedQuestions
  230. </ul>
  231. <li> Part 4: StarPU Extensions
  232. <ul>
  233. <li> \ref OutOfCore
  234. <li> \ref MPISupport
  235. <li> \ref FaultTolerance
  236. <li> \ref FFTSupport
  237. <li> \ref MICSupport
  238. <li> \ref NativeFortranSupport
  239. <li> \ref SOCLOpenclExtensions
  240. <li> \ref SimGridSupport
  241. <li> \ref OpenMPRuntimeSupport
  242. <li> \ref ClusteringAMachine
  243. </ul>
  244. <li> Part 5: StarPU Reference API
  245. <ul>
  246. <li> \ref ExecutionConfigurationThroughEnvironmentVariables
  247. <li> \ref CompilationConfiguration
  248. <li> \ref ModuleDocumentation
  249. <li> \ref FileDocumentation
  250. <li> \ref deprecated
  251. </ul>
  252. <li> Part: Appendix
  253. <ul>
  254. <li> \ref FullSourceCodeVectorScal
  255. <li> \ref GNUFreeDocumentationLicense
  256. </ul>
  257. </ul>
  258. Make sure to have had a look at those too!
  259. */