20.1.4. Fortran Support Through the mpif.h Include File
Up: Support for Fortran
Next: Interface Specifications, Procedure Names, and the Profiling Interface
Previous: Fortran Support Through the mpi Module
The use of the mpif.h include file has been deprecated in MPI-4.1.
An MPI implementation providing a Fortran interface must provide an include file named mpif.h that
can be used in a Fortran program.
Within all MPI function specifications,
the second of the set of two Fortran routine interface specifications is supported by this include file.
This include file must:
- Define all named MPI constants.
- Declare MPI functions that return a value.
- Define all handles as INTEGER.
- Be valid and equivalent for both
fixed and free source form.
For each MPI routine, an implementation can choose
to use an implicit or explicit interface
for the second Fortran binding
(in deprecated routines, the first one may be omitted).
- Set the LOGICAL constants
MPI_SUBARRAYS_SUPPORTED and
MPI_ASYNC_PROTECTS_NONBLOCKING
according to the same rules as for the
mpi module.
In the case of implicit interfaces for choice buffer
or nonblocking routines, the constants must be set
to .FALSE..
Advice to users.
Instead of using mpif.h, the use of the mpi_f08 or
mpi module is strongly encouraged
for the following reasons:
- Most mpif.h implementations do not include
compile-time argument checking.
- Therefore, many bugs in MPI applications remain
undetected at compile-time, such as:
- Missing ierror as last argument in
most Fortran bindings.
- Declaration of a status as an INTEGER
variable instead of an INTEGER array with
size MPI_STATUS_SIZE.
- Incorrect argument positions; e.g., interchanging the
count and datatype arguments.
- Passing incorrect MPI handles;
e.g., passing a datatype instead of a communicator.
- The migration from mpif.h to the mpi module
should be relatively straightforward
(i.e., substituting INCLUDE 'mpif.h' after
an implicit statement by use mpi
before that implicit statement)
as long as the application syntax is correct.
- Migrating portable and correctly written
applications to the mpi module
is not expected to be difficult. No compile or runtime
problems should occur because an mpif.h include file
was always allowed to provide explicit
Fortran interfaces.
( End of advice to users.)
Up: Support for Fortran
Next: Interface Specifications, Procedure Names, and the Profiling Interface
Previous: Fortran Support Through the mpi Module
Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page
(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023