
32
Link it by using the following command (note that in this case, it requires the math library):
# mpicc -o cpi cpi.o -lm
NOTE: A
Makefile
is provided in the examples directory. With this
Makefile
, one just
needs to run make to compile and link the program. This
Makefile
can be used as a
starting point for building other MPICH applications.
4.4.1 Creating a MPI Cluster
Machines
File
Before you can run an MPI program on your cluster, you need to create a
machines
file to
tell MPI about the cluster configuration. The location of the
machines
file is:
<install_dir>/mpich-1.2.5/share/machines.LINUX
Or for a 32-bit install on a 64-bit machine
<install_dir>/mpich-1.2.5-32/share/machines.LINUX
Using a text editor, create the appropriate machines file, containing a list of all the host
machines that you will be using, one per line. For example:
# cd <install_dir>/mpich-1.2.5/share
# cat machines.LINUX
hostA
# Comments are also allowed
hostB
Each host listed must either be a valid IP address or a host name that returns a valid IP
address from the DNS.
NOTE: the TCP/IP address used for MPI control should not be confused with the
RDMA IP Address which is used by MPI to move MPI data. The TCP/IP address
traditionally would correspond to the
AMSO_IPADDR
found in the
amso_ccil_0_0
function in the
rnic_cfg
file or a TCP/IP address associated with another NIC (e.g. eth0).
The Ammasso MPICH implementation does not wrap the machine file hostnames. If you
specify a command line to run with four processes (
-np 4
), the
machines.LINUX
file
must have four host processors listed. Also, the Ammasso MPICH implementation does not
start an MPICH process on the local host by default. Each node on which you wish to run
the MPICH job must be specified in the
machines.LINUX
file.
It is possible to run multiple instances of a program on the same host. Either enter that
hostname into the file multiple times, or add a colon and a number on the corresponding line
in the machines file. For example:
# cd <install_dir>/mpich-1.2.5/share
# cat machines.LINUX
hostA:2
# Two instances on this node
hostB:4
# Four instances on this node