root/mpich2/branches/dev/kumudb/doc/logging/logging.tex @ 4870

Revision 4870, 6.6 KB (checked in by kumudb, 5 months ago)

Merge from trunk to kumudb r4748:r4869

Line 
1\documentclass[dvipdfm,11pt]{article}
2\usepackage[dvipdfm]{hyperref} % Upgraded url package
3\parskip=.1in
4
5\begin{document}
6\markright{MPICH2 Logging}
7\title{MPICH2 Logging\\
8Version 0.1\\
9DRAFT of \today\\
10Mathematics and Computer Science Division\\
11Argonne National Laboratory}
12
13\author{David Ashton}
14
15
16\maketitle
17
18\cleardoublepage
19
20\pagenumbering{arabic}
21\pagestyle{headings}
22
23
24\section{Introduction}
25\label{sec:introduction}
26
27This manual assumes that MPICH2 has already been installed.  For
28instructions on how to install MPICH2, see the MPICH2 Installer's Guide,
29or the README in the top-level MPICH2 directory.  This manual will
30explain how the internal logging macros are generated and how the user
31can generate log files viewable in Jumpshot.  Use of Jumpshot is
32described in the mpe documentation.
33
34
35\section{Configuring mpich2 to create log files}
36\label{sec:configuring}
37
38When users run configure they can specify logging options.  There are three
39configure options to control logging.
40
41\begin{description}
42\item[\texttt{--enable-timing=<timing\_type>}]\mbox{}\\
43Add this option to enable timing.  The two options for timing\_type are
44\texttt{log} and \texttt{log\_detailed}.  The \texttt{log} option will log
45only the MPI functions just like the MPE logging interface does.  The
46\texttt{log\_detailed} will log every function in mpich2.  This option gives
47fine grained logging information and also creates large log files.  It must
48be used in conjunction with a timer-type that can log very short intervals
49on the order of 100's of nanoseconds.
50
51\item[\texttt{--with-logging=<logger>}]\mbox{}\\
52Specify the logging library to use.  Currently the only logger option is \texttt{rlog}.
53
54\item[\texttt{--enable-timer-type=<timer\_type>}]\mbox{}\\
55Specify the timer type.  The options are
56\begin{itemize}
57\item \texttt{gethrtime} -
58Solaris timer (Solaris systems only)
59\item \texttt{clock\_gettime} -
60Posix timer (where available)
61\item \texttt{gettimeofday} -
62Most Unix systems
63\item \texttt{linux86\_cycle} -
64Linux x86 cycle counter*
65\item \texttt{linuxalpha\_cycle} -
66Like linux86\_cycle, but for Linux Alpha*
67\item \texttt{gcc\_ia64\_cycle} -
68IA64 cycle counter*
69\end{itemize}
70* Note that CPU cycle counters count cycles, not elapsed time.
71Because processor frequencies are variable, especially with modern
72power-aware hardware, these are not always reliable for timing and so
73should only be used if you're sure you know what you're doing.
74
75\end{description}
76
77Here is an example:
78\begin{verbatim}
79mpich2/configure
80    --enable-timing=log
81    --with-logging=rlog
82    --enable-timer-type=gettimeofday
83    ...
84\end{verbatim}
85
86\section{Generating log files}
87\label{sec:genlogs}
88Run your mpi application to create intermediate \texttt{.irlog} files.
89
90\begin{verbatim}
91mpicc myapp.c -o myapp
92mpiexec -n 3 myapp
93\end{verbatim}
94There will be .irlog files created for each process:
95\begin{verbatim}
96log0.irlog
97log1.irlog
98log2.irlog
99\end{verbatim}
100
101\section{RLOG tools}
102\label{sec:tools}
103For performance reasons each process produces a local intermediate log file
104that needs to be merged into a single rlog file.  Use the rlog tools to merge
105the \texttt{.irlog} files into an \texttt{.rlog} file.  The rlog tools are
106found in \texttt{mpich2\_build/src/util/logging/rlog}. Currently they are not
107copied to the install directory.
108
109\begin{description}
110\item[\texttt{irlog2rlog}]\mbox{}\\
111This tool combines the intermediate \texttt{.irlog} files into a single
112\texttt{.rlog} file. The usage is: ``\texttt{irlog2rlog outname.rlog
113input0.irlog input1.irlog ...}'' A shortcut is provided: ``\texttt{irlog2rlog
114outname.rlog <num\_files>}''.  Execute \texttt{irlog2rlog} without any
115parameters to see the usage options.
116
117\item[\texttt{printrlog}]\mbox{}\\
118This tool prints the contents of an \texttt{.rlog} file.
119
120\item[\texttt{printirlog}]\mbox{}\\
121This tool prints the contents of an \texttt{.irlog} file.
122\end{description}
123
124Continuing the example from the previous section:
125\begin{verbatim}
126irlog2rlog myapp.rlog 3
127\end{verbatim}
128will convert \texttt{log0.irlog}, \texttt{log1.irlog} and \texttt{log2.irlog} 
129to \texttt{myapp.rlog}.
130
131\section{Viewing log files}
132This section describes how to view a log file
133
134\texttt{.rlog} files can be printed from a command shell using the
135\texttt{printrlog} tool but the more interesting way to view the log files
136is from Jumpshot.  Jumpshot displays slog2 files and has a built in converter
137to convert \texttt{.rlog} files to \texttt{.slog2} files.  Start Jumpshot and
138open your \texttt{.rlog} file.  Jumpshot will ask you if you want to convert
139the file and you say yes.
140
141\section{Logging state code generation}
142\label{sec:genstates}
143
144This section can be skipped by users.  It describes the internal scripts used
145to develop the logging macros.
146
147This is how the \texttt{maint/genstates} script works:
148
149\begin{enumerate}
150\item \texttt{maint/updatefiles} creates \texttt{genstates} from
151\texttt{genstates.in} replacing \texttt{@PERL@} with the appropriate path to
152perl and then runs \texttt{genstates}.
153
154\item \texttt{genstates} finds all \texttt{.i}, \texttt{.h} and \texttt{.c} files
155in the mpich2 directory tree, searches for \texttt{\_STATE\_DECL} in each
156file and builds a list of all the MPID\_STATEs.  It validates that the states
157start in a \texttt{\_STATE\_DECL} statement, followed by a \texttt{FUNC\_ENTER}
158statement, and then at least one \texttt{FUNC\_EXIT} statement.  Errors are printed
159out if the code does not follow this format except for macros.  State declarations
160in macros are assumed to be correct.
161
162\item \texttt{genstates} finds all the \texttt{describe\_states.txt} 
163files anywhere in the mpich2 tree.  \texttt{describe\_states.txt} files are
164optional and are used to set the output name of the state and its associated
165color.
166
167\item The \texttt{describe\_states.txt} file format is this:
168\begin{verbatim}
169MPID_STATE_XXX <user string for the state> <optional rgb color>
170\end{verbatim}
171 Here is an example line:
172\begin{verbatim}
173 MPID_STATE_MPI_SEND MPI_Send 0 0 255
174\end{verbatim}
175If you don't specify a state in a \texttt{describe\_states.txt} file then
176the state user name will be automatically created by stripping off the
177\texttt{MPID\_STATE\_} prefix and the color will be assigned a random value.
178
179\item \texttt{genstates} ouputs \texttt{mpich2/src/include/mpiallstates.h} 
180with this \texttt{enum} in it:
181\begin{verbatim}
182enum MPID_TIMER_STATE
183{
184    MPID_STATE_XXX,
185    ...
186};
187\end{verbatim}
188
189\item \texttt{genstates} outputs
190\texttt{mpich2/src/util/logging/describe\_states.c} with the
191\texttt{MPIR\_Describe\_timer\_states()} function in it.  Currently, only
192the rlog version of \texttt{MPIR\_Describe\_timer\_states()} is generated.
193
194\end{enumerate}
195
196\end{document}
Note: See TracBrowser for help on using the browser.