mpif90 - Compiles and links MPI programs written in Fortran 90
This command can be used to compile and link MPI programs written in
Fortran. It provides the options and any special libraries that are
needed to compile and link MPI programs.
It is important to use this command, particularly when linking programs,
as it provides the necessary libraries.
COMMAND LINE ARGUMENTS
- Show the commands that would be used without
- Give short help
- Use compiler
instead of the default choice. Use
this only if the compiler is compatible with the MPICH
library (see below)
- Load a configuration file for a particular compiler.
This allows a single
command to be used with
- Show the steps for compiling a program. This option
can be used to see what options and include paths are
used by mpif90.
- Show the steps for linking a program. This optoin
can be used to see what options and libraries are used by
- Use the MPI profiling given by name. See below for
- Use an MPE profiling library. The behavior is similar
- Show exactly what this program is doing.
This option should normally not be used.
- are passed to the compiler or linker. For example,
causes files to be compiled,
selects compilation with
debugging on most systems, and
with the output executable given the name
The environment variables
may be used
to select different Fortran compiler and linker. Note that since
MPICH is built with a particular C and Fortran compiler, change the
compilers used can cause problems. Use this only if you could intermix
code compiled with the different compilers.
The MPI library may be used with any compiler that uses the same
lengths for basic data objects (such as
) and that
uses compatible run-time libraries. On many systems, the various
compilers are compatible and may be used interchangably. There are
exceptions; if you use the
environment variable or the
command-line argument to override the choice of compiler
and encounter problems, try reconfiguring MPICH2 with the new compiler
and installing MPICH2 in a separate location. See the installation manual
for more details.
To compile a single file
mpif90 -c foo.f
To link the output and make an executable, use
mpif90 -o foo foo.o
Combining compilation and linking in a single command
mpif90 -o foo foo.f
is a convenient way to build simple programs.
SELECTING A PROFILING LIBRARY
argument allows you to specify an MPI profiling
library to be used.
can have two forms:
A library in the same directory as the MPI library
The name of a profile configuration file
is a library, then this library is included before the MPI
library. This allows the simple use of libraries that make use of the
MPI profiling interface and that are installed in the same directory as
the MPI library.
is the name of a file in the sysconfdir directory, then this
is read and may define the following variables:
- Libraries (and paths) to include before the MPI library
- Libraries to include after the MPI library
- C preprocessor arguments for any include files
For example, to add
to the include path and
to the link step,
you could create the file
with the lines
and place it in the sysconfdir directory (this directory is set at
configure time when MPICH is built). Then using the command-line
will cause these
definitions to be added to the relevant compile commands.