10.2.2 Problems With Fortran Bindings for MPI-/

This section discusses a number of problems that may arise when using MPI-/ in a Fortran program. It is intended as advice to users, and clarifies how MPI-/ interacts with Fortran. It does not add to the standard, but is intended to clarify the standard.

As noted in the original MPI-/ specification, the interface violates the Fortran standard in several ways. While these cause few problems for Fortran 77 programs, they become more significant for Fortran 90 programs, so that users must exercise care when using new Fortran 90 features. The violations were originally adopted and have been retained because they are important for the usability of MPI-/. The rest of this section describes the potential problems in detail. It supersedes and replaces the discussion of Fortran bindings in the original MPI-/ specification (for Fortran 90, not Fortran 77).

The following MPI-/ features are inconsistent with Fortran 90.

  1. An MPI-/ subroutine with a choice argument may be called with different argument types.
  2. An MPI-/ subroutine with an assumed-size dummy argument may be passed an actual scalar argument.
  3. Many MPI-/ routines assume that actual arguments are passed by address and that arguments are not copied on entrance to or exit from the subroutine.
  4. An MPI-/ implementation may read or modify user data (e.g., communication buffers used by nonblocking communications) concurrently with a user program that is executing outside of MPI-/ calls.
  5. Several named ``constants,'' such as MPI_BOTTOM, MPI_IN_PLACE, MPI_STATUS_IGNORE, MPI_STATUSES_IGNORE, MPI_ERRCODES_IGNORE, MPI_ARGV_NULL, and MPI_ARGVS_NULL are not ordinary Fortran constants and require a special implementation. See Section 2.5.4 on page [*] for more information.
  6. The memory allocation routine MPI_ALLOC_MEM can't be usefully used in Fortran without a language extension that allows the allocated memory to be associated with a Fortran variable.

MPI-/ contained several routines that take address-sized information as input or return address-sized information as output. In C such arguments were of type MPI_Aint and in Fortran of type INTEGER. On machines where integers are smaller than addresses, these routines can lose information. In MPI-// the use of these functions has been deprecated and they have been replaced by routines taking INTEGER arguments of KIND=MPI_ADDRESS_KIND. A number of new MPI-// functions also take INTEGER arguments of non-default KIND. See Section 2.6 on page [*] and Section 4.14 on page [*] for more information.



Subsections
MPI-Standard for MARMOT