000_introduction.doxy 11 KB

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