Scripts to Compile and Link Applications


Up: Linking and running programs Next: Running with mpirun 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 [10]. 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 or Fortran compiler. For example,
    mpicc -c foo.c  
    mpif77 -c foo.f 
and
    mpicc -o foo foo.o 
    mpif77 -o foo foo.o 
Similarly for C++ and Fortran 90 programs. 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 
may also be used.

These commands are set up for a specific architecture and MPICH device and are located in the /usr/local/mpich/build/<arch>/<device>/bin directory. For example, if the architecture is sun4 and the device is ch_p4, these commands may be found in /usr/local/mpich/build/sun4/ch_p4/bin (assuming that MPICH is installed in /usr/local/mpich).



Up: Linking and running programs Next: Running with mpirun Previous: Linking and running programs