Running an MPI Program


Up: Contents Next: Special Considerations for Running on a Network of Workstations Previous: Building multiple devices or architectures

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 (assuming your shell is the C shell)

    set path=($path /home/me/mpich/bin) 

More details on mpirun can be found in Section mpirun, a Portable Startup Script . If you are going to run on a network of workstations, you will need a machines.xxxx file in mpich/util/machines; see Section Special Considerations for Running on a Network of Workstations for details. Systems that use various kinds of filesystem automounters may need to make small changes to these programs; these are detailed in Section Dealing with automounters .

Some simple MPI programs will have been built during the compilation process. They are in the directory mpich/examples/basic and contain a C and a Fortran program for estimating . 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 Benchmarking mpich .



Up: Contents Next: Special Considerations for Running on a Network of Workstations Previous: Building multiple devices or architectures