The mpich implementation provides two commands for compiling and linking C, C++, Fortran-77, and Fortran-90 programs. You may use these commands instead of the Makefile.in versions, particularly for programs contained in a small number of files. In addition, they have a simple interface to the profiling and visualization libraries described in [14]. This is a program to compile or link MPI programs. In addition, the following special options are supported:
mpicc -c foo.c mpiCC -c foo.C mpif77 -c foo.f mpif90 -c foo.f90and
mpicc -o foo foo.o mpiCC -o foo foo.o mpif77 -o foo foo.o mpif90 -o foo foo.oNote that for Fortran 90, different systems may require different suffixes. For example, AIX systems do not support f90 as a file suffix for Fortran 90 programs.
Commands for the linker may include additional libraries. For
example, to use some routines from the MPE library, enter
mpicc -o foo foo.o -lmpeCombining compilation and linking in a single command, as shown here,
mpicc -o foo foo.c mpiCC -o foo foo.C mpif77 -o foo foo.f mpif90 -o foo foo.f90may not work on some systems, and is not recommended.
You can override the choice of compiler by specifying the environment variable MPICH_CC, MPICH_F77, MPICH_CCC, or MPICH_F90. However, be warned that this will work only if the alternate compiler is compatible with the default one (by compatible, we mean that is uses the same sizes for all datatypes and layouts, and generates object code that can be used with the mpich libraries). If you wish to override the linker, use the environment variables MPICH_CLINKER, MPICH_F77LINKER, MPICH_CCLINKER, or MPICH_F90LINKER.