| 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\\ |
|---|
| 8 | Version 0.1\\ |
|---|
| 9 | DRAFT of \today\\ |
|---|
| 10 | Mathematics and Computer Science Division\\ |
|---|
| 11 | Argonne 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 | |
|---|
| 27 | This manual assumes that MPICH2 has already been installed. For |
|---|
| 28 | instructions on how to install MPICH2, see the MPICH2 Installer's Guide, |
|---|
| 29 | or the README in the top-level MPICH2 directory. This manual will |
|---|
| 30 | explain how the internal logging macros are generated and how the user |
|---|
| 31 | can generate log files viewable in Jumpshot. Use of Jumpshot is |
|---|
| 32 | described in the mpe documentation. |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | \section{Configuring mpich2 to create log files} |
|---|
| 36 | \label{sec:configuring} |
|---|
| 37 | |
|---|
| 38 | When users run configure they can specify logging options. There are three |
|---|
| 39 | configure options to control logging. |
|---|
| 40 | |
|---|
| 41 | \begin{description} |
|---|
| 42 | \item[\texttt{--enable-timing=<timing\_type>}]\mbox{}\\ |
|---|
| 43 | Add 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 |
|---|
| 45 | only the MPI functions just like the MPE logging interface does. The |
|---|
| 46 | \texttt{log\_detailed} will log every function in mpich2. This option gives |
|---|
| 47 | fine grained logging information and also creates large log files. It must |
|---|
| 48 | be used in conjunction with a timer-type that can log very short intervals |
|---|
| 49 | on the order of 100's of nanoseconds. |
|---|
| 50 | |
|---|
| 51 | \item[\texttt{--with-logging=<logger>}]\mbox{}\\ |
|---|
| 52 | Specify the logging library to use. Currently the only logger option is \texttt{rlog}. |
|---|
| 53 | |
|---|
| 54 | \item[\texttt{--enable-timer-type=<timer\_type>}]\mbox{}\\ |
|---|
| 55 | Specify the timer type. The options are |
|---|
| 56 | \begin{itemize} |
|---|
| 57 | \item \texttt{gethrtime} - |
|---|
| 58 | Solaris timer (Solaris systems only) |
|---|
| 59 | \item \texttt{clock\_gettime} - |
|---|
| 60 | Posix timer (where available) |
|---|
| 61 | \item \texttt{gettimeofday} - |
|---|
| 62 | Most Unix systems |
|---|
| 63 | \item \texttt{linux86\_cycle} - |
|---|
| 64 | Linux x86 cycle counter* |
|---|
| 65 | \item \texttt{linuxalpha\_cycle} - |
|---|
| 66 | Like linux86\_cycle, but for Linux Alpha* |
|---|
| 67 | \item \texttt{gcc\_ia64\_cycle} - |
|---|
| 68 | IA64 cycle counter* |
|---|
| 69 | \end{itemize} |
|---|
| 70 | * Note that CPU cycle counters count cycles, not elapsed time. |
|---|
| 71 | Because processor frequencies are variable, especially with modern |
|---|
| 72 | power-aware hardware, these are not always reliable for timing and so |
|---|
| 73 | should only be used if you're sure you know what you're doing. |
|---|
| 74 | |
|---|
| 75 | \end{description} |
|---|
| 76 | |
|---|
| 77 | Here is an example: |
|---|
| 78 | \begin{verbatim} |
|---|
| 79 | mpich2/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} |
|---|
| 88 | Run your mpi application to create intermediate \texttt{.irlog} files. |
|---|
| 89 | |
|---|
| 90 | \begin{verbatim} |
|---|
| 91 | mpicc myapp.c -o myapp |
|---|
| 92 | mpiexec -n 3 myapp |
|---|
| 93 | \end{verbatim} |
|---|
| 94 | There will be .irlog files created for each process: |
|---|
| 95 | \begin{verbatim} |
|---|
| 96 | log0.irlog |
|---|
| 97 | log1.irlog |
|---|
| 98 | log2.irlog |
|---|
| 99 | \end{verbatim} |
|---|
| 100 | |
|---|
| 101 | \section{RLOG tools} |
|---|
| 102 | \label{sec:tools} |
|---|
| 103 | For performance reasons each process produces a local intermediate log file |
|---|
| 104 | that needs to be merged into a single rlog file. Use the rlog tools to merge |
|---|
| 105 | the \texttt{.irlog} files into an \texttt{.rlog} file. The rlog tools are |
|---|
| 106 | found in \texttt{mpich2\_build/src/util/logging/rlog}. Currently they are not |
|---|
| 107 | copied to the install directory. |
|---|
| 108 | |
|---|
| 109 | \begin{description} |
|---|
| 110 | \item[\texttt{irlog2rlog}]\mbox{}\\ |
|---|
| 111 | This tool combines the intermediate \texttt{.irlog} files into a single |
|---|
| 112 | \texttt{.rlog} file. The usage is: ``\texttt{irlog2rlog outname.rlog |
|---|
| 113 | input0.irlog input1.irlog ...}'' A shortcut is provided: ``\texttt{irlog2rlog |
|---|
| 114 | outname.rlog <num\_files>}''. Execute \texttt{irlog2rlog} without any |
|---|
| 115 | parameters to see the usage options. |
|---|
| 116 | |
|---|
| 117 | \item[\texttt{printrlog}]\mbox{}\\ |
|---|
| 118 | This tool prints the contents of an \texttt{.rlog} file. |
|---|
| 119 | |
|---|
| 120 | \item[\texttt{printirlog}]\mbox{}\\ |
|---|
| 121 | This tool prints the contents of an \texttt{.irlog} file. |
|---|
| 122 | \end{description} |
|---|
| 123 | |
|---|
| 124 | Continuing the example from the previous section: |
|---|
| 125 | \begin{verbatim} |
|---|
| 126 | irlog2rlog myapp.rlog 3 |
|---|
| 127 | \end{verbatim} |
|---|
| 128 | will convert \texttt{log0.irlog}, \texttt{log1.irlog} and \texttt{log2.irlog} |
|---|
| 129 | to \texttt{myapp.rlog}. |
|---|
| 130 | |
|---|
| 131 | \section{Viewing log files} |
|---|
| 132 | This 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 |
|---|
| 136 | is from Jumpshot. Jumpshot displays slog2 files and has a built in converter |
|---|
| 137 | to convert \texttt{.rlog} files to \texttt{.slog2} files. Start Jumpshot and |
|---|
| 138 | open your \texttt{.rlog} file. Jumpshot will ask you if you want to convert |
|---|
| 139 | the file and you say yes. |
|---|
| 140 | |
|---|
| 141 | \section{Logging state code generation} |
|---|
| 142 | \label{sec:genstates} |
|---|
| 143 | |
|---|
| 144 | This section can be skipped by users. It describes the internal scripts used |
|---|
| 145 | to develop the logging macros. |
|---|
| 146 | |
|---|
| 147 | This 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 |
|---|
| 152 | perl and then runs \texttt{genstates}. |
|---|
| 153 | |
|---|
| 154 | \item \texttt{genstates} finds all \texttt{.i}, \texttt{.h} and \texttt{.c} files |
|---|
| 155 | in the mpich2 directory tree, searches for \texttt{\_STATE\_DECL} in each |
|---|
| 156 | file and builds a list of all the MPID\_STATEs. It validates that the states |
|---|
| 157 | start in a \texttt{\_STATE\_DECL} statement, followed by a \texttt{FUNC\_ENTER} |
|---|
| 158 | statement, and then at least one \texttt{FUNC\_EXIT} statement. Errors are printed |
|---|
| 159 | out if the code does not follow this format except for macros. State declarations |
|---|
| 160 | in macros are assumed to be correct. |
|---|
| 161 | |
|---|
| 162 | \item \texttt{genstates} finds all the \texttt{describe\_states.txt} |
|---|
| 163 | files anywhere in the mpich2 tree. \texttt{describe\_states.txt} files are |
|---|
| 164 | optional and are used to set the output name of the state and its associated |
|---|
| 165 | color. |
|---|
| 166 | |
|---|
| 167 | \item The \texttt{describe\_states.txt} file format is this: |
|---|
| 168 | \begin{verbatim} |
|---|
| 169 | MPID_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} |
|---|
| 175 | If you don't specify a state in a \texttt{describe\_states.txt} file then |
|---|
| 176 | the 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} |
|---|
| 180 | with this \texttt{enum} in it: |
|---|
| 181 | \begin{verbatim} |
|---|
| 182 | enum 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 |
|---|
| 192 | the rlog version of \texttt{MPIR\_Describe\_timer\_states()} is generated. |
|---|
| 193 | |
|---|
| 194 | \end{enumerate} |
|---|
| 195 | |
|---|
| 196 | \end{document} |
|---|