introduction.texi 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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, 2012 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. @menu
  8. * Motivation:: Why StarPU ?
  9. * StarPU in a Nutshell:: The Fundamentals of StarPU
  10. @end menu
  11. @node Motivation
  12. @section Motivation
  13. @c complex machines with heterogeneous cores/devices
  14. The use of specialized hardware such as accelerators or coprocessors offers an
  15. interesting approach to overcome the physical limits encountered by processor
  16. architects. As a result, many machines are now equipped with one or several
  17. accelerators (e.g. a GPU), in addition to the usual processor(s). While a lot of
  18. efforts have been devoted to offload computation onto such accelerators, very
  19. little attention as been paid to portability concerns on the one hand, and to the
  20. possibility of having heterogeneous accelerators and processors to interact on the other hand.
  21. StarPU is a runtime system that offers support for heterogeneous multicore
  22. architectures, it not only offers a unified view of the computational resources
  23. (i.e. CPUs and accelerators at the same time), but it also takes care of
  24. efficiently mapping and executing tasks onto an heterogeneous machine while
  25. transparently handling low-level issues such as data transfers in a portable
  26. fashion.
  27. @c this leads to a complicated distributed memory design
  28. @c which is not (easily) manageable by hand
  29. @c added value/benefits of StarPU
  30. @c - portability
  31. @c - scheduling, perf. portability
  32. @node StarPU in a Nutshell
  33. @section StarPU in a Nutshell
  34. @menu
  35. * Codelet and Tasks::
  36. * StarPU Data Management Library::
  37. * Glossary::
  38. * Research Papers::
  39. @end menu
  40. From a programming point of view, StarPU is not a new language but a library
  41. that executes tasks explicitly submitted by the application. The data that a
  42. task manipulates are automatically transferred onto the accelerator so that
  43. the programmer does not have to take care of complex data movements. StarPU
  44. also takes particular care of scheduling those tasks efficiently and allows
  45. scheduling experts to implement custom scheduling policies in a portable
  46. fashion. The target audience is typically developers of compilers or computation
  47. libraries which want to seamlessly extend them to support heterogeneous
  48. architectures.
  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}