Accéder au contenu.
Menu Sympa

starpu-devel - Re: [Starpu-devel] StarPU Fortran support

Objet : Developers list for StarPU

Archives de la liste

Re: [Starpu-devel] StarPU Fortran support


Chronologique Discussions 
  • From: Olivier Aumage <olivier.aumage@inria.fr>
  • To: Matthias Lieber <matthias.lieber@tu-dresden.de>
  • Cc: starpu-devel@lists.gforge.inria.fr
  • Subject: Re: [Starpu-devel] StarPU Fortran support
  • Date: Wed, 1 Nov 2017 15:35:52 +0100
  • List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel/>
  • List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>

Dear Matthias,

There are two ways to use StarPU for a Fortran application:


** Using the Native Fortran API:

You can have a look at examples in the STARPU/examples/native_fortran/
directory.
For instance, to use a CUDA kernel with the example nf_vector.f90, you can
replace
the following lines:
%-------------------
! add a CPU implementation function to the codelet
call fstarpu_codelet_add_cpu_func(cl_vec, C_FUNLOC(cl_cpu_func_vec))
%-------------------

with:
%-------------------
! add a CUDA implementation function to the codelet
call fstarpu_codelet_add_cuda_func(cl_vec, C_FUNLOC(... CUDA kernel
launch function ...))
%-------------------

and replace every remaining occurrence of cpu/CPU with cuda/CUDA.


If you want to use both CPU dans CUDA kernels for the same codelet, you can
remove the call to fstarpu_codelet_set_where() and add both kernels to the
same codelet:
%-------------------
call fstarpu_codelet_add_cpu_func(cl_vec, C_FUNLOC(cl_cpu_func_vec))
call fstarpu_codelet_add_cuda_func(cl_vec, C_FUNLOC(... CUDA kernel
launch function ...))
%-------------------


** Using C marshaling functions:

The example in the STARPU/examples/fortran90/ directory uses the C marshaling
approach, where all interactions between the Fortran application with StarPU
(both the application calls to StarPU and the StarPU calls to application
kernels) are done through a custom C layer. Here, the use of CUDA kernels is
exactly the same as for a C/C++ application.


The native Fortran API of StarPU is more convenient, but it requires a
Fortran compiler compliant with ISO/IEC TS 29113:2012
(see https://www.iso.org/standard/45136.html). You can try to build the
examples in StarPU/Examples/native_fortran to check if your compiler is ok.
Recent versions of GNU GFortran and Intel Fortran compilers are known to
build these examples successfully.

The C marshaling way works with any Fortran compiler supporting
'iso_c_binding',
but it requires more coding.

Best regards,
--
Olivier Aumage
Inria Researcher
Team STORM

> Le 1 nov. 2017 à 10:09, Matthias Lieber <matthias.lieber@tu-dresden.de> a
> écrit :
>
> Dear StarPU developers,
>
> I am interested in trying out StarPU for a Fortran application.
> However, the documentation and the examples do not show how to
> specify accelerator kernels for codelets. So my quesion is:
> Does the Fortran interface support GPUs (preferably CUDA) and
> how is done?
>
> Best wishes
> Matthias
>
> _______________________________________________
> Starpu-devel mailing list
> Starpu-devel@lists.gforge.inria.fr
> https://lists.gforge.inria.fr/mailman/listinfo/starpu-devel









Archives gérées par MHonArc 2.6.19+.

Haut de le page