123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- \input texinfo @c -*-texinfo-*-
- @c %**start of header
- @setfilename starpu.info
- @settitle StarPU
- @c %**end of header
- @setchapternewpage odd
- @titlepage
- @title StarPU
- @page
- @vskip 0pt plus 1filll
- @comment For the @value{version-GCC} Version*
- @end titlepage
- @summarycontents
- @contents
- @page
- @node Top
- @top Preface
- @cindex Preface
- This manual documents the usage of StarPU
- @comment
- @comment When you add a new menu item, please keep the right hand
- @comment aligned to the same column. Do not use tabs. This provides
- @comment better formatting.
- @comment
- @menu
- * Introduction:: A basic introduction to using StarPU.
- * Installing StarPU:: How to configure, build and install StarPU
- * StarPU API:: The API to use StarPU
- * Basic Examples:: Basic examples of the use of StarPU
- @end menu
- @c ---------------------------------------------------------------------
- @c Introduction to StarPU
- @c ---------------------------------------------------------------------
- @node Introduction
- @chapter Introduction to StarPU
- @c ---------------------------------------------------------------------
- @c Installing StarPU
- @c ---------------------------------------------------------------------
- @node Installing StarPU
- @chapter Installing StarPU
- StarPU can be built and install by the standard means of the GNU autotools. The
- following chapter is intended to briefly remind how these tools can be used to
- install StarPU.
- @section Configuring StarPU
- @subsection Generating Makefiles and configuration scripts
- This step is not necessary when using the tarball releases of StarPU. If you
- are using the source code from the svn repository, you first need to generate
- the configure scripts and the Makefiles.
- @example
- $ autoreconf -i
- @end example
- @subsection Configuring StarPU
- @example
- $ configure
- @end example
- @c TODO enumerate the list of interesting options
- @section Building and Installing StarPU
- @subsection Building
- @example
- $ make
- @end example
- @subsection Sanity Checks
- In order to make sure that StarPU is working properly on the system, it is also
- possible to run a test suite.
- @example
- $ make check
- @end example
- @subsection Installing
- In order to install StarPU at the location that was specified during
- configuration:
- @example
- $ make install
- @end example
- @subsection pkg-config configuration
- It is possible that compiling and linking an application against StarPU
- requires to use specific flags or libraries (for instance @code{CUDA} or
- @code{libspe2}). Therefore, it is possible to use the @code{pkg-config} tool.
- If StarPU was not installed at some standard location, the path of StarPU's
- library must be specified in the @code{PKG_CONFIG_PATH} environment variable so
- that @code{pkg-config} can find it. So if StarPU was installed in
- @code{$(prefix_dir)}:
- @example
- $ PKG_CONFIG_PATH = @{PKG_CONFIG_PATH@}:$(prefix_dir)/lib/
- @end example
- The flags required to compiled or linked against StarPU are then
- accessible with the following commands:
- @example
- $ pkg-config --cflags libstarpu # options for the compiler
- $ pkg-config --libs libstarpu # options for the linker
- @end example
- @c ---------------------------------------------------------------------
- @c StarPU API
- @c ---------------------------------------------------------------------
- @node StarPU API
- @chapter StarPU API
- @menu
- * Initialization and Termination:: Initialization and Termination methods
- * Data Library:: Methods to manipulate data
- * Codelets and Tasks:: Methods to construct tasks
- @end menu
- @node Initialization and Termination
- @section Initialization and Termination
- @menu
- * starpu_init:: Initialize StarPU
- * starpu_shutdown:: Terminate StarPU
- @end menu
- @node starpu_init
- @subsection @code{starpu_init} -- Initialize StarPU
- @table @asis
- @item @emph{Description}:
- This is StarPU initialization method, which must be called prior to any other
- StarPU call. It is possible to specify StarPU's configuration (eg. scheduling
- policy, number of cores, ...) by passing a non-null argument. Default
- configuration is used if the passed argument is @code{NULL}.
- @item @emph{Prototype}:
- @code{void starpu_init(struct starpu_conf *conf);}
- @end table
- @node starpu_shutdown
- @subsection @code{starpu_shutdown} -- Terminate StarPU
- @table @asis
- @item @emph{Description}:
- This is StarPU termination method. It must be called at the end of the
- application: statistics and other post-mortem debugging information are not
- garanteed to be available until this method has been called.
- @item @emph{Prototype}:
- @code{void starpu_shutdown(void);}
- @end table
- @node Data Library
- @section Data Library
- @node Codelets and Tasks
- @section Codelets and Tasks
- @section Extensions
- @subsection CUDA extensions
- @subsection Cell extensions
- @c ---------------------------------------------------------------------
- @c Basic Examples
- @c ---------------------------------------------------------------------
- @node Basic Examples
- @chapter Basic Examples
- @section Compiling and linking options
- The Makefile could for instance contain the following lines to define which
- options must be given to the compiler and to the linker:
- @example
- @cartouche
- CFLAGS+=$$(pkg-config --cflags libstarpu)
- LIBS+=$$(pkg-config --libs libstarpu)
- @end cartouche
- @end example
- @section Hello World
- In this section, we show a simple
- @subsection Required Headers
- The @code{starpu.h} header should be included in any code using StarPU.
- @example
- @cartouche
- #include <starpu.h>
- @end cartouche
- @end example
- @subsection Defining a Codelet
- @example
- @cartouche
- void cpu_func(starpu_data_interface_t *buffers, void *func_arg)
- @{
- float *array = func_arg;
- printf("Hello world (array = @{%f, %f@} )\n", array[0], array[1]);
- @}
- starpu_codelet cl =
- @{
- .where = CORE,
- .core_func = cpu_func,
- .nbuffers = 0
- @};
- @end cartouche
- @end example
- The ''@code{.nbuffers}'' field specifies the number of data buffers that are
- manipulated by the codelet: here the codelet does not access or modify any data
- that is controlled by our data management library. Note that the argument
- passed to the codelet (the ''@code{.cl_arg}'' field of the @code{starpu_task}
- structure) does not count as a buffer since it is not managed by our data
- management library.
- @c TODO need a crossref to the proper description of "where" see bla for more ...
- We create a codelet which may only execute on the CPUs. The ''@code{.where}''
- field is a bitmask that defines where the codelet may be executed. Here, the
- @code{CORE} value means that only CPUs can execute this codelet.
- When a CPU core executes a codelet, it calls the @code{.core_func} function,
- which @emph{must} have the following prototype:
- @code{void (*core_func)(starpu_data_interface_t *, void *)}
- In this example, we can ignore the first argument of this function gives a
- description of the input and output buffers (eg. the size and the location of
- the matrices). The second argument is a pointer to a buffer passed as an
- argument to the codelet by the means of the ''@code{.cl_arg}'' field of the
- @code{starpu_task} structure. Be aware that this may be a pointer to a
- @emph{copy} of the actual buffer, and not the pointer given by the programmer:
- if the codelet modifies this buffer, there is no garantee that the initial
- buffer will be modified as well: this for instance implies that the buffer
- cannot be used as a synchronization medium.
- @subsection Submitting a Task
- @example
- @cartouche
- void callback_func(void *callback_arg)
- @{
- printf("Callback function (arg %x)\n", callback_arg);
- @}
- int main(int argc, char **argv)
- @{
- /* initialize StarPU */
- starpu_init(NULL);
- struct starpu_task *task = starpu_task_create();
- task->cl = &cl;
-
- float array[2] = {1.0f, -1.0f};
- task->cl_arg = &array;
- task->cl_arg_size = 2*sizeof(float);
- task->callback_func = callback_func;
- task->callback_arg = 0x42;
- /* starpu_submit_task will be a blocking call */
- task->synchronous = 1;
- /* submit the task to StarPU */
- starpu_submit_task(task);
- /* terminate StarPU */
- starpu_shutdown();
- return 0;
- @}
- @end cartouche
- @end example
- @bye
|