| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 | /* * This file is part of the StarPU Handbook. * Copyright (C) 2009--2011  Universit@'e de Bordeaux 1 * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique * See the file version.doxy for copying conditions. *//*! \page BuildingAndInstallingStarPU Building and Installing StarPU\section InstallingABinaryPackage Installing a Binary PackageOne of the StarPU developers being a Debian Developer, the packagesare well integrated and very uptodate. To see which packages areavailable, simply type:\verbatim$ apt-cache search starpu\endverbatimTo install what you need, type:\verbatim$ sudo apt-get install libstarpu-1.2 libstarpu-dev\endverbatim\section InstallingFromSource Installing from SourceStarPU can be built and installed by the standard means of the GNUautotools. The following chapter is intended to briefly remind how these toolscan be used to install StarPU.\subsection OptionalDependencies Optional DependenciesThe <a href="http://www.open-mpi.org/software/hwloc"><c>hwloc</c> topologydiscovery library</a> is not mandatory to use StarPU but stronglyrecommended.  It allows for topology aware scheduling, which improvesperformance.  <c>hwloc</c> is available in major free operating systemdistributions, and for most operating systems.If <c>hwloc</c> is not available on your system, the option\ref without-hwloc "--without-hwloc" should be explicitely given when calling the<c>configure</c> script. If <c>hwloc</c> is installed with a <c>pkg-config</c> file,no option is required, it will be detected automatically, otherwise\ref with-hwloc "--with-hwloc" should be used to specify the location of<c>hwloc</c>.\subsection GettingSources Getting SourcesStarPU's sources can be obtained from the <a href="http://runtime.bordeaux.inria.fr/StarPU/files/">download page ofthe StarPU website</a>.All releases and the development tree of StarPU are freely availableon INRIA's gforge under the LGPL license. Some releases are availableunder the BSD license.The latest release can be downloaded from the <a href="http://gforge.inria.fr/frs/?group_id=1570">INRIA's gforge</a> ordirectly from the <a href="http://runtime.bordeaux.inria.fr/StarPU/files/">StarPU download page</a>.The latest nightly snapshot can be downloaded from the <a href="http://starpu.gforge.inria.fr/testing/">StarPU gforge website</a>.\verbatim$ wget http://starpu.gforge.inria.fr/testing/starpu-nightly-latest.tar.gz\endverbatimAnd finally, current development version is also accessible via svn.It should be used only if you need the very latest changes (i.e. lessthan a day!). Note that the client side of the software Subversion canbe obtained from http://subversion.tigris.org. If youare running on Windows, you will probably prefer to use <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a>.\verbatim$ svn checkout svn://scm.gforge.inria.fr/svn/starpu/trunk StarPU\endverbatim\subsection ConfiguringStarPU Configuring StarPURunning <c>autogen.sh</c> is not necessary when using the tarballreleases of StarPU.  If you are using the source code from the svnrepository, you first need to generate the configure scripts and theMakefiles. This requires the availability of <c>autoconf</c>,<c>automake</c> >= 2.60.\verbatim$ ./autogen.sh\endverbatimYou then need to configure StarPU. Details about options that areuseful to give to <c>./configure</c> are given in \ref CompilationConfiguration.\verbatim$ ./configure\endverbatimIf <c>configure</c> does not detect some software or produces errors, pleasemake sure to post the content of <c>config.log</c> when reporting the issue.By default, the files produced during the compilation are placed inthe source directory. As the compilation generates a lot of files, itis advised to to put them all in a separate directory. It is theneasier to cleanup, and this allows to compile several configurationsout of the same source tree. For that, simply enter the directorywhere you want the compilation to produce its files, and invoke the<c>configure</c> script located in the StarPU source directory.\verbatim$ mkdir build$ cd build$ ../configure\endverbatim\subsection BuildingStarPU Building StarPU\verbatim$ make\endverbatimOnce everything is built, you may want to test the result. Anextensive set of regression tests is provided with StarPU. Running thetests is done by calling <c>make check</c>. These tests are run every nightand the result from the main profile is publicly <a href="http://starpu.gforge.inria.fr/testing/">available</a>.\verbatim$ make check\endverbatim\subsection InstallingStarPU Installing StarPUIn order to install StarPU at the location that was specified duringconfiguration:\verbatim$ make install\endverbatimLibtool interface versioning information are included inlibraries names (<c>libstarpu-1.2.so</c>, <c>libstarpumpi-1.2.so</c> and<c>libstarpufft-1.2.so</c>).\section SettingUpYourOwnCode Setting up Your Own Code\subsection SettingFlagsForCompilingLinkingAndRunningApplications Setting Flags for Compiling, Linking and Running ApplicationsStarPU provides a pkg-config executable to obtain relevant compilerand linker flags.Compiling and linking an application against StarPU may require to usespecific flags or libraries (for instance <c>CUDA</c> or <c>libspe2</c>).To this end, it is possible to use the tool <c>pkg-config</c>.If StarPU was not installed at some standard location, the path of StarPU'slibrary must be specified in the environment variable <c>PKG_CONFIG_PATH</c> sothat <c>pkg-config</c> can find it. For example if StarPU was installed in<c>$prefix_dir</c>:\verbatim$ PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$prefix_dir/lib/pkgconfig\endverbatimThe flags required to compile or link against StarPU are thenaccessible with the following commands:\verbatim$ pkg-config --cflags starpu-1.2  # options for the compiler$ pkg-config --libs starpu-1.2    # options for the linker\endverbatimNote that it is still possible to use the API provided in the version1.0 of StarPU by calling <c>pkg-config</c> with the <c>starpu-1.0</c> package.Similar packages are provided for <c>starpumpi-1.0</c> and <c>starpufft-1.0</c>.It is also possible to use the API provided in the version0.9 of StarPU by calling <c>pkg-config</c> with the <c>libstarpu</c> package.Similar packages are provided for <c>libstarpumpi</c> and <c>libstarpufft</c>.Make sure that <c>pkg-config --libs starpu-1.2</c> actually produces some outputbefore going further: <c>PKG_CONFIG_PATH</c> has to point to the place where<c>starpu-1.2.pc</c> was installed during <c>make install</c>.Also pass the option <c>--static</c> if the application is to belinked statically.It is also necessary to set the environment variable <c>LD_LIBRARY_PATH</c> tolocate dynamic libraries at runtime.\verbatim$ LD_LIBRARY_PATH=$prefix_dir/lib:$LD_LIBRARY_PATH\endverbatimWhen using a Makefile, the following lines can be added to set theoptions for the compiler and the linker:\verbatimCFLAGS          +=      $$(pkg-config --cflags starpu-1.2)LDFLAGS         +=      $$(pkg-config --libs starpu-1.2)\endverbatim\subsection RunningABasicStarPUApplication Running a Basic StarPU ApplicationBasic examples using StarPU are built in the directory<c>examples/basic_examples/</c> (and installed in<c>$prefix_dir/lib/starpu/examples/</c>). You can for example run the example<c>vector_scal</c>.\verbatim$ ./examples/basic_examples/vector_scalBEFORE: First element was 1.000000AFTER: First element is 3.140000\endverbatimWhen StarPU is used for the first time, the directory<c>$STARPU_HOME/.starpu/</c> is created, performance models will be stored inthat directory (\ref STARPU_HOME).Please note that buses are benchmarked when StarPU is launched for thefirst time. This may take a few minutes, or less if <c>hwloc</c> isinstalled. This step is done only once per user and per machine.\subsection KernelThreadsStartedByStarPU Kernel Threads Started by StarPUStarPU automatically binds one thread per CPU core. It does not useSMT/hyperthreading because kernels are usually already optimized for using afull core, and using hyperthreading would make kernel calibration rather random.Since driving GPUs is a CPU-consuming task, StarPU dedicates one coreper GPU.While StarPU tasks are executing, the application is not supposed to docomputations in the threads it starts itself, tasks should be used instead.TODO: add a StarPU function to bind an application thread (e.g. the main thread)to a dedicated core (and thus disable the corresponding StarPU CPU worker).\subsection EnablingOpenCL Enabling OpenCLWhen both CUDA and OpenCL drivers are enabled, StarPU will launch anOpenCL worker for NVIDIA GPUs only if CUDA is not already running on them.This design choice was necessary as OpenCL and CUDA can not run at thesame time on the same NVIDIA GPU, as there is currently no interoperabilitybetween them.To enable OpenCL, you need either to disable CUDA when configuring StarPU:\verbatim$ ./configure --disable-cuda\endverbatimor when running applications:\verbatim$ STARPU_NCUDA=0 ./application\endverbatimOpenCL will automatically be started on any device not yet used byCUDA. So on a machine running 4 GPUS, it is therefore possible toenable CUDA on 2 devices, and OpenCL on the 2 other devices by doingso:\verbatim$ STARPU_NCUDA=2 ./application\endverbatim\section BenchmarkingStarPU Benchmarking StarPUSome interesting benchmarks are installed among examples in<c>$prefix_dir/lib/starpu/examples/</c>. Make sure to try variousschedulers, for instance <c>STARPU_SCHED=dmda</c>.\subsection TaskSizeOverhead Task Size OverheadThis benchmark gives a glimpse into how long a task should be (in µs) for StarPU overheadto be low enough to keep efficiency.  Run <c>tasks_size_overhead.sh</c>, it will generate a plotof the speedup of tasks of various sizes, depending on the number of CPUs beingused.\image html tasks_size_overhead.png\image latex tasks_size_overhead.eps "" width=\textwidth\subsection DataTransferLatency Data Transfer Latency<c>local_pingpong</c> performs a ping-pong between the first two CUDA nodes, andprints the measured latency.\subsection MatrixMatrixMultiplication Matrix-Matrix Multiplication<c>sgemm</c> and <c>dgemm</c> perform a blocked matrix-matrixmultiplication using BLAS and cuBLAS. They output the obtained GFlops.\subsection CholeskyFactorization Cholesky Factorization<c>cholesky/*</c> perform a Cholesky factorization (single precision). They use different dependency primitives.\subsection LUFactorization LU Factorization<c>lu/*</c> perform an LU factorization. They use different dependency primitives.*/
 |