Blame doc/installguide/install.tex.vin

Packit 0848f5
% -*- Mode: latex; -*-
Packit 0848f5
\documentclass[dvipdfm,11pt]{article}
Packit 0848f5
\usepackage[dvipdfm]{hyperref} % Upgraded url package
Packit 0848f5
\parskip=.1in
Packit 0848f5
Packit 0848f5
% Formatting conventions for contributors
Packit 0848f5
% 
Packit 0848f5
% A quoting mechanism is needed to set off things like file names, command
Packit 0848f5
% names, code fragments, and other strings that would confuse the flow of
Packit 0848f5
% text if left undistinguished from preceding and following text.  In this
Packit 0848f5
% document we use the LaTeX macro '\texttt' to indicate such text in the
Packit 0848f5
% source, which normally produces, when used as in '\texttt{special text}',
Packit 0848f5
% the typewriter font.
Packit 0848f5
Packit 0848f5
% It is particularly easy to use this convention if one is using emacs as
Packit 0848f5
% the editor and LaTeX mode within emacs for editing LaTeX documents.  In
Packit 0848f5
% such a case the key sequence ^C^F^T (hold down the control key and type
Packit 0848f5
% 'cft') produces '\texttt{}' with the cursor positioned between the
Packit 0848f5
% braces, ready for the special text to be typed.  The closing brace can
Packit 0848f5
% be skipped over by typing ^e (go to the end of the line) if entering
Packit 0848f5
% text or ^C-} to just move the cursor past the brace.
Packit 0848f5
Packit 0848f5
% LaTeX mode is usually loaded automatically.  At Argonne, one way to 
Packit 0848f5
% get several useful emacs tools working for you automatically is to put
Packit 0848f5
% the following in your .emacs file.
Packit 0848f5
Packit 0848f5
% (require 'tex-site)
Packit 0848f5
% (setq LaTeX-mode-hook '(lambda ()
Packit 0848f5
%                        (auto-fill-mode 1)
Packit 0848f5
%                        (flyspell-mode 1)
Packit 0848f5
%                        (reftex-mode 1)
Packit 0848f5
%                        (setq TeX-command "latex")))
Packit 0848f5
Packit 0848f5
%
Packit 0848f5
% When updating the version number of MPICH, make sure that you change *all*
Packit 0848f5
% instances of the version.  Search for mpich- and check each match.  Some
Packit 0848f5
% are within a verbatim statement and will need to be changed for each update.
Packit 0848f5
%
Packit 0848f5
Packit 0848f5
\begin{document}
Packit 0848f5
\markright{MPICH Installer's Guide}
Packit 0848f5
\title{{\bf MPICH Installer's Guide}\thanks{This work was supported by the
Packit 0848f5
    Mathematical, Information, and Computational Sciences Division
Packit 0848f5
    subprogram of the Office of Advanced Scientific Computing Research,
Packit 0848f5
    SciDAC Program, Office of Science, U.S. Department of Energy, under
Packit 0848f5
    Contract DE-AC02-06CH11357.}\\
Packit 0848f5
  Version %MPICH_VERSION%\\
Packit 0848f5
  Mathematics and Computer Science Division\\
Packit 0848f5
  Argonne National Laboratory}
Packit 0848f5
Packit 0848f5
\author{
Packit 0848f5
Abdelhalim Amer \and Pavan Balaji \and Wesley Bland \and William Gropp \and
Packit 0848f5
Yanfei Guo \and Rob Latham \and Huiwei Lu \and Lena Oden \and Antonio J. Pe\~na
Packit 0848f5
\and Ken Raffenetti \and Sangmin Seo \and Min Si \and Rajeev Thakur \and
Packit 0848f5
Junchao Zhang \and Xin Zhao
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
\maketitle
Packit 0848f5
\cleardoublepage
Packit 0848f5
Packit 0848f5
\pagenumbering{roman}
Packit 0848f5
\tableofcontents
Packit 0848f5
\clearpage
Packit 0848f5
Packit 0848f5
\pagenumbering{arabic}
Packit 0848f5
\pagestyle{headings}
Packit 0848f5
Packit 0848f5
%% Here is a basic outline for the document.   (Bill's original outline)
Packit 0848f5
Packit 0848f5
%% 0. Quick start with ``best practices''.  Each step has a reference to
Packit 0848f5
%% more detailed information later in the document.
Packit 0848f5
%% 1. Acquiring and unpacking.  Using a ``fast'' directory location and
Packit 0848f5
%%    VPATH
Packit 0848f5
%% 1a. Reporting problems
Packit 0848f5
%% 2. Choosing a device (defer a detailed discussion of each until later)
Packit 0848f5
%% 3. configure, make, and install.  Always use --prefix 
Packit 0848f5
%% show only basic options for configure
Packit 0848f5
%%    3a. Optional include of device-specific information
Packit 0848f5
%%    3b. Optional include of pm-specific information
Packit 0848f5
%%    3c. Optional ``fast'' version
Packit 0848f5
%%    3d. Shared libraries
Packit 0848f5
%% 4. Testing and benchmarking
Packit 0848f5
%% 4a. make testing
Packit 0848f5
%% 4b. Getting, building, and using mpptest and netpipe
Packit 0848f5
%% 5. Special options
Packit 0848f5
%% 6. Troubleshooting
Packit 0848f5
%% Appendix:
Packit 0848f5
%% A. Summary of configure options (particularly the enable and with options)
Packit 0848f5
Packit 0848f5
Packit 0848f5
\section{Introduction}
Packit 0848f5
\label{sec:intro}
Packit 0848f5
This manual describes how to obtain and install MPICH, the MPI
Packit 0848f5
implementation from Argonne National Laboratory.  (Of course, if you are
Packit 0848f5
reading this, chances are good that you have already obtained it and
Packit 0848f5
found this document, among others, in its \texttt{doc} subdirectory.)
Packit 0848f5
This \emph{Guide} will explain how to install MPICH so that you and others can use it to
Packit 0848f5
run MPI applications.  Some particular features are different
Packit 0848f5
if you have system administration privileges (can become ``root'' on a
Packit 0848f5
Unix system), and these are explained here.  It is not necessary to have
Packit 0848f5
such privileges to build and install MPICH.  In the event of problems,
Packit 0848f5
send mail to \texttt{discuss@mpich.org}.  Once MPICH is
Packit 0848f5
installed, details on how to run MPI jobs are covered in the \emph{MPICH
Packit 0848f5
User's Guide}, found in this same \texttt{doc} subdirectory.
Packit 0848f5
Packit 0848f5
MPICH has many options.  We will first go through a recommended,
Packit 0848f5
``standard'' installation in a step-by-step fashion, and later describe
Packit 0848f5
alternative possibilities. 
Packit 0848f5
Packit 0848f5
Packit 0848f5
\section{Quick Start}
Packit 0848f5
\label{sec:quick}
Packit 0848f5
Packit 0848f5
In this section we describe a ``default'' set of installation steps.
Packit 0848f5
It uses the default set of configuration options, which builds the
Packit 0848f5
\texttt{nemesis} communication device and the \texttt{Hydra} process
Packit 0848f5
manager, for languages C, C++, Fortran-77, and Fortran-90 (if those
Packit 0848f5
compilers exist), with compilers chosen automatically from the user's
Packit 0848f5
environment, without tracing and debugging options.  It uses the
Packit 0848f5
\texttt{VPATH} feature of \texttt{make}, so that the build process can
Packit 0848f5
take place on a local disk for speed.
Packit 0848f5
Packit 0848f5
\subsection{Prerequisites}
Packit 0848f5
\label{sec:prerequisites}
Packit 0848f5
Packit 0848f5
For the default installation, you will need:
Packit 0848f5
\begin{enumerate}
Packit 0848f5
\item A copy of the distribution, \texttt{mpich.tar.gz}.
Packit 0848f5
\item A C compiler.
Packit 0848f5
\item A Fortran-77, Fortran-90, and/or C++ compiler if you wish to write
Packit 0848f5
  MPI programs in any of these languages.
Packit 0848f5
\item Any one of a number of Unix operating systems, such as IA32-Linux.
Packit 0848f5
  MPICH is most extensively tested on Linux;  there remain some
Packit 0848f5
  difficulties on systems to which we do not currently have access.  Our
Packit 0848f5
  \texttt{configure} script attempts to adapt MPICH to new systems. 
Packit 0848f5
\end{enumerate}
Packit 0848f5
Configure will check for these prerequisites and try to work around
Packit 0848f5
deficiencies if possible.  (If you don't have Fortran, you will
Packit 0848f5
still be able to use MPICH, just not with Fortran applications.)
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsection{From A Standing Start to Running an MPI Program}
Packit 0848f5
\label{sec:steps}
Packit 0848f5
Here are the steps from obtaining MPICH through running your own
Packit 0848f5
parallel program on multiple machines.
Packit 0848f5
Packit 0848f5
\begin{enumerate}
Packit 0848f5
\item 
Packit 0848f5
Unpack the tar file.
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    tar xfz mpich.tar.gz
Packit 0848f5
\end{verbatim}
Packit 0848f5
If your tar doesn't accept the z option, use
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    gunzip -c mpich.tar.gz | tar xf -
Packit 0848f5
\end{verbatim}
Packit 0848f5
Let us assume that the directory where you do this is
Packit 0848f5
\texttt{/home/you/libraries}.  It will now contain a subdirectory named
Packit 0848f5
\texttt{mpich-%MPICH_VERSION%}.
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Choose an installation directory (the default is \texttt{/usr/local/bin)}:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mkdir /home/you/mpich-install
Packit 0848f5
\end{verbatim}
Packit 0848f5
It will be most convenient if this directory is shared by all of the
Packit 0848f5
machines where you intend to run processes.  If not, you will have
Packit 0848f5
to duplicate it on the other machines after installation.  Actually, if
Packit 0848f5
you leave out this step, the next step will create the directory for you.
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Choose a build directory.  Building will proceed \emph{much} faster if
Packit 0848f5
your build directory is on a file system local to the machine on which
Packit 0848f5
the configuration and compilation steps are executed.  It is preferable
Packit 0848f5
that this also be separate from the source directory, so that the
Packit 0848f5
source directories remain
Packit 0848f5
clean and can be reused to build other copies on other machines.
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mkdir /tmp/you/mpich-%MPICH_VERSION%
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Choose any configure options.  See
Packit 0848f5
Section~\ref{sec:important-configure-options} for a description of the most
Packit 0848f5
important options to consider.  
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Configure MPICH, specifying the installation directory, and running
Packit 0848f5
the \texttt{configure} script in the source directory:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    cd  /tmp/you/mpich-%MPICH_VERSION%
Packit 0848f5
    /home/you/libraries/mpich-%MPICH_VERSION%/configure \
Packit 0848f5
            -prefix=/home/you/mpich-install |& tee c.txt
Packit 0848f5
\end{verbatim}
Packit 0848f5
where the \texttt{$\backslash$} means that this is really one line.  (On
Packit 0848f5
\texttt{sh} and its derivatives, use \verb+2>&1 | tee c.txt+
Packit 0848f5
instead of \verb+|& tee c.txt+).  Other configure options are
Packit 0848f5
described below.  Check the \texttt{c.txt} file to make sure
Packit 0848f5
everything went well.  Problems should be self-explanatory, but if not,
Packit 0848f5
send \texttt{c.txt} to \texttt{discuss@mpich.org}.
Packit 0848f5
The file \texttt{config.log} is created by \texttt{configure} and
Packit 0848f5
contains a record of the tests that \texttt{configure} performed.  It
Packit 0848f5
is normal for some tests recorded in \texttt{config.log} to fail.  
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Build MPICH:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    make |& tee m.txt       (for csh and tcsh)
Packit 0848f5
      OR
Packit 0848f5
    make 2>&1 | tee m.txt   (for bash and sh)
Packit 0848f5
\end{verbatim}
Packit 0848f5
This step should succeed if there were no problems with the preceding
Packit 0848f5
step.  Check file \texttt{m.txt}. If there were problems,
Packit 0848f5
do a \texttt{make clean} and then run make again with \texttt{VERBOSE=1}
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    make VERBOSE=1 |& tee m.txt       (for csh and tcsh)
Packit 0848f5
      OR
Packit 0848f5
    make VERBOSE=1 2>&1 | tee m.txt   (for bash and sh)
Packit 0848f5
\end{verbatim}
Packit 0848f5
and then send \texttt{m.txt} and \texttt{c.txt} to 
Packit 0848f5
\texttt{discuss@mpich.org}.
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Install the MPICH commands:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    make install |& tee mi.txt
Packit 0848f5
\end{verbatim}
Packit 0848f5
This step collects all required executables and scripts in the \texttt{bin}
Packit 0848f5
subdirectory of the directory specified by the prefix argument to
Packit 0848f5
configure. 
Packit 0848f5
Packit 0848f5
(For users who want an install directory structure compliant to
Packit 0848f5
GNU coding standards (i.e., documentation files go to
Packit 0848f5
\texttt{\$\{datarootdir\}/doc/\$\{PACKAGE\}}, architecture independent
Packit 0848f5
read-only files go to \texttt{\$\{datadir\}/\$\{PACKAGE\}}), replace
Packit 0848f5
\texttt{make install} by
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
       make install PACKAGE=mpich-<versrion>
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
and corresponding installcheck step should be
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
       make installcheck PACKAGE=mpich-<version>
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
Setting PACKAGE in \texttt{make install} or \texttt{make installcheck} step
Packit 0848f5
is optional and unnecessary for typical MPI users.)
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Add the \texttt{bin} subdirectory of the installation directory to your path:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    setenv PATH /home/you/mpich-install/bin:$PATH
Packit 0848f5
\end{verbatim}
Packit 0848f5
for \texttt{csh} and \texttt{tcsh}, or 
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    export PATH=/home/you/mpich-install/bin:$PATH
Packit 0848f5
\end{verbatim}
Packit 0848f5
for \texttt{bash}, and
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    PATH=/home/you/mpich-install/bin:$PATH
Packit 0848f5
    export PATH
Packit 0848f5
\end{verbatim}
Packit 0848f5
for \texttt{sh} (the \texttt{bash} syntax may work for more recent 
Packit 0848f5
implementations of \texttt{sh}).  % export var=value is an extension and
Packit 0848f5
                                  % is not in original sh
Packit 0848f5
Check that everything is in order at
Packit 0848f5
this point by doing
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    which mpicc
Packit 0848f5
    which mpiexec
Packit 0848f5
\end{verbatim}
Packit 0848f5
All should refer to the commands in the \texttt{bin} subdirectory of your
Packit 0848f5
install directory.  It is at this point that you will need to
Packit 0848f5
duplicate this directory on your other machines if it is not
Packit 0848f5
in a shared file system. % Just having NFS doesn't mean that directories
Packit 0848f5
                         % are consistencly cross-mounted.
Packit 0848f5
Packit 0848f5
\item Check that you can reach these machines with \texttt{ssh} or
Packit 0848f5
\texttt{rsh} without entering a password.  You can test by doing
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    ssh othermachine date
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
or
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    rsh othermachine date
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
If you cannot get this to work without entering a password, you will
Packit 0848f5
need to configure \texttt{ssh} or \texttt{rsh} so that this can be
Packit 0848f5
done.
Packit 0848f5
Packit 0848f5
\item Test the setup you just created:
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mpiexec -f machinefile -n <number> hostname
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
The machinefile contains the list of hosts you want to run the
Packit 0848f5
executable on.
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  % cat machinefile
Packit 0848f5
     host1     # Run 1 process on host1
Packit 0848f5
     host2:4   # Run 4 processes on host2
Packit 0848f5
     host3:2   # Run 2 processes on host3
Packit 0848f5
     host4:1   # Run 1 process on host4
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
\item
Packit 0848f5
Now we will run an MPI job, using the \texttt{mpiexec} command as specified
Packit 0848f5
in the MPI standard.
Packit 0848f5
Packit 0848f5
As part of the build process for MPICH, a simple program to compute the value
Packit 0848f5
of $\pi$ by numerical integration is created in the
Packit 0848f5
\texttt{mpich-%MPICH_VERSION%/examples} directory.  If the current directory is the top
Packit 0848f5
level MPICH build directory, then you can run this program with
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mpiexec -n 5 -f machinefile ./examples/cpi
Packit 0848f5
\end{verbatim}
Packit 0848f5
The \texttt{cpi} example will tell you which hosts it is running on.
Packit 0848f5
Packit 0848f5
There are many options for \texttt{mpiexec}, by which multiple
Packit 0848f5
executables can be run, hosts can be specified, separate command-line
Packit 0848f5
arguments and environment variables can be passed to different
Packit 0848f5
processes, and working directories and search paths for executables
Packit 0848f5
can be specified.  Do
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mpiexec --help
Packit 0848f5
\end{verbatim}
Packit 0848f5
for details. A typical example is:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mpiexec -f machinefile -n 1 ./master : -n 19 ./slave
Packit 0848f5
\end{verbatim}
Packit 0848f5
to ensure that the process with rank 0 runs on your workstation.
Packit 0848f5
Packit 0848f5
The arguments between `:'s in this syntax are called ``argument sets,''
Packit 0848f5
since they apply to a set of processes.  More argments are described in
Packit 0848f5
the \textit{User's Guide}.
Packit 0848f5
Packit 0848f5
\end{enumerate}
Packit 0848f5
Packit 0848f5
If you have completed all of the above steps, you have successfully
Packit 0848f5
installed MPICH and run an MPI example.  
Packit 0848f5
Packit 0848f5
%
Packit 0848f5
% DO NOT REMOVE THE FOLLOWING SECTION.  IF NECESSARY, UPDATE IT.
Packit 0848f5
\subsection{Selecting the Compilers}
Packit 0848f5
\label{sec:compilers}
Packit 0848f5
The MPICH configure step will attempt to find the C, C++, and Fortran
Packit 0848f5
compilers for you, but if you either want to override the default or
Packit 0848f5
need to specify a compiler that configure doesn't recognize, you can
Packit 0848f5
specify them on the command line using these variables
Packit 0848f5
\begin{description}
Packit 0848f5
\item[CC]The C compiler.  
Packit 0848f5
\item[CXX]The C++ compiler.  Use \texttt{--disable-cxx} if you do not
Packit 0848f5
  want to build the MPI C++ interface
Packit 0848f5
\item[F77]The Fortran 77 compiler (for the original MPI Fortran
Packit 0848f5
  bindings).  Use \texttt{--disable-f77} if you do not want to build
Packit 0848f5
  either the Fortran 77 or Fortran 90 MPI interfaces
Packit 0848f5
\item[FC]The Fortran 90 (or later) compiler.  Use
Packit 0848f5
  \texttt{--disable-fc} if you do not want to build the Fortran 90 MPI
Packit 0848f5
  interfaces.  Note that in previous versions of MPICH, the variable
Packit 0848f5
  name was \texttt{F90}.  As Fortran has had 3 major releases since
Packit 0848f5
  Fortran 90 (95, 2003, and 2008), most tools, including those built
Packit 0848f5
  with GNU autotools, have or are changing to use \texttt{FC} instead
Packit 0848f5
  of \texttt{F90}.
Packit 0848f5
\end{description}
Packit 0848f5
For example, to select the Intel compilers instead of the GNU
Packit 0848f5
compilers on a system with both, use
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    ./configure CC=icc CXX=icpc F77=ifort FC=ifort ...
Packit 0848f5
\end{verbatim}
Packit 0848f5
Note the use of the same Fortran compiler, \texttt{ifort}, for both
Packit 0848f5
Fortran 77 and Fortran 90; this is an increasingly common choice.
Packit 0848f5
Packit 0848f5
\subsection{Compiler Optimization Levels}
Packit 0848f5
Packit 0848f5
MPICH can be configured with two sets of compiler flags:
Packit 0848f5
\texttt{CFLAGS}, \texttt{CXXFLAGS}, \texttt{FFLAGS}, \texttt{FCFLAGS}
Packit 0848f5
(abbreviated as \texttt{xFLAGS}) and \texttt{MPICHLIB\_CFLAGS},
Packit 0848f5
\texttt{MPICHLIB\_CXXFLAGS}, \texttt{MPICHLIB\_FFLAGS},
Packit 0848f5
\texttt{MPICHLIB\_FCFLAGS} (abbreviated as \texttt{MPICHLIB\_xFLAGS})
Packit 0848f5
for compilation; \texttt{LDFLAGS} and \texttt{MPICHLIB\_LDFLAGS} for linking.
Packit 0848f5
All these flags can be set as part of configure command or 
Packit 0848f5
through environment variables.
Packit 0848f5
(\texttt{CPPFLAGS} stands for C preprocessor flags, which should NOT be set)
Packit 0848f5
Packit 0848f5
Both \texttt{xFLAGS} and \texttt{MPICHLIB\_xFLAGS} affect the compilation
Packit 0848f5
of the MPICH libraries. However, only \texttt{xFLAGS} is appended to 
Packit 0848f5
MPI wrapper scripts, \texttt{mpicc} and friends.
Packit 0848f5
Packit 0848f5
MPICH libraries are built with default compiler optimization, \texttt{-O2},
Packit 0848f5
which can be modified by \texttt{--enable-fast} configure option.  For instance,
Packit 0848f5
\texttt{--disable-fast} disables the default optimization option.
Packit 0848f5
\texttt{--enable-fast=O<n>} sets default compiler optimization as
Packit 0848f5
\texttt{-O<n>} (note that this assumes that the compiler accepts this
Packit 0848f5
format). 
Packit 0848f5
For more details of \texttt{--enable-fast}, see the output of
Packit 0848f5
\texttt{configure --help}. 
Packit 0848f5
Any other complicated optimization flags for MPICH libraries have
Packit 0848f5
to be set throught \texttt{MPICHLIB\_xFLAGS}.  \texttt{CFLAGS} and friends
Packit 0848f5
are empty by default.
Packit 0848f5
Packit 0848f5
For example, to build a production MPICH environment with \texttt{-O3} for all
Packit 0848f5
language bindings, one can simply do
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  ./configure --enable-fast=all,O3
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
or
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  ./configure --enable-fast=all MPICHLIB_CFLAGS=-O3 \
Packit 0848f5
                                MPICHLIB_FFLAGS=-O3 \
Packit 0848f5
                                MPICHLIB_CXXFLAGS=-O3 \
Packit 0848f5
                                MPICHLIB_FCFLAGS=-O3
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
This will cause the MPICH libraries to be built with \texttt{-O3},
Packit 0848f5
and \texttt{-O3} will
Packit 0848f5
not be included in the \texttt{mpicc} and other MPI wrapper script.
Packit 0848f5
Packit 0848f5
There are certain compiler flags that should not be used with MPICH's
Packit 0848f5
configure, e.g. gcc's \texttt{-Werror} which would confuse configure and cause
Packit 0848f5
certain configure tests to fail to detect the correct system features.
Packit 0848f5
To use \texttt{-Werror} in building MPICH libraries, you can pass the compiler
Packit 0848f5
flags during the make step through the Makefile variable,
Packit 0848f5
\texttt{MPICH\_MAKE\_CFLAGS} as follows:
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  make VERBOSE=1 MPICH_MAKE_CFLAGS="-Wall -Werror"
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
(assume CC is set to gcc).  The content of \texttt{MPICH\_MAKE\_CFLAGS}
Packit 0848f5
is appended to the \texttt{CFLAGS} in almost all Makefiles.
Packit 0848f5
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsection{Common Non-Default Configuration Options}
Packit 0848f5
\label{sec:non-default}
Packit 0848f5
Packit 0848f5
A brief discussion of some of the \texttt{configure} options is found in
Packit 0848f5
Section~\ref{configure-options}.  Here we comment on some of the most
Packit 0848f5
commonly used options.  
Packit 0848f5
% FIXME: This section needs much more work.
Packit 0848f5
Packit 0848f5
\subsubsection{The Most Important Configure Options}
Packit 0848f5
\label{sec:important-configure-options}
Packit 0848f5
\begin{description}
Packit 0848f5
\item[--prefix]Set the installation directories for MPICH.  
Packit 0848f5
\item[--enable-debuginfo]Provide access to the message queues for
Packit 0848f5
  debuggers such as Totalview.
Packit 0848f5
\item[--enable-g]Build MPICH with various debugging options.  This is
Packit 0848f5
  of interest primarily to MPICH developers.  The options
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  --enable-g=dbg,mem,log
Packit 0848f5
\end{verbatim}
Packit 0848f5
 are recommended in that case.
Packit 0848f5
\item[--enable-fast]Configure MPICH for fastest performance at the
Packit 0848f5
  expense of error reporting and other program development aids.  This
Packit 0848f5
  is recommended only for getting the best performance out of proven
Packit 0848f5
  production applications, and for benchmarking.
Packit 0848f5
\item[--enable-shared]Build MPICH with shared libraries. 
Packit 0848f5
  MPICH will try to automatically detect the type of shared library
Packit 0848f5
  support required. See Section~\ref{sec:shared-libraries} for more details.
Packit 0848f5
\item[--with-pm]Select the process manager.  The default is
Packit 0848f5
  \texttt{hydra}; also useful are \texttt{gforker} and \texttt{remshell}.  You can build with
Packit 0848f5
  all three process managers by specifying
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  --with-pm=hydra:gforker:remshell
Packit 0848f5
\end{verbatim}
Packit 0848f5
\item[--with-java]Set the location of Java installation.  This option
Packit 0848f5
is necessary only if the default Java installation in your PATH does
Packit 0848f5
not contain a valid Java installation for Jumpshot, e.g.
Packit 0848f5
\begin{verbatim}
Packit 0848f5
  --with-java=/opt/jdk1.6.0
Packit 0848f5
\end{verbatim}
Packit 0848f5
\end{description}
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsubsection{Using the Absoft Fortran compilers with MPICH}
Packit 0848f5
\label{sec:absoft}
Packit 0848f5
Packit 0848f5
For best results, it is important to force the Absoft Fortran compilers to 
Packit 0848f5
make all routine names monocase.  In addition, if lower case is chosen 
Packit 0848f5
(this will match common use by many programs), you must also tell the the 
Packit 0848f5
Absoft compiles to append an underscore to global names in order to access 
Packit 0848f5
routines such as \texttt{getarg} (\texttt{getarg} is not used by MPICH but is
Packit 0848f5
used in some 
Packit 0848f5
of the tests and is often used in application programs).  We recommend 
Packit 0848f5
configuring MPICH with the following options
Packit 0848f5
\begin{verbatim}
Packit 0848f5
Packit 0848f5
setenv F77 f77
Packit 0848f5
setenv FFLAGS "-f -N15"
Packit 0848f5
setenv FCFLAGS "-YALL_NAMES=LCS -YEXT_SFX=_"
Packit 0848f5
Packit 0848f5
./configure ....
Packit 0848f5
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsection{Shared Libraries}
Packit 0848f5
\label{sec:shared-libraries}
Packit 0848f5
Packit 0848f5
To have shared libraries created when MPICH is built, specify the
Packit 0848f5
following when MPICH is configured:
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    configure --enable-shared
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsection{What to Tell the Users}
Packit 0848f5
\label{sec:telling}
Packit 0848f5
Packit 0848f5
Now that MPICH has been installed, the users have to be informed of how
Packit 0848f5
to use it.  Part of this is covered in the \emph{User's Guide}.  Other
Packit 0848f5
things users need to know are covered here.
Packit 0848f5
Packit 0848f5
Packit 0848f5
\section{Migrating from MPICH1}
Packit 0848f5
\label{sec:migrating}
Packit 0848f5
Packit 0848f5
MPICH is an all-new rewrite of MPICH1.  Although the basic steps for
Packit 0848f5
installation have remained the same (\texttt{configure}, \texttt{make},
Packit 0848f5
\texttt{make install}), a number of things have changed.  In this
Packit 0848f5
section we attempt to point out what you may be used to in MPICH1 that
Packit 0848f5
are now different in MPICH.
Packit 0848f5
Packit 0848f5
\subsection{Configure Options}
Packit 0848f5
\label{sec:configure-options}
Packit 0848f5
Packit 0848f5
The arguments to \texttt{configure} are different in MPICH1 and MPICH;
Packit 0848f5
the \texttt{Installer's Guide} discusses \texttt{configure}.  In
Packit 0848f5
particular, the newer \texttt{configure} in MPICH does not support the
Packit 0848f5
\verb+-cc=<compiler-name>+ (or \texttt{-fc}, \texttt{-c++}, or
Packit 0848f5
\texttt{-f90}) options.  Instead, many of the items that could be
Packit 0848f5
specified in the command line to configure in MPICH1 must now be set by
Packit 0848f5
defining an environment variable.  E.g., while MPICH1 allowed
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    ./configure -cc=pgcc
Packit 0848f5
\end{verbatim}
Packit 0848f5
MPICH requires
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    ./configure CC=pgcc
Packit 0848f5
\end{verbatim}
Packit 0848f5
Basically, every
Packit 0848f5
option to the MPICH-1 configure that does not start with
Packit 0848f5
\texttt{--enable} or \texttt{--with} is not available as a configure
Packit 0848f5
option in MPICH.  Instead, environment variables must be used.  This is
Packit 0848f5
consistent (and required) for use of version 2 GNU \texttt{autoconf}.
Packit 0848f5
Packit 0848f5
\subsection{Other Differences}
Packit 0848f5
Other differences between MPICH1 and MPICH include the handling of
Packit 0848f5
process managers and the choice of communication device.
Packit 0848f5
Packit 0848f5
For example, the new process managers have a new format and slightly
Packit 0848f5
different semantics for the \texttt{-machinefile} option.  Assume that
Packit 0848f5
you type this data into a file named \texttt{machfile}:
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    bp400:2
Packit 0848f5
    bp401:2
Packit 0848f5
    bp402:2
Packit 0848f5
    bp403:2
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
If you then run a parallel job with this machinefile, you would expect
Packit 0848f5
ranks 0 and 1 to run on bp400 because it says to run 2 processes there
Packit 0848f5
before going on to bp401.  Ranks 2 and 3 would run on bp401, and rank
Packit 0848f5
4 on bp402, e.g.:
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    mpiexec -l -machinefile machfile -n 5 hostname
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
produces:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    0: bp400
Packit 0848f5
    1: bp400
Packit 0848f5
    2: bp401
Packit 0848f5
    3: bp401
Packit 0848f5
    4: bp402
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
\section{Choosing the Communication Device}
Packit 0848f5
\label{sec:choose-device}
Packit 0848f5
Packit 0848f5
MPICH is designed to be build with many different communication devices,
Packit 0848f5
allowing an implementation to be tuned for different communication fabrics.  A
Packit 0848f5
simple communication device, known as ``ch3'' (for the third version of the
Packit 0848f5
``channel'' interface) is provided with MPICH and is the default choice.
Packit 0848f5
Packit 0848f5
The ch3 device itself supports a variety of communication methods.  These are
Packit 0848f5
specified by providing the name of the method after a colon in the
Packit 0848f5
\texttt{--with-device} configure option.  For example,
Packit 0848f5
\texttt{--with-device=ch3:sock} selects the (older) socket-base communication
Packit 0848f5
method.
Packit 0848f5
Methods supported by the MPICH group include:
Packit 0848f5
Packit 0848f5
\begin{description}
Packit 0848f5
\item[ch3:nemesis]This method is our new, high performance method. It
Packit 0848f5
  has been made the default communication channel starting the 1.1
Packit 0848f5
  release of MPICH.  It uses shared-memory to send messages between
Packit 0848f5
  processes on the same node and the network for processes between
Packit 0848f5
  nodes.  Currently sockets and Myrinet-MX are supported networks.  It
Packit 0848f5
  supports \texttt{MPI\_THREAD\_MULTIPLE} and other levels of thread
Packit 0848f5
  safety.
Packit 0848f5
\item[ch3:sock]This method uses sockets for all communications between
Packit 0848f5
  processes. It supports \texttt{MPI\_THREAD\_MULTIPLE} and other
Packit 0848f5
  levels of thread safety.
Packit 0848f5
\end{description}
Packit 0848f5
Packit 0848f5
Most installations should use the default \texttt{ch3:nemesis} method
Packit 0848f5
for best performance. For platforms that are not supported by nemesis,
Packit 0848f5
the \texttt{ch3:sock} method is suggested.
Packit 0848f5
Packit 0848f5
MPICH is designed to efficiently support all types of systems.  The
Packit 0848f5
\texttt{ch3:nemesis} device is the primary focus of the MPICH group,
Packit 0848f5
but other research groups and computer vendors can and have developed
Packit 0848f5
both their own ch3 ``channels'' as well as complete communication
Packit 0848f5
``devices'' in place of ch3.
Packit 0848f5
Packit 0848f5
Packit 0848f5
%
Packit 0848f5
% Add any configure options that are specific to each method here.  Also
Packit 0848f5
% any environment variables that might apply (e.g., MPICH_INTERFACE_HOSTNAME 
Packit 0848f5
% or MPICH_PORT_RANGE.
Packit 0848f5
%
Packit 0848f5
%\subsection{Special Features of Each Communication Device}
Packit 0848f5
%\subsubsection{ch3:nemesis}
Packit 0848f5
Packit 0848f5
\section{Installing and Managing Process Managers}
Packit 0848f5
\label{sec:process-managers}
Packit 0848f5
MPICH has been designed to work with multiple process managers; that
Packit 0848f5
is, although you can start MPICH jobs with \texttt{mpiexec}, there are
Packit 0848f5
different mechanisms by which your processes are started.  An interface
Packit 0848f5
(called PMI) isolates the MPICH library code from the process manager.
Packit 0848f5
Currently three process managers are distributed with MPICH
Packit 0848f5
\begin{description}
Packit 0848f5
\item[hydra] This is the default process manager tha natively uses the
Packit 0848f5
existing daemons on the system such as ssh, slurm, pbs.
Packit 0848f5
\item[gforker] This is a simple process manager that creates all
Packit 0848f5
  processes on a single machine.  It is useful both for debugging and
Packit 0848f5
  for running on shared memory multiprocessors.
Packit 0848f5
\end{description}
Packit 0848f5
Packit 0848f5
\subsection{hydra} \label{sec:hydra} \texttt{hydra} is the default
Packit 0848f5
process manager that launches processes using the native daemons
Packit 0848f5
present on the system such as ssh, slurm, pbs, etc. To configure with
Packit 0848f5
the \texttt{hydra} process manager, use
Packit 0848f5
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    configure --with-pm=hydra ...
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
Packit 0848f5
\subsection{gforker}
Packit 0848f5
\label{sec:forker}
Packit 0848f5
\texttt{gforker} is a simple process manager that runs all processes on
Packit 0848f5
a single node; it's version of \texttt{mpiexec} uses the system
Packit 0848f5
\texttt{fork} and \texttt{exec} calls to create the new processes.
Packit 0848f5
To configure with the \texttt{gforker} process manager, use
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    configure --with-pm=gforker ...
Packit 0848f5
\end{verbatim}
Packit 0848f5
Packit 0848f5
\section{Testing}
Packit 0848f5
\label{sec:testing}
Packit 0848f5
Once MPICH has been installed, you can test it by running some of the example
Packit 0848f5
programs in the \texttt{examples} directory.  A more thorough test can be run
Packit 0848f5
with the command \texttt{make testing}.  This will produce a summary on
Packit 0848f5
standard output, along with an XML version of the test results in 
Packit 0848f5
\texttt{mpich/test/mpi}. In addition, running \texttt{make testing} from the
Packit 0848f5
top-level (\texttt{mpich}) directory will run tests of the commands, such as
Packit 0848f5
\texttt{mpicc} and \texttt{mpiexec}, that are included with MPICH.
Packit 0848f5
Packit 0848f5
Other MPI test suites are available from
Packit 0848f5
\url{http://www.mcs.anl.gov/mpi/mpi-test/tsuite.html}.  As part of the MPICH
Packit 0848f5
development, we run the MPICH1, MPICH, C++, and Intel test suites every night
Packit 0848f5
and post the results on
Packit 0848f5
\url{http://www.mpich.org/static/cron/tests/}.
Packit 0848f5
Other tests are run on an occasional basis.  
Packit 0848f5
Packit 0848f5
% \subsection{Using the Intel Test Suite}
Packit 0848f5
% \label{sec:intel}
Packit 0848f5
Packit 0848f5
% These instructions are local to our test environment at Argonne.
Packit 0848f5
Packit 0848f5
% How to run a select set of tests from the Intel test suite:
Packit 0848f5
Packit 0848f5
% \begin{small}
Packit 0848f5
% \begin{verbatim}
Packit 0848f5
% 1) checkout the Intel test suite (svn co https://svn.mcs.anl.gov/repos/mpi/test_suites/intel/trunk IntelMPITEST) (outside users
Packit 0848f5
%    can access the most recent version of the test suite from the
Packit 0848f5
%    test suite web page).
Packit 0848f5
Packit 0848f5
% 2) create a testing directory separate from the IntelMPITEST source
Packit 0848f5
% directory
Packit 0848f5
Packit 0848f5
% 3) cd into that testing directory
Packit 0848f5
Packit 0848f5
% 4) run "<ITS_SRC_DIR>/configure --with-mpich=<MPICH_INSTALL_DIR>", where
Packit 0848f5
% <ITS_SRC_DIR> is the path to the directory Intel test suite source (e.g.,
Packit 0848f5
% /home/toonen/Projects/MPI-Tests/IntelMPITEST) and <MPICH_INSTALL_DIR> is
Packit 0848f5
% the directory containing your MPICH installation
Packit 0848f5
Packit 0848f5
% 5) mkdir Test; cd Test
Packit 0848f5
Packit 0848f5
% 6) find tests in <ITS_SRC_DIR>/{c,fortran} that you are interested in
Packit 0848f5
% running and place the test names in a file.  For example:
Packit 0848f5
Packit 0848f5
% % ( cd /home/toonen/Projects/MPI-Tests/IntelMPITEST/Test ; \
Packit 0848f5
%     find {c,fortran} -name 'node.*' -print | grep 'MPI_Test' 
Packit 0848f5
%     | sed -e 's-/node\..*$--' ) |& tee testlist
Packit 0848f5
% Test/c/nonblocking/functional/MPI_Test
Packit 0848f5
% Test/c/nonblocking/functional/MPI_Testall
Packit 0848f5
% Test/c/nonblocking/functional/MPI_Testany
Packit 0848f5
% Test/c/nonblocking/functional/MPI_Testsome
Packit 0848f5
% Test/c/persist_request/functional/MPI_Test_p
Packit 0848f5
% Test/c/persist_request/functional/MPI_Testall_p
Packit 0848f5
% Test/c/persist_request/functional/MPI_Testany_p
Packit 0848f5
% Test/c/persist_request/functional/MPI_Testsome_p
Packit 0848f5
% Test/c/probe_cancel/functional/MPI_Test_cancelled_false
Packit 0848f5
% Test/fortran/nonblocking/functional/MPI_Test
Packit 0848f5
% Test/fortran/nonblocking/functional/MPI_Testall
Packit 0848f5
% Test/fortran/nonblocking/functional/MPI_Testany
Packit 0848f5
% Test/fortran/nonblocking/functional/MPI_Testsome
Packit 0848f5
% Test/fortran/persist_request/functional/MPI_Test_p
Packit 0848f5
% Test/fortran/persist_request/functional/MPI_Testall_p
Packit 0848f5
% Test/fortran/persist_request/functional/MPI_Testany_p
Packit 0848f5
% Test/fortran/persist_request/functional/MPI_Testsome_p
Packit 0848f5
% Test/fortran/probe_cancel/functional/MPI_Test_cancelled_false
Packit 0848f5
% %
Packit 0848f5
Packit 0848f5
% 7) run the tests using ../bin/mtest:
Packit 0848f5
Packit 0848f5
% % ../bin/mtest -testlist testlist -np 6 |& tee mtest.log
Packit 0848f5
% %
Packit 0848f5
Packit 0848f5
% NOTE: some programs hang if less they are run with less than 6 processes.
Packit 0848f5
Packit 0848f5
% 8) examine the summary.xml file.  look for '<STATUS>fail</STATUS>' to see if
Packit 0848f5
% any failures occurred.  (search for '>fail<' works as well)
Packit 0848f5
Packit 0848f5
% \end{verbatim}
Packit 0848f5
% \end{small}
Packit 0848f5
Packit 0848f5
\section{Benchmarking}
Packit 0848f5
\label{sec:benchmarking}
Packit 0848f5
Packit 0848f5
There are many benchmarking programs for MPI implementations.  Three
Packit 0848f5
that we use are \texttt{mpptest}
Packit 0848f5
(\url{http://www.mcs.anl.gov/mpi/mpptest}), \texttt{netpipe}
Packit 0848f5
(\url{http://www.scl.ameslab.gov/netpipe}), and \texttt{SkaMPI}
Packit 0848f5
(\url{http://liinwww.ira.uka.de/~skampi}).  Each of these has
Packit 0848f5
different strengths and weaknesses and reveals different properties of
Packit 0848f5
the MPI implementation.
Packit 0848f5
Packit 0848f5
In addition, the
Packit 0848f5
MPICH test suite contains a few programs to test for performance artifacts in
Packit 0848f5
the directory \texttt{test/mpi/perf}.  An example of a performance artifact is
Packit 0848f5
markedly different performance for the same operation when performed in two
Packit 0848f5
different ways.  For example, using an MPI datatype for a non-contiguous
Packit 0848f5
transfer should not be much slower than packing the data into a contiguous
Packit 0848f5
buffer, sending it as a contiguous buffer, and then unpacking it into the
Packit 0848f5
destination buffer.  An example of this from the MPI-1 standard illustrates
Packit 0848f5
the use of MPI datatypes to transpose a matrix ``on the fly,'' and one test in
Packit 0848f5
\texttt{test/mpi/perf} checks that the MPI implementation performs well in
Packit 0848f5
this case.
Packit 0848f5
Packit 0848f5
\section{All Configure Options}
Packit 0848f5
\label{configure-options}
Packit 0848f5
Packit 0848f5
To get the latest list of all the configure options recognized by the
Packit 0848f5
top-level configure, use:
Packit 0848f5
\begin{verbatim}
Packit 0848f5
    configure --help
Packit 0848f5
\end{verbatim}
Packit 0848f5
Not all of these options may be fully supported yet.  
Packit 0848f5
Packit 0848f5
% Fixme:  Explain some of them, at least the ones that we ask the
Packit 0848f5
% users to try.
Packit 0848f5
Packit 0848f5
\paragraph{Notes on the configure options.}
Packit 0848f5
The \texttt{--with-htmldir} and \texttt{--with-docdir} options specify the 
Packit 0848f5
directories into which the documentation will be installed by \texttt{make
Packit 0848f5
  install}. 
Packit 0848f5
Packit 0848f5
\appendix
Packit 0848f5
Packit 0848f5
\end{document}
Packit 0848f5
Packit 0848f5
%
Packit 0848f5
% Comments on subclassing the document
Packit 0848f5
% We can use \ifdevname ... \fi and \ifpmname ... \fi, as in
Packit 0848f5
% \ifdevchiii .. \fi and \ifpmmpd ... \fi
Packit 0848f5
% (these will still need to be defined)
Packit 0848f5
% There should also be a way to select ``all'' in such a way that the
Packit 0848f5
% document can still flow well, such as
Packit 0848f5
% \ifdevall ... \else \ifdevchiii \else \ifdevmm \fi \fi \fi