HP-MPI User's Guide (11th Edition)

Understanding HP-MPI
Running applications on HP-UX and Linux
Chapter 372
The -f option specifies the filename that follows it is an appfile. mpirun
parses the appfile, line by line, for the information to run the program. In
this example, mpirun runs the hello_world program with two processes
on the local machine, jawbone, and two processes on the remote machine,
wizard, as dictated by the -np 2 option on each line of the appfile.
Step 5. Analyze hello_world output.
HP-MPI prints the output from running the hello_world executable in
non-deterministic order. The following is an example of the output:
Hello world! I'm 2 of 4 on wizard
Hello world! I'm 0 of 4 on jawbone
Hello world! I'm 3 of 4 on wizard
Hello world! I'm 1 of 4 on jawbone
Notice that processes 0 and 1 run on jawbone, the local host, while
processes 2 and 3 run on wizard. HP-MPI guarantees that the ranks of
the processes in MPI_COMM_WORLD are assigned and sequentially ordered
according to the order the programs appear in the appfile. The appfile in
this example, my_appfile, describes the local host on the first line and
the remote host on the second line.
Running MPMD applications
A multiple program multiple data (MPMD) application uses two or more
separate programs to functionally decompose a problem. This style can
be used to simplify the application source and reduce the size of spawned
processes. Each process can execute a different program.
MPMD with appfiles
To run an MPMD application, the mpirun command must reference an
appfile that contains the list of programs to be run and the number of
processes to be created for each program.
A simple invocation of an MPMD application looks like this:
% $MPI_ROOT/bin/mpirun -f appfile
where appfile is the text file parsed by mpirun and contains a list of
programs and process counts.
Suppose you decompose the poisson application into two source files:
poisson_master (uses a single master process) and poisson_child (uses
four child processes).