## 10.2.4. Extended Fortran Support

Up: Fortran Support Next: The `mpi` Module Previous: Basic Fortran Support

Implementations with Extended Fortran support must provide:

1. An `mpi` module
2. A new set of functions to provide additional support for Fortran intrinsic numeric types, including parameterized types: MPI_SIZEOF, MPI_TYPE_MATCH_SIZE, MPI_TYPE_CREATE_F90_INTEGER, MPI_TYPE_CREATE_F90_REAL and MPI_TYPE_CREATE_F90_COMPLEX. Parameterized types are Fortran intrinsic types which are specified using `KIND` type parameters. These routines are described in detail in Section Additional Support for Fortran Numeric Intrinsic Types .

Additionally, high quality implementations should provide a mechanism to prevent fatal type mismatch errors for MPI routines with choice arguments.

Up: Fortran Support Next: The `mpi` Module Previous: Basic Fortran Support

### 10.2.4.1. The mpi Module

Up: Extended Fortran Support Next: No Type Mismatch Problems for Subroutines with Choice Arguments Previous: Extended Fortran Support

An MPI implementation must provide a module named `mpi` that can be `USE`d in a Fortran 90 program. This module must:

- Define all named MPI constants
- Declare MPI functions that return a value.

An MPI implementation may provide in the `mpi` module other features that enhance the usability of MPI while maintaining adherence to the standard. For example, it may:

- Provide interfaces for all or for a subset of MPI routines.
- Provide `INTENT` information in these interface blocks.

Advice to implementors.

The appropriate `INTENT` may be different from what is given in the MPI generic interface. Implementations must choose `INTENT` so that the function adheres to the MPI standard. ( End of advice to implementors.)
Rationale.

The intent given by the MPI generic interface is not precisely defined and does not in all cases correspond to the correct Fortran `INTENT`. For instance, receiving into a buffer specified by a datatype with absolute addresses may require associating MPI_BOTTOM with a dummy `OUT` argument. Moreover, ``constants'' such as MPI_BOTTOM and MPI_STATUS_IGNORE are not constants as defined by Fortran, but ``special addresses'' used in a nonstandard way. Finally, the MPI-1 generic intent is changed in several places by MPI-2. For instance, MPI_IN_PLACE changes the sense of an `OUT` argument to be `INOUT`. ( End of rationale.)

Applications may use either the `mpi` module or the `mpif.h` include file. An implementation may require use of the module to prevent type mismatch errors (see below).
Advice to users.

It is recommended to use the `mpi` module even if it is not necessary to use it to avoid type mismatch errors on a particular system. Using a module provides several potential advantages over using an include file. ( End of advice to users.)
It must be possible to link together routines some of which `USE` `mpi` and others of which `INCLUDE` `mpif.h`.

Up: Extended Fortran Support Next: No Type Mismatch Problems for Subroutines with Choice Arguments Previous: Extended Fortran Support

### 10.2.4.2. No Type Mismatch Problems for Subroutines with Choice Arguments

Up: Extended Fortran Support Next: Additional Support for Fortran Numeric Intrinsic Types Previous: The `mpi` Module

A high quality MPI implementation should provide a mechanism to ensure that MPI choice arguments do not cause fatal compile-time or run-time errors due to type mismatch. An MPI implementation may require applications to use the `mpi` module, or require that it be compiled with a particular compiler flag, in order to avoid type mismatch problems.

Advice to implementors.

In the case where the compiler does not generate errors, nothing needs to be done to the existing interface. In the case where the compiler may generate errors, a set of overloaded functions may be used. See the paper of M. Hennecke [8]. Even if the compiler does not generate errors, explicit interfaces for all routines would be useful for detecting errors in the argument list. Also, explicit interfaces which give `INTENT` information can reduce the amount of copying for `BUF(*)` arguments. ( End of advice to implementors.)

Up: Extended Fortran Support Next: Additional Support for Fortran Numeric Intrinsic Types Previous: The `mpi` Module

Return to MPI-2 Standard Index
Return to MPI 1.1 Standard Index
Return to MPI Forum Home Page

MPI-2.0 of July 18, 1997
HTML Generated on September 10, 2001