Specifying hosts using a host list file
The host list file is a flat text file that contains the names of the hosts on which your applications run.
Each host is included on a separate line. For example, the following display the contents of a
simple host list file called
myhosts
:
node1.mydomain.com
node2.mydomain.com
node3.mydomain.com
node4.mydomain.com
myhosts
and the node1.mydomain.com
entry might not be the first
node that is used, even though it is listed first in the host list file. For example, the following
might be the order in which the nodes are used:- node3.mydomain.com
- node2.mydomain.com
- node1.mydomain.com
- node4.mydomain.com
After you have created the host list file, you can specify it on the command line using the
--hostfile (also known as --machinefile) option of the
mpirun command. For example, using the simple myhosts host list file, you
could run your application, prog01, as
follows:
mpirun -np 4 --hostfile myhosts prog01
For each host, the host list file can also specify:
- The number of slots (the number of available processors on that host). The number of slots can
be determined by the number of cores on the node or the number of processor sockets. If no slots are
specified for a host, then the number of slots defaults to one. In this example, a host list file
called myhosts specifies three nodes, and each node has two
slots:
Specifying the following command launches six instances of prog01; two on node1, two on node2, and two on node3:cat myhosts node1 slots=2 node2 slots=2 node3 slots=2
mpirun -hostfile myhosts prog01
- The maximum number of slots. Note that the maximum slot count on a host defaults to infinite, thereby allowing IBM Spectrum® MPI to oversubscribe to it. To avoid oversubscribing, you can provide a maximum slot value for the host (max-slots=*).
For
example:
# This is a single processor node:
node1.mydomain.com
# This is a dual-processor node:
node2.mydomain.com slots=2
# This is a quad-processor node. Oversubscribing
# to it is prevented by setting max-slots=4:
node3.mydomain.com slots=4 max-slots=4