/* StarPU --- Runtime system for heterogeneous multicore architectures.
 *
 * Copyright (C) 2009-2023  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
 *
 * StarPU is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 *
 * StarPU is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
 */

/*! \page BenchmarkingStarPU Benchmarking StarPU

Some interesting benchmarks are installed among examples in
<c>$STARPU_PATH/lib/starpu/examples/</c>. Make sure to try various
schedulers, for instance <c>STARPU_SCHED=dmda</c>.

\section TaskSizeOverhead Task Size Overhead

This benchmark gives a glimpse into how long a task should be (in µs) for StarPU overhead
to be low enough to keep efficiency.  Running
<c>tasks_size_overhead.sh</c> generates a plot
of the speedup of tasks of various sizes, depending on the number of CPUs being
used.

\image html tasks_size_overhead.png
\image latex tasks_size_overhead.png "" width=\textwidth

\section DataTransferLatency Data Transfer Latency

<c>local_pingpong</c> performs a ping-pong between the first two CUDA nodes, and
prints the measured latency.

\section MatrixMatrixMultiplication Matrix-Matrix Multiplication

<c>sgemm</c> and <c>dgemm</c> perform a blocked matrix-matrix
multiplication using BLAS and cuBLAS. They output the obtained GFlops.

\section CholeskyFactorization Cholesky Factorization

<c>cholesky_*</c> perform a Cholesky factorization (single precision). They use different dependency primitives.

\section LUFactorization LU Factorization

<c>lu_*</c> perform an LU factorization. They use different dependency primitives.

\section SimulatedBenchmarks Simulated Benchmarks

It can also be convenient to try simulated benchmarks, if you want to give a try
at CPU-GPU scheduling without actually having a GPU at hand. This can be done by
using the SimGrid version of StarPU: first install the SimGrid simulator from
https://simgrid.org/ (we tested with SimGrid from 3.11 to 3.16, and
3.18 to 3.30. SimGrid versions 3.25 and above need to be configured with \c -Denable_msg=ON.
Other versions may have compatibility issues, 3.17 notably does
not build at all. MPI simulation does not work with version 3.22).
Then configure StarPU with \ref enable-simgrid
"--enable-simgrid" and rebuild and install it, and then you can simulate the performance for a
few virtualized systems shipped along StarPU: attila, mirage, idgraf, and sirocco.

For instance:

\verbatim
$ export STARPU_PERF_MODEL_DIR=$STARPU_PATH/share/starpu/perfmodels/sampling
$ export STARPU_HOSTNAME=attila
$ $STARPU_PATH/lib/starpu/examples/cholesky_implicit -size $((960*20)) -nblocks 20
\endverbatim

Will show the performance of the cholesky factorization with the attila
system. It will be interesting to try with different matrix sizes and
schedulers.

Performance models are available for <c>cholesky_*</c>, <c>lu_*</c>, <c>*gemm</c>, with block sizes
320, 640, or 960 (plus 1440 for sirocco), and for <c>stencil</c> with block size 128x128x128, 192x192x192, and
256x256x256.

Read Chapter \ref SimGridSupport for more information on the SimGrid support.

*/
