[MPIWG Fortran] Proposal: MPI_SIZEOF not profiled

Bill Long longb at cray.com
Fri May 16 08:44:56 CDT 2014

On May 16, 2014, at 8:28 AM, N.M. Maclaren <nmm1 at cam.ac.uk> wrote:

> On May 16 2014, Jeff Squyres (jsquyres) wrote:
>> Fortran and Tools WGs:
>> (=== this is a bit urgent if we want to get this read at the Chicago meeting; the T-2 deadline is this upcoming Monday morning ===)
>> We seem to have some measure of consensus on the other thread that MPI_SIZEOF should not be profiled.
>> Note, however, that the Tools chapter currently mandates that PMPI_ versions of all MPI routines must be available (including, for example, MPI_WTICK), but the MPI_ versions do not have to be replaceable at link time. I propose adopting this convention for MPI_SIZEOF, too (i.e. we have to provide PMPI_SIZEOF).
>> Does this wording work as a proposal?
> From my viewpoint, yes.  MPI_Sizeof has never been an ordinary Fortran
> function.  I don't know the latest polymorphic features well enough
> to know whether it even CAN be implemented within the standard.  Indeed,
> one reasonable way to implement it is by the mpif90 command running a
> preprocessor on the source to replace it by the relevant value!

The MPI subroutine MPI_SIZEOF is restricted to arguments of intrinsic numeric type (integer, real, complex).  No derived types or polymorphic arguments. Fortran does have an intrinsic, STORAGE_SIZE, that returns the size value in bits. Divide by 8 to get the answer for MPI_SIZEOF.  Indeed, a Fortran compiler could inline this function as long as it was accessed through a module (and hence the compiler knows that it is the MPI version and not a user-written subroutine that happened to have this name).   Such inlining being allowed by the proposal from Jeff is definitely a good thing.

I can’t say about using mpif90 as a compiler.  Is that a license to, for example, suspend normal Fortran rules and require that any routine with a name starting with MPI_ or PMPI_ has to come from the mpi libraries and cannot be supplied by the user?  If that’s the case, then Nick’s pseudo-macro scheme could work as well.  (I’ve no experience with mpif90 - all of our users just compile with ftn, same as for any Fortran program.)


> Regards,
> Nick Maclaren.
> _______________________________________________
> 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 Suport  &                                  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