The mpicc and mpif77 commands


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

The mpich implementation provides two commands for compiling and linking C (mpicc) and Fortran (mpif77) 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 [6]. This is a program to compile or link MPI programs. 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 
Commands for the linker may include additional libraries. For example, to use some routines from the MPE library, enter
mpicc -o foo foo.o -lmpe 
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. Note that just as for regular C programs, you may need to specify the math library with -lm:
mpicc -o foo foo.c -lm  
These commands are set up for a specific architecture and mpich device and are located in the directory that contains the MPI libraries. For example, if the architecture is sun4 and the device is ch_p4, these commands may be found in /usr/local/mpi/lib/sun4/ch_p4 (assuming that mpich is installed in /usr/local/mpi).



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