Compiling LAM-MPI with support for IBM
XLC and XLF
I
had a lot of help from various colleagues and the friendly folks at LAM-MPI. This first page is centered on the
use of LAM-MPI with the IBM
XLC and XL
Fortran compilers. If you don't need FORTRAN support and want to use GCC
instead of IBM's XLC, you can get by with just using the LAM-MPI Mac OS X package
installer. If these first pages are useful, I'll put up follow-on pages
with directions for building other MPIs and other compilers.
Document
Key:
Plain
black text are the descriptions of what we are doing
Green text are input to the terminal
cd lam-7.0.x
export CC=/opt/ibmcmp/vacpp/6.0/bin/xlc
export CXX=/opt/ibmcmp/vacpp/6.0/bin/xlc++
export FC=/opt/ibmcmp/xlf/8.1/bin/xlf
export F77=/opt/ibmcmp/xlf/8.1/bin/xlf
export CFLAGS="-O3"
export CXXFLAGS="-O3"
export FFLAGS="-O3"
By
default, LAM-MPI installs itself in /usr/local. However, if you would like to
maintain a clean path to LAM-MPI or install different versions of LAM-MPI, you
might want to install LAM-MPI in a different directory location. For example,
you might want to install LAM-MPI in /usr/local/lam/ directory. In order to do
that simply add the --prefix=/usr/local/lam flag to the ./configure script. After setting the environment
variables, the sequence of steps should look like this:
The "--with-memory-manager=none"
is used only if you are using LAM with the IBM XL Compilers. Additionally, if you are installing the latest 7.1.x beta version
of LAM, you also do not need the "--with-memory-manager=none". I have been successfully running the LAM-MPI beta release
with GigE, Myrinet, and Infiniband support; when configuring with support for the other fabrics just specify "--with-gm=[path
to gm]none" or "--with-ib=[path to ib]none"
If
you need to configure the "configure" script, get help on the script
by typing "./configure --help" at the command prompt. If you
need more control over the LAM installation process, read the manual :-).
sudo make install
In
order for all users to be able to run LAM-MPI and dynamically link to the IBM
libraries, we will need to edit the global bashrc file located in in /etc.
Additionally, we will make any necessary edits to /etc/profile to make sure we
source the bashrc file that just modified. Below are the instructions.
Editing
/etc/bashrc:
Editing
the /etc/bashrc file, as opposed to creating a .bash_profile in your own user
account will allow any user account on your Mac to have the correct paths.
# System-wide .bashrc file for interactive bash(1) shells.
PS1='\h:\w \u\$ '
# Make bash check it's window size after a process completes
shopt -s checkwinsize
PATH="$PATH:/usr/local/lam/bin"
fi
PATH="$PATH:/opt/ibmcmp/xlf/8.1/bin"
fi
if [ -r /opt/ibmcmp/vacpp/6.0/bin ]; then
PATH="/opt/ibmcmp/vacpp/6.0/bin:$PATH"
fi
export PATH
Editing
/etc/profile
# System-wide .profile for sh(1)
export PATH
Compiling
the demo programs. I had some problems running the Makefile and didn't want to
figure it out. Instead, I went into the directories of each of the demo
programs and compiled using the appropriate commands. You can find these out by
reading the README file in each of the example files. Below is an example:
cd ~/myaccount/lam-7.0.6/examples/pi
mpicc -o cpi cpi.c -lm
mpic++ -o cxxpi cxxpi.cc -lm
mpif77 -o fpi fpi.f -lm
Runnig
the Pi demo. Change directories to where your Pi examples are stored, in this
case, to the LAM-MPI directory.
cd /usr/local/lam/bin
Start
the LAM daemon:
Launching
the MPI job:
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/cpi
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/fpi
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/cxxpi
The
machinefile: For
LAM-MPI to run jobs across the cluster, it will also need to have a list of
available machines. An example machine file containing four computers is shown
below:
Shell$ more lam_nodes
node1.cluster.private cpu=2
node2.cluster.private cpu=2
node3.cluster.private cpu=2
node4.cluster.private cpu=2
# end sample lam machines
To
launch a job with these machines, we will run lamboot and point to this machine
file with the -machinefile option. Running the Pi demo on the above machines
would look like this (assuming four dual processor G5 Xserves):
Starting
the LAM daemon:
cd /usr/local/lam/bin/
./lamboot -v -ssi boot rsh lamnode_file
Launching
the MPI job:
Important,
in order for a successful launch of the jobs, the applications will need to be
compiled and installed in the exact same location on every node (Usually, this
done with a common shared directory across all the nodes).
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/cpi
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/fpi
./mpirun C /Users/myaccount/lam-7.0.6/examples/pi/cxxpi