[J3] C_PTR not allowed in SEQUENCE types?
Bader, Reinhold
Reinhold.Bader at lrz.de
Fri Mar 12 08:39:08 UTC 2021
I think one needs to differentiate two relevant aspects here:
(1) the MPI interface definition
(2) the MPI TYPE API for transferring derived type data across the network, with its constraints on the derived types the programmer can use.
Wrt (1), it is not exactly true that MPI_F08 uses BIND(C). For MPI 3.1, they started out prescribing BIND(C) in the initial drafts,
but removed it again from the interface specs.
The reason was that some calls had LOGICAL arguments, and that LOGICAL(KIND=c_bool) is distinct from LOGICAL default kind in current
Fortran implementations.
A real-world MPI implementation hence could define most of the MPI interface as BIND(C) calls in MPI_F08, but not all of it.
Wrt (2), the MPI 3.1 standard supports both SEQUENCE and BIND(C) , with a recommendation to use BIND(C) in newer codes.
Conversion from SEQUENCE to BIND(C) in legacy codes is likely to be a significant chore. Apart from the LOGICAL discrepancy resolution
that may surface here too, SEQUENCE types might contain POINTER or ALLOCATABLE components which cannot appear in BIND(C) types.
So, while I agree that extending SEQUENCE is not a good idea, getting rid of it (which is the long-term purpose of obsolescing ...) is likely to run
into resistance from the MPI Forum at minimum.
I personally am a fan of SEQUENCE removal, by the way. But that is rooted in sheer laziness, since it reduces the teaching effort.
Cheers
Reinhold
-----Ursprüngliche Nachricht-----
Von: J3 <j3-bounces at mailman.j3-fortran.org> Im Auftrag von Bill Long via J3
Gesendet: Freitag, 12. März 2021 05:21
An: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Bill Long <longb at cray.com>
Betreff: Re: [J3] C_PTR not allowed in SEQUENCE types?
MPI has 3 Fortran interfaces. The ancient include file, mpif.h, and two modules, MPI and MPI_F08. The MPI module uses SEQUENCE while the MPI_F08 module uses BIND(C). I’ve argued in the past to get rid of both mpif.h and the MPI module, leaving only the MPI_F08 module. Those who develop Fortran tools for MPI were staunchly opposed.
The alternative would be to do what SHMEM did and deprecate the Fortran interface entirely, on the grounds that the capabilities provided by SHMEM are all included in Fortran already anyway, and also it makes life easier for those providing SHMEM packages. The same argument could be made for MPI.
Cheers,
Bill
> On Mar 11, 2021, at 6:10 PM, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org> wrote:
>
>
> So my question would be why is MPI using SEQUENCE and not using BIND(C)?
Bill Long longb at hpe.com
Engineer/Master , Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Hewlett Packard Enterprise/ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list