358. Fortran Support Through the mpif.h Include File
Up: Fortran Support
Next: Interface Specifications, Procedure Names, and the Profiling Interface
Previous: Fortran Support Through the mpi Module
The use of the mpif.h include file is strongly discouraged
and may be deprecated in a future version of MPI.
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 compile-time 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.)
Rationale.
With MPI-3.0, the mpif.h include file was not
deprecated in order to retain strong backward compatibility.
Internally, mpif.h and the mpi module may be
implemented so that essentialy the same library implementation
of the MPI routines can be used.
( End of rationale.)
Up: Fortran Support
Next: Interface Specifications, Procedure Names, and the Profiling Interface
Previous: Fortran Support Through the mpi Module
Return to MPI-3.1 Standard Index
Return to MPI Forum Home Page
(Unofficial) MPI-3.1 of June 4, 2015
HTML Generated on June 4, 2015