Next: Checking and Killing Processes Previous: Creating a machinefile

## Running MPI

In order to run an MPI compiled program, you must type:

    mpirun -np <number of processors> [mpirun_options] <program name and arguments>

where you specify the number of processors on which you want to run your parallel program, the `mpirun` options, and your program name and its expected arguments (if any).

Apart from specifying the number of processors to use, about the only other mpirun options you might possibly need to use is `-machinefile` for specifying the list of machines to choose from (see the previous section). Note that if you do not specify a machine file on the command line, the default list (which contains ALL computers) will be used. This could cause problems, particularly on the Linux machines, if some of these computers are unavailable for use.

Some examples of mpirun's:

         mpirun -np 4 hello
         mpirun -np 6 -machinefile machines hello
         mpirun -np 5 integrate 0 1
         mpirun -arch LINUX -np 2 -arch solaris -np 4 program.%a

The first example runs on 4 processors chosen from the gloabla machines file corresponding to the automatically detected architecture (to see what this is type `tarch`). The second example uses a manually specified machines file. The third example demonstrates the passing of parameters to the parallel program by placing them after its name on the command line. The fourth example demonstrates the use of two (possibly different) architectures for running the program - two computers will be chosen from the global file machines.LINUX and four from machines.solaris. The %a indicates that the program to be run has different numbres depending on the architecture, `program.LINUX` and `program.solaris` (which should both be in the current directory) respectively. Note that in the command line the specification of the architecture precedes the choice of number of processors, at least when multiple architectures are used.

Type `man mpirun` or `mpirun -help` for a complete list of `mpirun` options.

For information on running MPI programs on the various networks in UWA's School of Electrical, Electronic and Computer Engineering look here.