To run an MPI program, use the mpirun command, which is located in
/usr/local/mpich/bin, or
/usr/local/mpich/build/<arch>/<device>/bin. For almost all systems,
you can use the command
mpirun -np 4 a.outto run the program a.out on four processors. The command mpirun -help gives you a complete list of options, which may also be found in Appendix Options for mpirun .
On exit, mpirun returns a status of zero unless mpirun detected a problem, in which case it returns a non-zero status (currently, all are one, but this may change in the future).
When using the p4 device in workstation clusters,
multiple architectures may be handled by giving multiple -arch
and
-np arguments. For example, to run a program on 2 sun4s and 3 rs6000s,
with the local machine being a sun4, use
mpirun -arch sun4 -np 2 -arch rs6000 -np 3 programThis assumes that program will run on both architectures. If different executables are needed, the string '%a' will be replaced with the arch name. For example, if the programs are program.sun4 and program.rs6000, then the command is
mpirun -arch sun4 -np 2 -arch rs6000 -np 3 program.%aIf instead the execuables are in different directories; for example, /tmp/me/sun4 and /tmp/me/rs6000, then the command is
mpirun -arch sun4 -np 2 -arch rs6000 -np 3 /tmp/me/%a/programIt is important to specify the architecture with -arch before specifying the number of processors. Also, the first arch command must refer to the processor on which the job will be started. Specifically, if -nolocal is not specified, then the first -arch must refer to the processor from which mpirun is running.
When running on multiple machines using the globus device, mpirun is also used, but different techniques are used to control how executables are selected. See Section Computational grids: the globus device for details.