introduction.texi 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. @c -*-texinfo-*-
  2. @c This file is part of the StarPU Handbook.
  3. @c Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. @c Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. @c Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
  6. @c See the file starpu.texi for copying conditions.
  7. @node Introduction
  8. @chapter Introduction to StarPU
  9. @menu
  10. * Motivation:: Why StarPU ?
  11. * StarPU in a Nutshell:: The Fundamentals of StarPU
  12. @end menu
  13. @node Motivation
  14. @section Motivation
  15. @c complex machines with heterogeneous cores/devices
  16. The use of specialized hardware such as accelerators or coprocessors offers an
  17. interesting approach to overcome the physical limits encountered by processor
  18. architects. As a result, many machines are now equipped with one or several
  19. accelerators (e.g. a GPU), in addition to the usual processor(s). While a lot of
  20. efforts have been devoted to offload computation onto such accelerators, very
  21. little attention as been paid to portability concerns on the one hand, and to the
  22. possibility of having heterogeneous accelerators and processors to interact on the other hand.
  23. StarPU is a runtime system that offers support for heterogeneous multicore
  24. architectures, it not only offers a unified view of the computational resources
  25. (i.e. CPUs and accelerators at the same time), but it also takes care of
  26. efficiently mapping and executing tasks onto an heterogeneous machine while
  27. transparently handling low-level issues such as data transfers in a portable
  28. fashion.
  29. @c this leads to a complicated distributed memory design
  30. @c which is not (easily) manageable by hand
  31. @c added value/benefits of StarPU
  32. @c - portability
  33. @c - scheduling, perf. portability
  34. @node StarPU in a Nutshell
  35. @section StarPU in a Nutshell
  36. @menu
  37. * Codelet and Tasks::
  38. * StarPU Data Management Library::
  39. * Glossary::
  40. * Research Papers::
  41. @end menu
  42. From a programming point of view, StarPU is not a new language but a library
  43. that executes tasks explicitly submitted by the application. The data that a
  44. task manipulates are automatically transferred onto the accelerator so that the
  45. programmer does not have to take care of complex data movements. StarPU also
  46. takes particular care of scheduling those tasks efficiently and allows
  47. scheduling experts to implement custom scheduling policies in a portable
  48. fashion.
  49. @c explain the notion of codelet and task (i.e. g(A, B)
  50. @node Codelet and Tasks
  51. @subsection Codelet and Tasks
  52. One of the StarPU primary data structures is the @b{codelet}. A codelet describes a
  53. computational kernel that can possibly be implemented on multiple architectures
  54. such as a CPU, a CUDA device or a Cell's SPU.
  55. @c TODO insert illustration f : f_spu, f_cpu, ...
  56. Another important data structure is the @b{task}. Executing a StarPU task
  57. consists in applying a codelet on a data set, on one of the architectures on
  58. which the codelet is implemented. A task thus describes the codelet that it
  59. uses, but also which data are accessed, and how they are
  60. accessed during the computation (read and/or write).
  61. StarPU tasks are asynchronous: submitting a task to StarPU is a non-blocking
  62. operation. The task structure can also specify a @b{callback} function that is
  63. called once StarPU has properly executed the task. It also contains optional
  64. fields that the application may use to give hints to the scheduler (such as
  65. priority levels).
  66. By default, task dependencies are inferred from data dependency (sequential
  67. coherence) by StarPU. The application can however disable sequential coherency
  68. for some data, and dependencies be expressed by hand.
  69. A task may be identified by a unique 64-bit number chosen by the application
  70. which we refer as a @b{tag}.
  71. Task dependencies can be enforced by hand either by the means of callback functions, by
  72. submitting other tasks, or by expressing dependencies
  73. between tags (which can thus correspond to tasks that have not been submitted
  74. yet).
  75. @c TODO insert illustration f(Ar, Brw, Cr) + ..
  76. @c DSM
  77. @node StarPU Data Management Library
  78. @subsection StarPU Data Management Library
  79. Because StarPU schedules tasks at runtime, data transfers have to be
  80. done automatically and ``just-in-time'' between processing units,
  81. relieving the application programmer from explicit data transfers.
  82. Moreover, to avoid unnecessary transfers, StarPU keeps data
  83. where it was last needed, even if was modified there, and it
  84. allows multiple copies of the same data to reside at the same time on
  85. several processing units as long as it is not modified.
  86. @node Glossary
  87. @subsection Glossary
  88. A @b{codelet} records pointers to various implementations of the same
  89. theoretical function.
  90. A @b{memory node} can be either the main RAM or GPU-embedded memory.
  91. A @b{bus} is a link between memory nodes.
  92. A @b{data handle} keeps track of replicates of the same data (@b{registered} by the
  93. application) over various memory nodes. The data management library manages
  94. keeping them coherent.
  95. The @b{home} memory node of a data handle is the memory node from which the data
  96. was registered (usually the main memory node).
  97. A @b{task} represents a scheduled execution of a codelet on some data handles.
  98. A @b{tag} is a rendez-vous point. Tasks typically have their own tag, and can
  99. depend on other tags. The value is chosen by the application.
  100. A @b{worker} execute tasks. There is typically one per CPU computation core and
  101. one per accelerator (for which a whole CPU core is dedicated).
  102. A @b{driver} drives a given kind of workers. There are currently CPU, CUDA,
  103. OpenCL and Gordon drivers. They usually start several workers to actually drive
  104. them.
  105. A @b{performance model} is a (dynamic or static) model of the performance of a
  106. given codelet. Codelets can have execution time performance model as well as
  107. power consumption performance models.
  108. A data @b{interface} describes the layout of the data: for a vector, a pointer
  109. for the start, the number of elements and the size of elements ; for a matrix, a
  110. pointer for the start, the number of elements per row, the offset between rows,
  111. and the size of each element ; etc. To access their data, codelet functions are
  112. given interfaces for the local memory node replicates of the data handles of the
  113. scheduled task.
  114. @b{Partitioning} data means dividing the data of a given data handle (called
  115. @b{father}) into a series of @b{children} data handles which designate various
  116. portions of the former.
  117. A @b{filter} is the function which computes children data handles from a father
  118. data handle, and thus describes how the partitioning should be done (horizontal,
  119. vertical, etc.)
  120. @b{Acquiring} a data handle can be done from the main application, to safely
  121. access the data of a data handle from its home node, without having to
  122. unregister it.
  123. @node Research Papers
  124. @subsection Research Papers
  125. Research papers about StarPU can be found at
  126. @indicateurl{http://runtime.bordeaux.inria.fr/Publis/Keyword/STARPU.html}
  127. Notably a good overview in the research report
  128. @indicateurl{http://hal.archives-ouvertes.fr/inria-00467677}