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: Matthias Lieber <matthias.lieber@tu-dresden.de>
  • To: Olivier Aumage <olivier.aumage@inria.fr>
  • Cc: starpu-devel@lists.gforge.inria.fr
  • Subject: Re: [Starpu-devel] StarPU Fortran support
  • Date: Thu, 23 Nov 2017 18:00:05 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=matthias.lieber@tu-dresden.de; spf=None smtp.mailfrom=matthias.lieber@tu-dresden.de; spf=None smtp.helo=postmaster@mailout5.zih.tu-dresden.de
  • Ironport-phdr: 9a23:y2RLLRGhPf7IK2vyyC7QSZ1GYnF86YWxBRYc798ds5kLTJ75pM+wAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWapAQfERTnNAdzOv+9WsuL15z2hM2s9ofsYwRUiX/4SPsyaUzu9USC/vUR1KxmK7gwxwGBi2ZNcutbjTdvIVONnhvmoM6t+Zds/gxRvegg/ohOS/OpUb4/SOl9BSg6M2E8/4XPtBTJQBHHsn4VTnkWkxNTRQzE4Rv3RL/tr272rOdm1CSce8H7G+NnEQ++5rtmHUe7wBwMMCQ0pSSN0pR9
  • 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>
  • Organization: ZIH / TU Dresden

Dear Olivier,

thanks for your reply. It would be great of course if the CUDA kernels
themselves
could be written in Fortran, too. Is it possible to use PGI's CUDA Fortran
with
StarPU? Or do you know any other method to use kernels written in Fortran with
StarPU?

Best wishes
Matthias

Olivier Aumage wrote on 2017-11-01, 15:35:
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,




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archives gérées par MHonArc 2.6.19+.

Haut de le page