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.fand
mpicc -o foo foo.o mpif77 -o foo foo.oCommands 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 mpif77 -o foo foo.fmay 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 -lmThese 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