Blame doc/logging/logging.tex

Packit Service c5cf8c
\documentclass[dvipdfm,11pt]{article}
Packit Service c5cf8c
\usepackage[dvipdfm]{hyperref} % Upgraded url package
Packit Service c5cf8c
\parskip=.1in
Packit Service c5cf8c
Packit Service c5cf8c
\begin{document}
Packit Service c5cf8c
\markright{MPICH Logging}
Packit Service c5cf8c
\title{MPICH Logging\\
Packit Service c5cf8c
Version 0.1\\
Packit Service c5cf8c
DRAFT of \today\\
Packit Service c5cf8c
Mathematics and Computer Science Division\\
Packit Service c5cf8c
Argonne National Laboratory}
Packit Service c5cf8c
Packit Service c5cf8c
\author{David Ashton}
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
\maketitle
Packit Service c5cf8c
Packit Service c5cf8c
\cleardoublepage
Packit Service c5cf8c
Packit Service c5cf8c
\pagenumbering{arabic}
Packit Service c5cf8c
\pagestyle{headings}
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
\section{Introduction}
Packit Service c5cf8c
\label{sec:introduction}
Packit Service c5cf8c
Packit Service c5cf8c
This manual assumes that MPICH has already been installed.  For
Packit Service c5cf8c
instructions on how to install MPICH, see the MPICH Installer's Guide,
Packit Service c5cf8c
or the README in the top-level MPICH directory.  This manual will
Packit Service c5cf8c
explain how the internal logging macros are generated and how the user
Packit Service c5cf8c
can generate log files viewable in Jumpshot.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
\section{Configuring mpich to create log files}
Packit Service c5cf8c
\label{sec:configuring}
Packit Service c5cf8c
Packit Service c5cf8c
When users run configure they can specify logging options.  There are three 
Packit Service c5cf8c
configure options to control logging.
Packit Service c5cf8c
Packit Service c5cf8c
\begin{description}
Packit Service c5cf8c
\item[\texttt{--enable-timing=<timing\_type>}]\mbox{}\\
Packit Service c5cf8c
Add this option to enable timing.  The two options for timing\_type are 
Packit Service c5cf8c
\texttt{log} and \texttt{log\_detailed}.  The \texttt{log} option will log 
Packit Service c5cf8c
only the MPI functions.  The 
Packit Service c5cf8c
\texttt{log\_detailed} will log every function in mpich.  This option gives 
Packit Service c5cf8c
fine grained logging information and also creates large log files.  It must 
Packit Service c5cf8c
be used in conjunction with a timer-type that can log very short intervals 
Packit Service c5cf8c
on the order of 100's of nanoseconds.
Packit Service c5cf8c
Packit Service c5cf8c
\item[\texttt{--with-logging=<logger>}]\mbox{}\\
Packit Service c5cf8c
Specify the logging library to use.  Currently the only logger option is \texttt{rlog}.
Packit Service c5cf8c
Packit Service c5cf8c
\item[\texttt{--enable-timer-type=<timer\_type>}]\mbox{}\\
Packit Service c5cf8c
Specify the timer type.  The options are
Packit Service c5cf8c
\begin{itemize}
Packit Service c5cf8c
\item \texttt{gethrtime} -
Packit Service c5cf8c
Solaris timer (Solaris systems only)
Packit Service c5cf8c
\item \texttt{clock\_gettime} -
Packit Service c5cf8c
Posix timer (where available)
Packit Service c5cf8c
\item \texttt{gettimeofday} -
Packit Service c5cf8c
Most Unix systems
Packit Service c5cf8c
\item \texttt{linux86\_cycle} -
Packit Service c5cf8c
Linux x86 cycle counter*
Packit Service c5cf8c
\item \texttt{linuxalpha\_cycle} -
Packit Service c5cf8c
Like linux86\_cycle, but for Linux Alpha*
Packit Service c5cf8c
\item \texttt{gcc\_ia64\_cycle} -
Packit Service c5cf8c
IA64 cycle counter*
Packit Service c5cf8c
\end{itemize}
Packit Service c5cf8c
* Note that CPU cycle counters count cycles, not elapsed time.
Packit Service c5cf8c
Because processor frequencies are variable, especially with modern
Packit Service c5cf8c
power-aware hardware, these are not always reliable for timing and so
Packit Service c5cf8c
should only be used if you're sure you know what you're doing.
Packit Service c5cf8c
Packit Service c5cf8c
\end{description}
Packit Service c5cf8c
Packit Service c5cf8c
Here is an example:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
mpich/configure
Packit Service c5cf8c
    --enable-timing=log
Packit Service c5cf8c
    --with-logging=rlog
Packit Service c5cf8c
    --enable-timer-type=gettimeofday
Packit Service c5cf8c
    ...
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
Packit Service c5cf8c
\section{Generating log files}
Packit Service c5cf8c
\label{sec:genlogs}
Packit Service c5cf8c
Run your mpi application to create intermediate \texttt{.irlog} files.
Packit Service c5cf8c
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
mpicc myapp.c -o myapp
Packit Service c5cf8c
mpiexec -n 3 myapp
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
There will be .irlog files created for each process:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
log0.irlog
Packit Service c5cf8c
log1.irlog
Packit Service c5cf8c
log2.irlog
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
Packit Service c5cf8c
\section{RLOG tools}
Packit Service c5cf8c
\label{sec:tools}
Packit Service c5cf8c
For performance reasons each process produces a local intermediate log file 
Packit Service c5cf8c
that needs to be merged into a single rlog file.  Use the rlog tools to merge 
Packit Service c5cf8c
the \texttt{.irlog} files into an \texttt{.rlog} file.  The rlog tools are 
Packit Service c5cf8c
found in \texttt{mpich\_build/src/util/logging/rlog}. Currently they are not 
Packit Service c5cf8c
copied to the install directory.
Packit Service c5cf8c
Packit Service c5cf8c
\begin{description}
Packit Service c5cf8c
\item[\texttt{irlog2rlog}]\mbox{}\\
Packit Service c5cf8c
This tool combines the intermediate \texttt{.irlog} files into a single 
Packit Service c5cf8c
\texttt{.rlog} file. The usage is: ``\texttt{irlog2rlog outname.rlog 
Packit Service c5cf8c
input0.irlog input1.irlog ...}'' A shortcut is provided: ``\texttt{irlog2rlog 
Packit Service c5cf8c
outname.rlog <num\_files>}''.  Execute \texttt{irlog2rlog} without any 
Packit Service c5cf8c
parameters to see the usage options.
Packit Service c5cf8c
Packit Service c5cf8c
\item[\texttt{printrlog}]\mbox{}\\
Packit Service c5cf8c
This tool prints the contents of an \texttt{.rlog} file.
Packit Service c5cf8c
Packit Service c5cf8c
\item[\texttt{printirlog}]\mbox{}\\
Packit Service c5cf8c
This tool prints the contents of an \texttt{.irlog} file.
Packit Service c5cf8c
\end{description}
Packit Service c5cf8c
Packit Service c5cf8c
Continuing the example from the previous section:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
irlog2rlog myapp.rlog 3
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
will convert \texttt{log0.irlog}, \texttt{log1.irlog} and \texttt{log2.irlog} 
Packit Service c5cf8c
to \texttt{myapp.rlog}.
Packit Service c5cf8c
Packit Service c5cf8c
\section{Viewing log files}
Packit Service c5cf8c
This section describes how to view a log file
Packit Service c5cf8c
Packit Service c5cf8c
\texttt{.rlog} files can be printed from a command shell using the 
Packit Service c5cf8c
\texttt{printrlog} tool but the more interesting way to view the log files 
Packit Service c5cf8c
is from Jumpshot.  Jumpshot displays slog2 files and has a built in converter 
Packit Service c5cf8c
to convert \texttt{.rlog} files to \texttt{.slog2} files.  Start Jumpshot and 
Packit Service c5cf8c
open your \texttt{.rlog} file.  Jumpshot will ask you if you want to convert
Packit Service c5cf8c
the file and you say yes.
Packit Service c5cf8c
Packit Service c5cf8c
\section{Logging state code generation}
Packit Service c5cf8c
\label{sec:genstates}
Packit Service c5cf8c
Packit Service c5cf8c
This section can be skipped by users.  It describes the internal scripts used
Packit Service c5cf8c
to develop the logging macros.
Packit Service c5cf8c
Packit Service c5cf8c
This is how the \texttt{maint/genstates} script works:
Packit Service c5cf8c
Packit Service c5cf8c
\begin{enumerate}
Packit Service c5cf8c
\item \texttt{autogen.sh} creates \texttt{genstates} from 
Packit Service c5cf8c
\texttt{genstates.in} replacing \texttt{@PERL@} with the appropriate path to
Packit Service c5cf8c
perl and then runs \texttt{genstates}.
Packit Service c5cf8c
Packit Service c5cf8c
\item \texttt{genstates} finds all \texttt{.i}, \texttt{.h} and \texttt{.c} files 
Packit Service c5cf8c
in the mpich directory tree, searches for \texttt{\_STATE\_DECL} in each 
Packit Service c5cf8c
file and builds a list of all the MPID\_STATEs.  It validates that the states
Packit Service c5cf8c
start in a \texttt{\_STATE\_DECL} statement, followed by a \texttt{FUNC\_ENTER}
Packit Service c5cf8c
statement, and then at least one \texttt{FUNC\_EXIT} statement.  Errors are printed
Packit Service c5cf8c
out if the code does not follow this format except for macros.  State declarations
Packit Service c5cf8c
in macros are assumed to be correct.
Packit Service c5cf8c
Packit Service c5cf8c
\item \texttt{genstates} finds all the \texttt{describe\_states.txt} 
Packit Service c5cf8c
files anywhere in the mpich tree.  \texttt{describe\_states.txt} files are 
Packit Service c5cf8c
optional and are used to set the output name of the state and its associated 
Packit Service c5cf8c
color.
Packit Service c5cf8c
Packit Service c5cf8c
\item The \texttt{describe\_states.txt} file format is this:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
MPID_STATE_XXX <user string for the state> <optional rgb color>
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
 Here is an example line:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
 MPID_STATE_MPI_SEND MPI_Send 0 0 255
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
If you don't specify a state in a \texttt{describe\_states.txt} file then
Packit Service c5cf8c
the state user name will be automatically created by stripping off the 
Packit Service c5cf8c
\texttt{MPID\_STATE\_} prefix and the color will be assigned a random value.
Packit Service c5cf8c
Packit Service c5cf8c
\item \texttt{genstates} ouputs \texttt{mpich/src/include/mpiallstates.h} 
Packit Service c5cf8c
with this \texttt{enum} in it:
Packit Service c5cf8c
\begin{verbatim}
Packit Service c5cf8c
enum MPID_TIMER_STATE
Packit Service c5cf8c
{
Packit Service c5cf8c
    MPID_STATE_XXX,
Packit Service c5cf8c
    ...
Packit Service c5cf8c
};
Packit Service c5cf8c
\end{verbatim}
Packit Service c5cf8c
Packit Service c5cf8c
\item \texttt{genstates} outputs 
Packit Service c5cf8c
\texttt{mpich/src/util/logging/describe\_states.c} with the
Packit Service c5cf8c
\texttt{MPIR\_Describe\_timer\_states()} function in it.  Currently, only 
Packit Service c5cf8c
the rlog version of \texttt{MPIR\_Describe\_timer\_states()} is generated.
Packit Service c5cf8c
Packit Service c5cf8c
\end{enumerate}
Packit Service c5cf8c
Packit Service c5cf8c
\end{document}