Scripts to Compile and Link Applications


Up: Linking and running programs Next: Fortran 90 and the MPI module Previous: Linking and running programs

The mpich implementation provides four commands for compiling and linking C (mpicc), Fortran 77 (mpif77), C++ (mpiCC), and Fortran 90 (mpif90) 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]. In addition, the following special options are supported:

-mpilog
Build version that generates MPE log files.
-mpitrace
Build version that generates traces.
-mpianim
Build version that generates real-time animation.
-show
Show the commands that would be used without actually running them.

Use these commands just like the usual C, Fortran 77, C++, or Fortran compilers. For example,
    mpicc -c foo.c  

    mpif77 -c foo.f 

    mpiCC -c foo.C 

    mpif90 -c foo.f 

and
    mpicc -o foo foo.o 

    mpif77 -o foo foo.o 

    mpiCC -o foo foo.o 

    mpif90 -o foo foo.o 

Commands for the linker may include additional libraries. For example, to use routines from the C math library library, use
    mpicc -o foo foo.o -lm 

Combining compilation and linking in a single command, as shown here,
    mpicc -o foo foo.c 

    mpif77 -o foo foo.f 

    mpiCC -o foo foo.C 

    mpif90 -o foo foo.f 

may also be used.

Note that while the suffixes .c for C programs and .f for Fortran-77 programs are standard, there is no consensus for the suffixes for C++ and Fortran-90 programs. The ones shown here are accepted by many but not all systems.



Up: Linking and running programs Next: Fortran 90 and the MPI module Previous: Linking and running programs


Fortran 90 and the MPI module


Up: Scripts to Compile and Link Applications Next: Compiling and Linking without the Scripts Previous: Scripts to Compile and Link Applications

When mpich was configured, the installation process normally looks for a Fortran 90 compiler, and if it finds one, builds two different versions of an MPI module. One module includes only the MPI routines that do not take ``choice'' arguments; the other includes all MPI routines. A choice argument is an argument that can take any datatype; typically, these are the buffers in MPI communication routines such as MPI_Send and MPI_Recv. The two different modules can be accessed with the -nochoice and -choice option to mpif90 respectively. The choice version of the module supports a limited set of datatypes (numeric scalars and numeric one- and two-dimensional arrays). This is an experimental feature; please send mail to mpi-bugs@mcs.anl.gov if you have any trouble. Neither of these modules offer full ``extended Fortran support'' as defined in the MPI-2 standard.



Up: Scripts to Compile and Link Applications Next: Compiling and Linking without the Scripts Previous: Scripts to Compile and Link Applications