|
Packit Service |
c5cf8c |
\documentclass{report}
|
|
Packit Service |
c5cf8c |
\usepackage{graphics}
|
|
Packit Service |
c5cf8c |
\usepackage[dvipdfm]{hyperref}
|
|
Packit Service |
c5cf8c |
%
|
|
Packit Service |
c5cf8c |
% This is the new (September 2005) MPICH design document. The plan is
|
|
Packit Service |
c5cf8c |
% to make this available both as a PDF document and split on the web in
|
|
Packit Service |
c5cf8c |
% an easy to read fashion. We can use latex2html to tohtml to provide a
|
|
Packit Service |
c5cf8c |
% simple version of this, and that may be enough. However, to retain the
|
|
Packit Service |
c5cf8c |
% option of generating web pages directly from this source, only simple
|
|
Packit Service |
c5cf8c |
% Latex should be used, and only the new forms (e.g., \texttt{...} instead of
|
|
Packit Service |
c5cf8c |
% {\tt ...}
|
|
Packit Service |
c5cf8c |
%
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\makeindex
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{document}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\markright{MPICH Design Document}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\title{MPICH Design Document}
|
|
Packit Service |
c5cf8c |
\author{William D. Gropp and Rajeev Thakur}
|
|
Packit Service |
c5cf8c |
\maketitle
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\pagenumbering{roman}
|
|
Packit Service |
c5cf8c |
\tableofcontents
|
|
Packit Service |
c5cf8c |
\clearpage
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%\raggedright
|
|
Packit Service |
c5cf8c |
%% raggedright resets parindent
|
|
Packit Service |
c5cf8c |
%\parindent 1em
|
|
Packit Service |
c5cf8c |
%% no parskip when parindent used
|
|
Packit Service |
c5cf8c |
%\parskip 0pt
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\pagenumbering{arabic}
|
|
Packit Service |
c5cf8c |
\pagestyle{headings}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\part{MPICH organization for users}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Overview}
|
|
Packit Service |
c5cf8c |
<<up here, explain that MPICH is a framework for MPI implementation with many possible choices, including specialized communication devices and interfaces to process managers, not ch3+hydra. Duplicate this discussion in the top-level entry for developers>>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Communication Devices}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Process Managers}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
other options
|
|
Packit Service |
c5cf8c |
<<this chapter partially overlaps the installation manual, but that manual doesn't cover much of the motivation for the design>>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Help Resources}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Frequently Asked Questions (FAQ)}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Diagnostic Programs}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Buglist archives}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\part{MPICH organization for developers and hackers}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
<<each section (as appropriate) contains a rationale for the choices and a brief discussion of alternatives and why they were not chosen>>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Goals of MPICH}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Principles}
|
|
Packit Service |
c5cf8c |
No duplicated code (no cut and paste programming)
|
|
Packit Service |
c5cf8c |
Uniform appearance of code
|
|
Packit Service |
c5cf8c |
Uniform user interface for controls (e.g., standardized parameter handling, output, naming)
|
|
Packit Service |
c5cf8c |
Coverage and Testing
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Major components}
|
|
Packit Service |
c5cf8c |
devices
|
|
Packit Service |
c5cf8c |
the ch3 device and channels
|
|
Packit Service |
c5cf8c |
process managers and PM interface
|
|
Packit Service |
c5cf8c |
logging
|
|
Packit Service |
c5cf8c |
collectives
|
|
Packit Service |
c5cf8c |
topology
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Build System}
|
|
Packit Service |
c5cf8c |
rationale
|
|
Packit Service |
c5cf8c |
why not automake
|
|
Packit Service |
c5cf8c |
why not libtool
|
|
Packit Service |
c5cf8c |
using the build system
|
|
Packit Service |
c5cf8c |
using your own configure/make/build scripts
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Coding Style}
|
|
Packit Service |
c5cf8c |
Code template for uniform error checking and reporting (e.g.,
|
|
Packit Service |
c5cf8c |
common \texttt{fn\_fail} target)
|
|
Packit Service |
c5cf8c |
Macros for common operations
|
|
Packit Service |
c5cf8c |
error reporting
|
|
Packit Service |
c5cf8c |
memory allocation
|
|
Packit Service |
c5cf8c |
debugging
|
|
Packit Service |
c5cf8c |
Safer or more efficient replacements for common routines
|
|
Packit Service |
c5cf8c |
safe string routines
|
|
Packit Service |
c5cf8c |
memcpy hooks
|
|
Packit Service |
c5cf8c |
Error reporting
|
|
Packit Service |
c5cf8c |
Rationale
|
|
Packit Service |
c5cf8c |
Adding new error classes and codes
|
|
Packit Service |
c5cf8c |
Tags for coverage analysis
|
|
Packit Service |
c5cf8c |
Take advantage of compiler features to identify potential
|
|
Packit Service |
c5cf8c |
problems, including warnings about easily misused features in
|
|
Packit Service |
c5cf8c |
C (such as assignments within if tests).
|
|
Packit Service |
c5cf8c |
Need to put somewhere - don't fix missing prototype messages
|
|
Packit Service |
c5cf8c |
by adding a prototype to the C file; there should always be
|
|
Packit Service |
c5cf8c |
one prototype in a header file somewhere.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Major Structures}
|
|
Packit Service |
c5cf8c |
request, comm, group, etc.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Selecting Features at Compile Time}
|
|
Packit Service |
c5cf8c |
use of macros to control which code is used
|
|
Packit Service |
c5cf8c |
list of all macros
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Language Bindings}
|
|
Packit Service |
c5cf8c |
rationale for buildiface
|
|
Packit Service |
c5cf8c |
Outstanding issues
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Scripts and Standards for user interfaces}
|
|
Packit Service |
c5cf8c |
command line and environment variables
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Adding your own implementation of a component}
|
|
Packit Service |
c5cf8c |
General mechanism (--with-<<component-name>>=directory, e.g., --with-pm=/home/me/mypm)
|
|
Packit Service |
c5cf8c |
configure and setup scripts
|
|
Packit Service |
c5cf8c |
standardized variables (\texttt{MPI\_CFLAGS}, CFLAGS, etc.)
|
|
Packit Service |
c5cf8c |
Specific components (describe, explain the API/ABI, and how to work with it):
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Two types
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
configure/compile-time
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
link/runtime
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Specifying Components during Configure}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Specifying Components at Runtime}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
It is possible to override the default routines for any component at
|
|
Packit Service |
c5cf8c |
runtime by calling one of the following routines.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
MPIX_SetMethod( component, object, name, function, communicator,
|
|
Packit Service |
c5cf8c |
version )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
where
|
|
Packit Service |
c5cf8c |
component - identifier for the component (e.g., topology,
|
|
Packit Service |
c5cf8c |
collectives)
|
|
Packit Service |
c5cf8c |
object - object to change; null if changing the defaults for
|
|
Packit Service |
c5cf8c |
all objects
|
|
Packit Service |
c5cf8c |
name - name of the method (probably character string for function)
|
|
Packit Service |
c5cf8c |
function - function to use
|
|
Packit Service |
c5cf8c |
communicator - communicator scope of this change (MPI\_COMM\_SELF
|
|
Packit Service |
c5cf8c |
and MPI\_COMM\_WORLD are popular choices)
|
|
Packit Service |
c5cf8c |
version - version of the interface (see below)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
This call is collective over the communicator. The intent of the
|
|
Packit Service |
c5cf8c |
communicator option is to allow consistency checking for changes
|
|
Packit Service |
c5cf8c |
that must be consistent across processes (e.g., changing the
|
|
Packit Service |
c5cf8c |
collective algorithms).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The version number is used to ensure that the version of the
|
|
Packit Service |
c5cf8c |
interface matches the one used in the library
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
A related call is
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
MPIX_SetAllMethods( component, object, struct-of-functions*,
|
|
Packit Service |
c5cf8c |
communicator, version )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
This is similar to SetMethod, except all functions are set from those
|
|
Packit Service |
c5cf8c |
defined in the struct-of-functions. The version is very important
|
|
Packit Service |
c5cf8c |
here as it ensures that the struct is known.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
One additional call is
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
MPIX_DLLLoadMethods( component, object, dll-name, communicator,
|
|
Packit Service |
c5cf8c |
version )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
This loads the methods from a dynamic loaded shared object. It is
|
|
Packit Service |
c5cf8c |
collective over the communicator
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Implementation note: the ``component'' in these calls can be the name
|
|
Packit Service |
c5cf8c |
of a routine that
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Collectives}
|
|
Packit Service |
c5cf8c |
\section{Topology}
|
|
Packit Service |
c5cf8c |
\section{Logging}
|
|
Packit Service |
c5cf8c |
--with-logging=/pathname
|
|
Packit Service |
c5cf8c |
looks for \texttt{setup\_logging} script. In addition, the
|
|
Packit Service |
c5cf8c |
\texttt{Makefile} will be invoked.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
clean, dist-clean, maintainer-clean, library target?
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Must provide an mpilogging.h file (contents defined as...)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Example (give example directory on web)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Builtin versions...
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{PM and PMI}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpiexec
|
|
Packit Service |
c5cf8c |
-pmiargs host port executable
|
|
Packit Service |
c5cf8c |
special args used to allow singleton init.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Name Server}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
--with-nameserver=...
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{mpid}
|
|
Packit Service |
c5cf8c |
\section{ch3-channel}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Components still evolving (a placeholder for things that we want to do)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\chapter{Working with MPICH itself}
|
|
Packit Service |
c5cf8c |
<<for people that edit MPICH rather than use the component interface>>
|
|
Packit Service |
c5cf8c |
Coding standards
|
|
Packit Service |
c5cf8c |
Keeping configure clean
|
|
Packit Service |
c5cf8c |
Keeping MPICH modular
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\section{Parameters within the MPICH code}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The purpose of this part is to enable the configure, compile, and
|
|
Packit Service |
c5cf8c |
run-time control of parameters in the collective implementation.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Goals for the parameter handling routines:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{enumerate}
|
|
Packit Service |
c5cf8c |
\item All values (at least in comm\_world) must be the same (the
|
|
Packit Service |
c5cf8c |
collective routines expect the same parameter values)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
For communicators in different comm worlds (e.g., created by
|
|
Packit Service |
c5cf8c |
spawn or connect/accept), it may be necessary to perform a
|
|
Packit Service |
c5cf8c |
separate step when the communicator is created to negotiate
|
|
Packit Service |
c5cf8c |
parameter choices. This may require a communicator-creation
|
|
Packit Service |
c5cf8c |
hook.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The most likely implementation of this step is to check that the
|
|
Packit Service |
c5cf8c |
different comm\_worlds have compatible (typically identical)
|
|
Packit Service |
c5cf8c |
values for the parameters. There may be a
|
|
Packit Service |
c5cf8c |
\texttt{MPIR\_Parm\_check\_consistent}(new intercomm) call for this.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item The parameter routine should provide the following choices, in
|
|
Packit Service |
c5cf8c |
order of decreasing priority:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{enumerate}
|
|
Packit Service |
c5cf8c |
\item Explicit control from within the routine (i.e., by a routine
|
|
Packit Service |
c5cf8c |
call)
|
|
Packit Service |
c5cf8c |
\item Command line parameter on mpiexec
|
|
Packit Service |
c5cf8c |
\item Environment variable on the process with rank 0 in MPI\_COMM\_WORLD.
|
|
Packit Service |
c5cf8c |
\item Value is user-specified parameter file (e.g., ~/.mpichrc)
|
|
Packit Service |
c5cf8c |
\item Value in site-specified parameter file (e.g.,
|
|
Packit Service |
c5cf8c |
/usr/local/mpich/.mpichrc)
|
|
Packit Service |
c5cf8c |
\item Compile-time value set at configure time (e.g.,
|
|
Packit Service |
c5cf8c |
--enable-collective-config=file)
|
|
Packit Service |
c5cf8c |
\item Compile-time value set within the collective code (the
|
|
Packit Service |
c5cf8c |
default values)
|
|
Packit Service |
c5cf8c |
\end{enumerate}
|
|
Packit Service |
c5cf8c |
The choice of parameter value should also have some configure-time
|
|
Packit Service |
c5cf8c |
control to allow a trade-off between generality and absolute
|
|
Packit Service |
c5cf8c |
best performance (particular for startup, if we want to allow
|
|
Packit Service |
c5cf8c |
configurations files to be read).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Note that even process managers that can deliver the same
|
|
Packit Service |
c5cf8c |
environment variable to all processes often allow the user to
|
|
Packit Service |
c5cf8c |
change that behavior (e.g., with a command-line option to
|
|
Packit Service |
c5cf8c |
prevent environment variables from being sent to other
|
|
Packit Service |
c5cf8c |
processes, so we cannot assume that the values of the
|
|
Packit Service |
c5cf8c |
environment variables are the same on all processes without some
|
|
Packit Service |
c5cf8c |
additional information (e.g., the process manager could tell us
|
|
Packit Service |
c5cf8c |
that the environment variables are the same on all processes).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item Parameter documentation should (at least in part) be provided
|
|
Packit Service |
c5cf8c |
where the parameters are used.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item Overhead of using parameter routines should be low; particularly
|
|
Packit Service |
c5cf8c |
after the first use (if that matters; that is, the first time
|
|
Packit Service |
c5cf8c |
may involve an initialization phase)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item Parameter routines should be a component, cleanly initialized by
|
|
Packit Service |
c5cf8c |
MPI\_Init/MPI\_Init\_thread and shut down by MPI\_Finalize.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item Parameter types that must be handled include integer (e.g.,
|
|
Packit Service |
c5cf8c |
message size, group size). Others should be allowed for (such
|
|
Packit Service |
c5cf8c |
as arrays of integers, characters) as needed. We should avoid
|
|
Packit Service |
c5cf8c |
floating-point values because of possible problems in using them
|
|
Packit Service |
c5cf8c |
consistently, particularly in a heterogeneous environment.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Note that this does not say anything about how the values may be
|
|
Packit Service |
c5cf8c |
represented in a parameter database, as that is an
|
|
Packit Service |
c5cf8c |
implementation issue. However, it does say that the value must
|
|
Packit Service |
c5cf8c |
be delivered to the using routine in the form that it needs. We
|
|
Packit Service |
c5cf8c |
do not want to call strtol() everytime a routine needs an
|
|
Packit Service |
c5cf8c |
integer (atoi should not be used because it has no way to
|
|
Packit Service |
c5cf8c |
indicate that the value contains non-digit characters).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item The design should ensure that changes need be made in only one
|
|
Packit Service |
c5cf8c |
place or alternately that inconsistencies (e.g., between an
|
|
Packit Service |
c5cf8c |
initialization and a use) are detectable before runtime (before
|
|
Packit Service |
c5cf8c |
runtime so that the problem can be detected and fixed without
|
|
Packit Service |
c5cf8c |
depending on running a particular test case).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\end{enumerate}
|
|
Packit Service |
c5cf8c |
Proposed Design that meets these goals
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{enumerate}
|
|
Packit Service |
c5cf8c |
\item => Some setup at MPI\_Init time to ensure all processes have
|
|
Packit Service |
c5cf8c |
consistent values. Also requires hook for communicators that span
|
|
Packit Service |
c5cf8c |
multiple MPI\_COMM\_WORLDs.
|
|
Packit Service |
c5cf8c |
\item => registration of names so that the data can be acquired scalably
|
|
Packit Service |
c5cf8c |
(e.g., read from file, environment variable on process with rank zero)
|
|
Packit Service |
c5cf8c |
\item => a description string either in the call or in the structured
|
|
Packit Service |
c5cf8c |
comment at the point of use.
|
|
Packit Service |
c5cf8c |
\item also => an initialization step
|
|
Packit Service |
c5cf8c |
\item => using the finalize callback. To make them a component for the
|
|
Packit Service |
c5cf8c |
initialization step, there needs to be some mechanism to load modules
|
|
Packit Service |
c5cf8c |
\item ?
|
|
Packit Service |
c5cf8c |
\item => Either a single point of use (which introduces efficiency
|
|
Packit Service |
c5cf8c |
problems) or some sort of source-code preprocessing.
|
|
Packit Service |
c5cf8c |
\end{enumerate}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Based on these, I propose the following:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Initialization module:\\
|
|
Packit Service |
c5cf8c |
This routine is called from MPI\_Init. It details all parameters used
|
|
Packit Service |
c5cf8c |
by the collective routines, the associated environment variables, and
|
|
Packit Service |
c5cf8c |
the description strings. It might look something like:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
int MPIR_Parm_register_collective( ) {
|
|
Packit Service |
c5cf8c |
rc = MPIR_Parm_register_int( "MPICH:SCATTER_THRESHOLD",
|
|
Packit Service |
c5cf8c |
&MPIR_Scatter_threshold,
|
|
Packit Service |
c5cf8c |
2048,
|
|
Packit Service |
c5cf8c |
"Maximum size of messages sent using \
|
|
Packit Service |
c5cf8c |
doubling in scatter algorithm with a default of %d" );
|
|
Packit Service |
c5cf8c |
...
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The purpose of this routine is to communicate, at runtime, the names
|
|
Packit Service |
c5cf8c |
of the parameters that some part of the system may need. The
|
|
Packit Service |
c5cf8c |
parameters to this routine are:
|
|
Packit Service |
c5cf8c |
\begin{description}
|
|
Packit Service |
c5cf8c |
\item[\texttt{MPICH:SCATTER\_THRESHOLD}]The name of the parameter. The
|
|
Packit Service |
c5cf8c |
environment variable that might correspond to this is
|
|
Packit Service |
c5cf8c |
\texttt{MPICH\_SCATTER\_THRESHOLD}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item[\texttt{\&MPIR\_Scatter\_threashold}]The address of an int (since this is
|
|
Packit Service |
c5cf8c |
\texttt{MPIR\_Parm\_register\_int}) that will contain the value.
|
|
Packit Service |
c5cf8c |
This integer can be accessed directly by the code; see the example of the use
|
|
Packit Service |
c5cf8c |
below.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item[2048]The default value if no value is provided
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\item["Maximum ... \%d..."]A documentation string including a format
|
|
Packit Service |
c5cf8c |
specifier for the default value. This will be used to create
|
|
Packit Service |
c5cf8c |
help information on the parameter directly from the source code.
|
|
Packit Service |
c5cf8c |
\end{description}
|
|
Packit Service |
c5cf8c |
Possible additional features would be a valid range (e.g., 0 to 64K)
|
|
Packit Service |
c5cf8c |
or a routine to test for valid input.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Once all of these routines are called (e.g., for any set of modules
|
|
Packit Service |
c5cf8c |
that choose to use this method to acquire parameters), the routine
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
int MPIR_Parm_init( )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
is called from within MPI\_Init/MPI\_Init\_thread. This is collective
|
|
Packit Service |
c5cf8c |
over COMM\_WORLD and performs the
|
|
Packit Service |
c5cf8c |
necessary file reads, environment variable reads and broadcasts the
|
|
Packit Service |
c5cf8c |
results to all processes. It handles all registered names, from all
|
|
Packit Service |
c5cf8c |
modules.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
In the code, all parameters are accessed through a macro that allows
|
|
Packit Service |
c5cf8c |
the values to be either compile-time or run-time constants
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
MPIR_PARM_GET_INT( "MPICH:SCATTER_THRESHOLD", MPIR_Scatter_threshold,2048 )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
This expands into either:
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
2048 (compile-time only)
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
or
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
MPIR_Scatter_threshold (run-time)
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
or even (runtime, lazy evaluation):
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
(MPIR_Scatter_threshhold_not_set ? \
|
|
Packit Service |
c5cf8c |
(MPIR_Scatter_threshhold_not_set=1,\
|
|
Packit Service |
c5cf8c |
MPIR_Scatter_threshold=MPIR_ScatterMPIRParmGetInt(\
|
|
Packit Service |
c5cf8c |
"MPICH:SCATTER_THRESHOLD", 2048 )) : MPIR_Scatter_threshhold )
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The name (the first argument) is provided to allow for consistency
|
|
Packit Service |
c5cf8c |
checking against the registered names. And in practice, the "2048"
|
|
Packit Service |
c5cf8c |
would itself be a macro, set in an include file in the coll directory
|
|
Packit Service |
c5cf8c |
(not in src/include/mpiimpl.h).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The parm init routine would use the name in the register routine (the
|
|
Packit Service |
c5cf8c |
first argument) in the following way:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\begin{verbatim}
|
|
Packit Service |
c5cf8c |
The : in the name separates the prefix from the rest of the name.
|
|
Packit Service |
c5cf8c |
The name after the : may be used in an init file
|
|
Packit Service |
c5cf8c |
The name with the : replaced by an \_ may be used as an environment
|
|
Packit Service |
c5cf8c |
variable or in the init file.
|
|
Packit Service |
c5cf8c |
\end{verbatim}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
A more sophisticated approach would use code similar to (and shared
|
|
Packit Service |
c5cf8c |
with) the error message extraction to synthesize the
|
|
Packit Service |
c5cf8c |
\texttt{MPIR\_Parm\_register\_collective()} routine. This would be requried to
|
|
Packit Service |
c5cf8c |
address goal 7 above. An alternative would be to simply detect an
|
|
Packit Service |
c5cf8c |
inconsistency by having a program read the source code and check that
|
|
Packit Service |
c5cf8c |
the registration and use calls match.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The script
|
|
Packit Service |
c5cf8c |
\texttt{maint/extractstrings}, combined with code similar to that for
|
|
Packit Service |
c5cf8c |
error messages in \texttt{maint/extracterrmsgs}, can be used to
|
|
Packit Service |
c5cf8c |
automate the collection of registration information from the source code.
|
|
Packit Service |
c5cf8c |
% ---
|
|
Packit Service |
c5cf8c |
% Old text from December 2004
|
|
Packit Service |
c5cf8c |
%% 1) Control of parameterization
|
|
Packit Service |
c5cf8c |
%% The purpose of this part is to enable the configure, compile, and
|
|
Packit Service |
c5cf8c |
%% run-time control of parameters in the collective implementation.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% Goals for the parameter handling routines:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 1) All values (at least in comm_world) must be the same (the
|
|
Packit Service |
c5cf8c |
%% collective routines expect the same parameter values)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% a) For communicators in different comm worlds (e.g., created by
|
|
Packit Service |
c5cf8c |
%% spawn or connect/accept), it may be necessary to perform a
|
|
Packit Service |
c5cf8c |
%% separate step when the communicator is created to negotiate
|
|
Packit Service |
c5cf8c |
%% parameter choices. This may require a communicator-creation
|
|
Packit Service |
c5cf8c |
%% hook.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 2) The parameter routine should provide the following choices, in
|
|
Packit Service |
c5cf8c |
%% order of decreasing priority:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% a) Explicit control from within the routine (i.e., by a routine
|
|
Packit Service |
c5cf8c |
%% call)
|
|
Packit Service |
c5cf8c |
%% b) Environment variable on rank-0 communicator
|
|
Packit Service |
c5cf8c |
%% c) Value is user-specified parameter file (e.g., ~/.mpichrc)
|
|
Packit Service |
c5cf8c |
%% d) Value in site-specified parameter file (e.g.,
|
|
Packit Service |
c5cf8c |
%% /usr/local/mpich/.mpichrc)
|
|
Packit Service |
c5cf8c |
%% e) Compile-time value set at configure time (e.g.,
|
|
Packit Service |
c5cf8c |
%% --enable-collective-config=file)
|
|
Packit Service |
c5cf8c |
%% f) Compile-time value set within the collective code (the
|
|
Packit Service |
c5cf8c |
%% default values)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% The choice of parameter value should also have some configure-time
|
|
Packit Service |
c5cf8c |
%% control to allow a trade-off between generality and absolute
|
|
Packit Service |
c5cf8c |
%% best performance (particular for startup, if we want to allow
|
|
Packit Service |
c5cf8c |
%% configurations files to be read).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 3) Parameter documentation should (at least in part) be provided
|
|
Packit Service |
c5cf8c |
%% where the parameters are used.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 4) Overhead of using parameter routines should be low; particularly
|
|
Packit Service |
c5cf8c |
%% after the first use (if that matters; that is, the first time
|
|
Packit Service |
c5cf8c |
%% may involve an initialization phase)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 5) Parameter routines should be a component, cleanly initialized by
|
|
Packit Service |
c5cf8c |
%% MPI_Init/MPI_Init_thread and shut down by MPI_Finalize.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 6) Parameter types that must be handled include integer (e.g.,
|
|
Packit Service |
c5cf8c |
%% message size, group size). Others should be allowed for (such
|
|
Packit Service |
c5cf8c |
%% as arrays of integers, characters). We should avoid
|
|
Packit Service |
c5cf8c |
%% floating-point values because of possible problems in using them
|
|
Packit Service |
c5cf8c |
%% consistently, particularly in a heterogeneous environment.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% Proposed Design that meets these goals
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 1) => Some setup at MPI_Init time to ensure all processes have
|
|
Packit Service |
c5cf8c |
%% consistent values. Also requires hook for communicators that span
|
|
Packit Service |
c5cf8c |
%% multiple MPI_COMM_WORLDs.
|
|
Packit Service |
c5cf8c |
%% 2) => registration of names so that the data can be acquired scalably
|
|
Packit Service |
c5cf8c |
%% (e.g., read from file, environment variable on process with rank zero)
|
|
Packit Service |
c5cf8c |
%% 3) => a description string either in the call or in the structured
|
|
Packit Service |
c5cf8c |
%% comment at the point of use.
|
|
Packit Service |
c5cf8c |
%% 4) also => an initialization step
|
|
Packit Service |
c5cf8c |
%% 5) => using the finalize callback. To make them a component for the
|
|
Packit Service |
c5cf8c |
%% initialization step, there needs to be some mechanism to load modules
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% Based on these, I propose the following:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% Initialization module:
|
|
Packit Service |
c5cf8c |
%% This routine is called from MPI_Init. It details all parameters used
|
|
Packit Service |
c5cf8c |
%% by the collective routines, the associated environment variables, and
|
|
Packit Service |
c5cf8c |
%% the description strings. It might look something like:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% int MPIR_Parm_register_collective( ) {
|
|
Packit Service |
c5cf8c |
%% rc = MPIR_Parm_register_int( "MPICH:SCATTER_THRESHOLD",
|
|
Packit Service |
c5cf8c |
%% &MPIR_Scatter_threshold,
|
|
Packit Service |
c5cf8c |
%% 2048,
|
|
Packit Service |
c5cf8c |
%% "Maximum size of messages sent using \
|
|
Packit Service |
c5cf8c |
%% doubling in scatter algorithm with a default of %d" );
|
|
Packit Service |
c5cf8c |
%% ...
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% return MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
%% }
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% The purpose of this routine is to communicate, at runtime, the names
|
|
Packit Service |
c5cf8c |
%% of the parameters that some part of the system may need.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% Once all of these routines are called (e.g., for any set of modules
|
|
Packit Service |
c5cf8c |
%% that choose to use this method to acquire parameters), the routine
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% int MPIR_Parm_init( )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% is called from within MPI_Init/MPI_Init_thread. This is collective
|
|
Packit Service |
c5cf8c |
%% over COMM_WORLD and performs the
|
|
Packit Service |
c5cf8c |
%% necessary file reads, environment variable reads and broadcasts the
|
|
Packit Service |
c5cf8c |
%% results to all processes. It handles all registered names, from all
|
|
Packit Service |
c5cf8c |
%% modules.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% In the code, all parameters are accessed through a macro that allows
|
|
Packit Service |
c5cf8c |
%% the values to be either compile-time or run-time constants
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% MPIR_PARM_GET_INT( "MPICH:SCATTER_THRESHOLD", MPIR_Scatter_threshold, 2048 )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% This expands into either:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% 2048 (compile-time only)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% MPIR_Scatter_threshold (run-time)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% or even (runtime, lazy evaluation):
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% (MPIR_Scatter_threshhold_not_set ? \
|
|
Packit Service |
c5cf8c |
%% (MPIR_Scatter_threshhold_not_set=0,MPIR_Scatter_threshold=MPIR_ScatterMPIRParmGetInt("MPICH:SCATTER_THRESHOLD",
|
|
Packit Service |
c5cf8c |
%% 2048 )) : MPIR_Scatter_threshhold )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% The name (the first argument) is provided to allow for consistency
|
|
Packit Service |
c5cf8c |
%% checking against the registered names. And in practice, the "2048"
|
|
Packit Service |
c5cf8c |
%% would itself be a macro, set in an include file in the coll directory
|
|
Packit Service |
c5cf8c |
%% (not in src/include/mpiimpl.h).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% The parm init routine would use the name in the register routine (the
|
|
Packit Service |
c5cf8c |
%% first argument) in the following way:
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% The : in the name separates the prefix from the rest of the name.
|
|
Packit Service |
c5cf8c |
%% The name after the : may be used in an init file
|
|
Packit Service |
c5cf8c |
%% The name with the : replaced by an _ may be used as an environment
|
|
Packit Service |
c5cf8c |
%% variable or in the init file.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
%% A more sophisticated approach would use code similar to (and shared
|
|
Packit Service |
c5cf8c |
%% with) the error message extraction to synthesize the
|
|
Packit Service |
c5cf8c |
%% MPIR_Parm_register_collective() routine.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
\end{document}
|