/* StarPU --- Runtime system for heterogeneous multicore architectures.
 *
 * Copyright (C) 2009-2024  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 StencilApplication A Stencil Application

\section StencilOriginal The Original Application

\snippet stencil5.c To be included. You should update doxygen if you see this text.

\section StencilStarPU The StarPU Application

The computation function must be defined through a codelet.

\snippet stencil5_starpu.c starpu_codelet. You should update doxygen if you see this text.

Data must be registered to StarPU.

\snippet stencil5_starpu.c starpu_register. You should update doxygen if you see this text.

Instead of directly calling the function, a StarPU task must be created.

\snippet stencil5_starpu.c starpu_task. You should update doxygen if you see this text.

And finally data must be released from StarPU.

\snippet stencil5_starpu.c starpu_unregister. You should update doxygen if you see this text.

The whole StarPU application looks as follows.

\snippet stencil5_starpu.c To be included. You should update doxygen if you see this text.

\section StencilStarPUMPI The StarPU MPI Application

The initialisation for StarPU-MPI is as follows.

\snippet stencil5_starpu_mpi.c mpi_init. You should update doxygen if you see this text.

An additional call to starpu_mpi_data_register() is necessary.

\snippet stencil5_starpu_mpi.c mpi_register. You should update doxygen if you see this text.

And to insert a task, the function starpu_mpi_task_insert() must be used.

\snippet stencil5_starpu_mpi.c mpi_insert. You should update doxygen if you see this text.

The whole StarPU-MPI application looks as follows.

\snippet stencil5_starpu_mpi.c To be included. You should update doxygen if you see this text.

\section StencilRunning Running the application

\verbatim
$ docker run -it registry.gitlab.inria.fr/starpu/starpu-docker/starpu:latest
\endverbatim

If your machine has GPU devices, you can use the following command to enable the GPU devices within the docker image.

\verbatim
$ docker run -it --gpus all registry.gitlab.inria.fr/starpu/starpu-docker/starpu:latest
\endverbatim

From your docker image, you can then call the following commands.

\verbatim
$ git clone https://gitlab.inria.fr/starpu/starpu-applications.git
$ cd starpu-applications/stencil5
$ make
\endverbatim

To run the non-StarPU application

\verbatim
$ ./stencil5 -v
\endverbatim

To run the sequential StarPU application

\verbatim
$ ./stencil5_starpu -v
\endverbatim

To run the StarPU MPI application. Setting the variable \ref STARPU_COMM_STATS to 1 will display the amount of communication between the different MPI processes.

\verbatim
$ STARPU_COMM_STATS=1 mpirun -np 4 ./stencil5_starpu_mpi -v 4 3
\endverbatim

*/
