[MPIWG Fortran] Provide Fortran datatypes if Fortran bindings not provided?

Bill Long longb at cray.com
Thu Feb 18 07:58:54 CST 2016

On Feb 18, 2016, at 5:45 AM, Jeff Squyres (jsquyres) <jsquyres at cisco.com> wrote:

> A question has come up recently in the Open MPI community (being debated in a lengthy thread here https://www.open-mpi.org/community/lists/users/2016/02/28448.php):
> If Fortran support is not provided in an Open MPI installation (e.g., if Open MPI's configure script detects that there is no Fortran compiler, and therefore none of the mpif.h, mpi module, or mpi_f08 module are compiled), should Fortran datatypes (e.g., MPI_INTEGER) be available in the C bindings?

This argument seems shortsighted. 

It would seem peculiar to have no Fortran compiler installed.  Even if that was the case at the moment, it could change in the future, and you would not want to have to rebuild MPI in that case. 

What about MPI I/O?  Even if the local system that is writing a file does not have a Fortran compiler, the program (on a different system) reading the file might, and be expecting Fortran data types to have been used in writing the file. 

> It was pointed out that MPI-3.1 says that the Fortran bindings are optional -- but datatypes are not currently marked as optional.
> Hence, even if you don't have to Fortran compiler, you still have to have declarations for MPI_INTEGER (and friends) in mpi.h.
> What do people think about this?
> =================================
> A1. MPI can set MPI_INTEGER to be equivalent to MPI_DATATYPE_NULL.

I agree with B1 in this case - this is unnecessarily hostile. 

> A2. MPI could probably figure out what Fortran INTEGER would have been (i.e., probably equivalent to C int) and just set MPI_INTEGER to be that.

Instead, the spec might be more specific in this case.  If there is no Fortran information available, specify a default mapping, such as INTEGER -> int, REAL -> float, …  A sampling of existing Fortran and C compilers that are designed to interoperate would probably lead to a pretty universal set of mappings (ignoring the -r8 -i8 issue noted below). 

> A3. The whole point of having Fortran datatypes available in C is that even an MPI process written in C can receive/send data from MPI processes in Fortran.  Hence, *this* MPI process -- compiled by an MPI implementation that does not have a Fortran compiler -- may not have Fortran support, but a peer MPI process in the same MPI job may have Fortran support.

I think the MPI I/O argument might be a stronger case for A3. 

> ======================
> B1. Setting MPI_INTEGER (and friends) to MPI_DATATYPE_NULL -- which will cause a run-time MPI exception -- is somewhat anti-social behavior (and potentially confusing to the user).

Agree. But coming up with a bad idea is not a convincing argument for a change.

> B2. An MPI implementation can *assume* but can't *know* what the size/representation of Fortran datatypes are unless there's a Fortran compiler with which to test.

Even in that case, you can’t know for sure because (too many) Fortran compilers have command line switches like -r8 or -i8 that change, on a program by program basis, what REAL or INTEGER means. 

> B3. A3 is a somewhat sketchy claim.  It's obviously possible and valid, but fairly uncommon to have multiple MPI implementation installations involved in a single execution of an MPI application.

I agree with this, but the MPI I/O example does not involve a single execution. 


> --  
> Jeff Squyres
> jsquyres at cisco.com  
> For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
> _______________________________________________
> mpiwg-fortran mailing list
> mpiwg-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran

Bill Long                                                                       longb at cray.com
Fortran Technical Support  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the mpiwg-fortran mailing list