next up previous
Next: Special Considerations for Running Up: Users' Guide to mpich, Previous: Compiling mpich

   
Running an MPI Program

In order to make running programs on parallel machines nearly as portable as writing them, the environment distributed with mpich contains a script for doing so. It is the mpirun command, found in the mpich/bin directory. Several of the examples directories already have symbolic links to this command, but eventually you might want to add it to your path, with

    set path=($path /home/me/mpich/bin)
More details on mpirun can be found in Section [*]. If you are going to run on a network of workstations, you will need a machines.xxxx file in mpich/util/machines. See Section [*] for details.

Some simple MPI programs will have been built during the compilation process. They are in the directory mpich/examples/basic and contain (at least) a C and a Fortran program for estimating 1#1. So change to that directory and do

    mpirun -np 4 cpi
to run the C version, and
    mpirun -np 4 fpi
to run the Fortran version. At this point, you have minimally tested your installation of mpich. You might also want to check out the performance of MPI on your system. You can do a crude check by running the program systest, also found in the examples/basic directory. To try it, do:
    make systest
    mpirun -np 2 systest
For a more precise benchmark, see Section [*].

Another program in the examples/basic subdirectory is cpilog. If you make it and run it, it will produce a simple log file that can be viewed with the program analysis tool upshot. To do so, do

    make cpilog
    mpirun -np <np> cpilog 
    upshot cpilog.log
The log file produced by cpilog is not very interesting, since cpi is such a simple program. Many interesting logfiles can be found in the profiling/upshot/logfiles subdirectory. The file cpilog.c demonstrates how to instrument your own code for producing such logs, and Section [*] describes how to link with a version of mpich that produces them automatically. For more on how to run upshot, see section [*]. For a short description of the programs in the examples/basic directory, see the README file there. The logging routines are part of mpe, so be sure that your configuration has been done with the -mpe option.



 
next up previous
Next: Special Considerations for Running Up: Users' Guide to mpich, Previous: Compiling mpich
Karen D. Toonen
1998-11-19