Parallel Programming Guide for HP-UX Systems

MPI
Running
Chapter 244
send_receive arg1 arg2 arg3 -arg4 arg5
The compute_pi command line for machine enterprise becomes:
compute_pi arg3 -arg4 arg5
When you use the --
extra_args_for_appfile
option, it must be specified at the end of the mpirun
command line.
Setting remote environment variables To set environment variables on remote hosts use the -e
option in the appfile. For example, to set the variable MPI_FLAGS:
-h
remote_host
-e MPI_FLAGS=
val
[-np
#
]
program
[
args
]
Environment variables can also be set globally on the mpirun command line:
% $MPI_ROOT/bin/mpirun -e MPI_FLAGS=y -f appfile
In the above example, if some MPI_FLAGS setting was specified in the appfile, then the global setting on
the command line would override the setting in the appfile. To add to an environment variable rather
than replacing it, use the following command:
% $MPI_ROOT/bin/mpirun -e MPI_FLAGS=%MPI_FLAGS,y -f appfile
In the above example, if the appfile specified MPI_FLAGS=z, then the resulting MPI_FLAGS seen by the
application would be z, y.
Assigning ranks and improving communication The ranks of the processes in
MPI_COMM_WORLD are assigned and sequentially ordered according to the order the programs
appear in the appfile.
For example, if your appfile contains
-h voyager -np 10 send_receive
-h enterprise -np 8 compute_pi
HP MPI assigns ranks 0 through 9 to the 10 processes running send_receive and ranks 10 through 17 to
the 8 processes running compute_pi.
You can use this sequential ordering of process ranks to your advantage when you optimize for
performance on multihost systems. You can split process groups according to communication patterns to
reduce or remove interhost communication hot spots.
For example, if you have the following:
A multi-host run of four processes
Two processes per host on two hosts
Communication between ranks 0—2 and 1—3 is slow.
You could use an appfile that contains the following:
-h hosta -np 2 program1
-h hostb -np 2 program2