1 |
% $Header$ |
% $Header$ |
2 |
|
|
3 |
In this chapter we describe the software architecture and |
This chapter focuses on describing the {\bf WRAPPER} environment within which |
4 |
implementation strategy for the MITgcm code. The first part of this |
both the core numerics and the pluggable packages operate. The description |
5 |
chapter discusses the MITgcm architecture at an abstract level. In the second |
presented here is intended to be a detailed exposition and contains significant |
6 |
part of the chapter we described practical details of the MITgcm implementation |
background material, as well as advanced details on working with the WRAPPER. |
7 |
and of current tools and operating system features that are employed. |
The tutorial sections of this manual (see sections |
8 |
|
\ref{sect:tutorials} and \ref{sect:tutorialIII}) |
9 |
|
contain more succinct, step-by-step instructions on running basic numerical |
10 |
|
experiments, of varous types, both sequentially and in parallel. For many |
11 |
|
projects simply starting from an example code and adapting it to suit a |
12 |
|
particular situation |
13 |
|
will be all that is required. |
14 |
|
The first part of this chapter discusses the MITgcm architecture at an |
15 |
|
abstract level. In the second part of the chapter we described practical |
16 |
|
details of the MITgcm implementation and of current tools and operating system |
17 |
|
features that are employed. |
18 |
|
|
19 |
\section{Overall architectural goals} |
\section{Overall architectural goals} |
20 |
|
|
76 |
\end{figure} |
\end{figure} |
77 |
|
|
78 |
\section{WRAPPER} |
\section{WRAPPER} |
79 |
|
\begin{rawhtml} |
80 |
|
<!-- CMIREDIR:wrapper --> |
81 |
|
\end{rawhtml} |
82 |
|
|
83 |
A significant element of the software architecture utilized in |
A significant element of the software architecture utilized in |
84 |
MITgcm is a software superstructure and substructure collectively |
MITgcm is a software superstructure and substructure collectively |
100 |
\resizebox{!}{4.5in}{\includegraphics{part4/fit_in_wrapper.eps}} |
\resizebox{!}{4.5in}{\includegraphics{part4/fit_in_wrapper.eps}} |
101 |
\end{center} |
\end{center} |
102 |
\caption{ |
\caption{ |
103 |
Numerical code is written too fit within a software support |
Numerical code is written to fit within a software support |
104 |
infrastructure called WRAPPER. The WRAPPER is portable and |
infrastructure called WRAPPER. The WRAPPER is portable and |
105 |
can be specialized for a wide range of specific target hardware and |
can be specialized for a wide range of specific target hardware and |
106 |
programming environments, without impacting numerical code that fits |
programming environments, without impacting numerical code that fits |
123 |
(UMA) and non-uniform memory access (NUMA) designs. Significant work has also |
(UMA) and non-uniform memory access (NUMA) designs. Significant work has also |
124 |
been undertaken on x86 cluster systems, Alpha processor based clustered SMP |
been undertaken on x86 cluster systems, Alpha processor based clustered SMP |
125 |
systems, and on cache-coherent NUMA (CC-NUMA) systems from Silicon Graphics. |
systems, and on cache-coherent NUMA (CC-NUMA) systems from Silicon Graphics. |
126 |
The MITgcm code, operating within the WRAPPER, is also used routinely used on |
The MITgcm code, operating within the WRAPPER, is also routinely used on |
127 |
large scale MPP systems (for example T3E systems and IBM SP systems). In all |
large scale MPP systems (for example T3E systems and IBM SP systems). In all |
128 |
cases numerical code, operating within the WRAPPER, performs and scales very |
cases numerical code, operating within the WRAPPER, performs and scales very |
129 |
competitively with equivalent numerical code that has been modified to contain |
competitively with equivalent numerical code that has been modified to contain |
153 |
computer architecture currently available to the scientific computing community. |
computer architecture currently available to the scientific computing community. |
154 |
|
|
155 |
\subsection{Machine model parallelism} |
\subsection{Machine model parallelism} |
156 |
|
\begin{rawhtml} |
157 |
|
<!-- CMIREDIR:domain_decomp --> |
158 |
|
\end{rawhtml} |
159 |
|
|
160 |
Codes operating under the WRAPPER target an abstract machine that is assumed to |
Codes operating under the WRAPPER target an abstract machine that is assumed to |
161 |
consist of one or more logical processors that can compute concurrently. |
consist of one or more logical processors that can compute concurrently. |
667 |
computation is performed concurrently over as many processes and threads |
computation is performed concurrently over as many processes and threads |
668 |
as there are physical processors available to compute. |
as there are physical processors available to compute. |
669 |
|
|
670 |
|
An exception to the the use of {\em bi} and {\em bj} in loops arises in the |
671 |
|
exchange routines used when the exch2 package is used with the cubed |
672 |
|
sphere. In this case {\em bj} is generally set to 1 and the loop runs from |
673 |
|
1,{\em bi}. Within the loop {\em bi} is used to retrieve the tile number, |
674 |
|
which is then used to reference exchange parameters. |
675 |
|
|
676 |
The amount of computation that can be embedded |
The amount of computation that can be embedded |
677 |
a single loop over {\em bi} and {\em bj} varies for different parts of the |
a single loop over {\em bi} and {\em bj} varies for different parts of the |
678 |
MITgcm algorithm. Figure \ref{fig:bibj_extract} shows a code extract |
MITgcm algorithm. Figure \ref{fig:bibj_extract} shows a code extract |
793 |
forty grid points in y. The two sub-domains in each process will be computed |
forty grid points in y. The two sub-domains in each process will be computed |
794 |
sequentially if they are given to a single thread within a single process. |
sequentially if they are given to a single thread within a single process. |
795 |
Alternatively if the code is invoked with multiple threads per process |
Alternatively if the code is invoked with multiple threads per process |
796 |
the two domains in y may be computed on concurrently. |
the two domains in y may be computed concurrently. |
797 |
\item |
\item |
798 |
\begin{verbatim} |
\begin{verbatim} |
799 |
PARAMETER ( |
PARAMETER ( |
829 |
WRAPPER is shown in figure \ref{fig:wrapper_startup}. |
WRAPPER is shown in figure \ref{fig:wrapper_startup}. |
830 |
|
|
831 |
\begin{figure} |
\begin{figure} |
832 |
|
{\footnotesize |
833 |
\begin{verbatim} |
\begin{verbatim} |
834 |
|
|
835 |
MAIN |
MAIN |
858 |
|
|
859 |
|
|
860 |
\end{verbatim} |
\end{verbatim} |
861 |
|
} |
862 |
\caption{Main stages of the WRAPPER startup procedure. |
\caption{Main stages of the WRAPPER startup procedure. |
863 |
This process proceeds transfer of control to application code, which |
This process proceeds transfer of control to application code, which |
864 |
occurs through the procedure {\em THE\_MODEL\_MAIN()}. |
occurs through the procedure {\em THE\_MODEL\_MAIN()}. |
941 |
File: {\em eesupp/inc/MAIN\_PDIRECTIVES2.h}\\ |
File: {\em eesupp/inc/MAIN\_PDIRECTIVES2.h}\\ |
942 |
File: {\em model/src/THE\_MODEL\_MAIN.F}\\ |
File: {\em model/src/THE\_MODEL\_MAIN.F}\\ |
943 |
File: {\em eesupp/src/MAIN.F}\\ |
File: {\em eesupp/src/MAIN.F}\\ |
944 |
File: {\em tools/genmake}\\ |
File: {\em tools/genmake2}\\ |
945 |
File: {\em eedata}\\ |
File: {\em eedata}\\ |
946 |
CPP: {\em TARGET\_SUN}\\ |
CPP: {\em TARGET\_SUN}\\ |
947 |
CPP: {\em TARGET\_DEC}\\ |
CPP: {\em TARGET\_DEC}\\ |
980 |
of controlling and coordinating the start up of a large number |
of controlling and coordinating the start up of a large number |
981 |
(hundreds and possibly even thousands) of copies of the same |
(hundreds and possibly even thousands) of copies of the same |
982 |
program, MPI is used. The calls to the MPI multi-process startup |
program, MPI is used. The calls to the MPI multi-process startup |
983 |
routines must be activated at compile time. This is done |
routines must be activated at compile time. Currently MPI libraries are |
984 |
by setting the {\em ALLOW\_USE\_MPI} and {\em ALWAYS\_USE\_MPI} |
invoked by |
985 |
flags in the {\em CPP\_EEOPTIONS.h} file.\\ |
specifying the appropriate options file with the |
986 |
|
{\tt-of} flag when running the {\em genmake2} |
987 |
|
script, which generates the Makefile for compiling and linking MITgcm. |
988 |
|
(Previously this was done by setting the {\em ALLOW\_USE\_MPI} and |
989 |
|
{\em ALWAYS\_USE\_MPI} flags in the {\em CPP\_EEOPTIONS.h} file.) More |
990 |
|
detailed information about the use of {\em genmake2} for specifying |
991 |
|
local compiler flags is located in section \ref{sect:genmake}.\\ |
992 |
|
|
|
\fbox{ |
|
|
\begin{minipage}{4.75in} |
|
|
File: {\em eesupp/inc/CPP\_EEOPTIONS.h}\\ |
|
|
CPP: {\em ALLOW\_USE\_MPI}\\ |
|
|
CPP: {\em ALWAYS\_USE\_MPI}\\ |
|
|
Parameter: {\em nPx}\\ |
|
|
Parameter: {\em nPy} |
|
|
\end{minipage} |
|
|
} \\ |
|
|
|
|
|
Additionally, compile time options are required to link in the |
|
|
MPI libraries and header files. Examples of these options |
|
|
can be found in the {\em genmake} script that creates makefiles |
|
|
for compilation. When this script is executed with the {bf -mpi} |
|
|
flag it will generate a makefile that includes |
|
|
paths for search for MPI head files and for linking in |
|
|
MPI libraries. For example the {\bf -mpi} flag on a |
|
|
Silicon Graphics IRIX system causes a |
|
|
Makefile with the compilation command |
|
|
Graphics IRIX system \begin{verbatim} |
|
|
mpif77 -I/usr/local/mpi/include -DALLOW_USE_MPI -DALWAYS_USE_MPI |
|
|
\end{verbatim} |
|
|
to be generated. |
|
|
This is the correct set of options for using the MPICH open-source |
|
|
version of MPI, when it has been installed under the subdirectory |
|
|
/usr/local/mpi. |
|
|
However, on many systems there may be several |
|
|
versions of MPI installed. For example many systems have both |
|
|
the open source MPICH set of libraries and a vendor specific native form |
|
|
of the MPI libraries. The correct setup to use will depend on the |
|
|
local configuration of your system.\\ |
|
993 |
|
|
994 |
\fbox{ |
\fbox{ |
995 |
\begin{minipage}{4.75in} |
\begin{minipage}{4.75in} |
996 |
File: {\em tools/genmake} |
Directory: {\em tools/build\_options}\\ |
997 |
|
File: {\em tools/genmake2} |
998 |
\end{minipage} |
\end{minipage} |
999 |
} \\ |
} \\ |
1000 |
\paragraph{\bf Execution} The mechanics of starting a program in |
\paragraph{\bf Execution} The mechanics of starting a program in |
1012 |
in the file {\em SIZE.h}. The parameter {\em mf} specifies that a text file |
in the file {\em SIZE.h}. The parameter {\em mf} specifies that a text file |
1013 |
called ``mf'' will be read to get a list of processor names on |
called ``mf'' will be read to get a list of processor names on |
1014 |
which the sixty-four processes will execute. The syntax of this file |
which the sixty-four processes will execute. The syntax of this file |
1015 |
is specified by the MPI distribution |
is specified by the MPI distribution. |
1016 |
\\ |
\\ |
1017 |
|
|
1018 |
\fbox{ |
\fbox{ |
1063 |
Allocation of processes to tiles in controlled by the routine |
Allocation of processes to tiles in controlled by the routine |
1064 |
{\em INI\_PROCS()}. For each process this routine sets |
{\em INI\_PROCS()}. For each process this routine sets |
1065 |
the variables {\em myXGlobalLo} and {\em myYGlobalLo}. |
the variables {\em myXGlobalLo} and {\em myYGlobalLo}. |
1066 |
These variables specify (in index space) the coordinate |
These variables specify in index space the coordinates |
1067 |
of the southern most and western most corner of the |
of the southernmost and westernmost corner of the |
1068 |
southern most and western most tile owned by this process. |
southernmost and westernmost tile owned by this process. |
1069 |
The variables {\em pidW}, {\em pidE}, {\em pidS} and {\em pidN} |
The variables {\em pidW}, {\em pidE}, {\em pidS} and {\em pidN} |
1070 |
are also set in this routine. These are used to identify |
are also set in this routine. These are used to identify |
1071 |
processes holding tiles to the west, east, south and north |
processes holding tiles to the west, east, south and north |
1072 |
of this process. These values are stored in global storage |
of this process. These values are stored in global storage |
1073 |
in the header file {\em EESUPPORT.h} for use by |
in the header file {\em EESUPPORT.h} for use by |
1074 |
communication routines. |
communication routines. The above does not hold when the |
1075 |
|
exch2 package is used -- exch2 sets its own parameters to |
1076 |
|
specify the global indices of tiles and their relationships |
1077 |
|
to each other. See the documentation on the exch2 package |
1078 |
|
(\ref{sec:exch2}) for |
1079 |
|
details. |
1080 |
\\ |
\\ |
1081 |
|
|
1082 |
\fbox{ |
\fbox{ |
1102 |
describes the information that is held and used. |
describes the information that is held and used. |
1103 |
|
|
1104 |
\begin{enumerate} |
\begin{enumerate} |
1105 |
\item {\bf Tile-tile connectivity information} For each tile the WRAPPER |
\item {\bf Tile-tile connectivity information} |
1106 |
sets a flag that sets the tile number to the north, south, east and |
For each tile the WRAPPER |
1107 |
|
sets a flag that sets the tile number to the north, |
1108 |
|
south, east and |
1109 |
west of that tile. This number is unique over all tiles in a |
west of that tile. This number is unique over all tiles in a |
1110 |
configuration. The number is held in the variables {\em tileNo} |
configuration. Except when using the cubed sphere and the exch2 package, |
1111 |
|
the number is held in the variables {\em tileNo} |
1112 |
( this holds the tiles own number), {\em tileNoN}, {\em tileNoS}, |
( this holds the tiles own number), {\em tileNoN}, {\em tileNoS}, |
1113 |
{\em tileNoE} and {\em tileNoW}. A parameter is also stored with each tile |
{\em tileNoE} and {\em tileNoW}. A parameter is also stored with each tile |
1114 |
that specifies the type of communication that is used between tiles. |
that specifies the type of communication that is used between tiles. |
1131 |
(see figure \ref{fig:communication_primitives}). The routine |
(see figure \ref{fig:communication_primitives}). The routine |
1132 |
{\em ini\_communication\_patterns()} is responsible for setting the |
{\em ini\_communication\_patterns()} is responsible for setting the |
1133 |
communication mode values for each tile. |
communication mode values for each tile. |
1134 |
\\ |
|
1135 |
|
When using the cubed sphere configuration with the exch2 package, the |
1136 |
|
relationships between tiles and their communication methods are set |
1137 |
|
by the package in other variables. See the exch2 package documentation |
1138 |
|
(\ref{sec:exch2} for details. |
1139 |
|
|
1140 |
|
|
1141 |
|
|
1142 |
\fbox{ |
\fbox{ |
1143 |
\begin{minipage}{4.75in} |
\begin{minipage}{4.75in} |
1273 |
the cube-sphere grid. In this class of grid a rotation may be required |
the cube-sphere grid. In this class of grid a rotation may be required |
1274 |
between tiles. Aligning the coordinate requiring rotation with the |
between tiles. Aligning the coordinate requiring rotation with the |
1275 |
tile decomposition, allows the coordinate transformation to |
tile decomposition, allows the coordinate transformation to |
1276 |
be embedded within a custom form of the \_EXCH primitive. |
be embedded within a custom form of the \_EXCH primitive. In these |
1277 |
|
cases \_EXCH is mapped to exch2 routines, as detailed in the exch2 |
1278 |
|
package documentation \ref{sec:exch2}. |
1279 |
|
|
1280 |
\item {\bf Reverse Mode} |
\item {\bf Reverse Mode} |
1281 |
The communication primitives \_EXCH and \_GSUM both employ |
The communication primitives \_EXCH and \_GSUM both employ |
1292 |
is set to the value {\em REVERSE\_SIMULATION}. This signifies |
is set to the value {\em REVERSE\_SIMULATION}. This signifies |
1293 |
ti the low-level routines that the adjoint forms of the |
ti the low-level routines that the adjoint forms of the |
1294 |
appropriate communication operation should be performed. |
appropriate communication operation should be performed. |
1295 |
|
|
1296 |
\item {\bf MAX\_NO\_THREADS} |
\item {\bf MAX\_NO\_THREADS} |
1297 |
The variable {\em MAX\_NO\_THREADS} is used to indicate the |
The variable {\em MAX\_NO\_THREADS} is used to indicate the |
1298 |
maximum number of OS threads that a code will use. This |
maximum number of OS threads that a code will use. This |
1397 |
This is done to allow a large number of variations on the exchange |
This is done to allow a large number of variations on the exchange |
1398 |
process to be maintained. One set of variations supports the |
process to be maintained. One set of variations supports the |
1399 |
cube sphere grid. Support for a cube sphere grid in MITgcm is based |
cube sphere grid. Support for a cube sphere grid in MITgcm is based |
1400 |
on having each face of the cube as a separate tile (or tiles). |
on having each face of the cube as a separate tile or tiles. |
1401 |
The exchange routines are then able to absorb much of the |
The exchange routines are then able to absorb much of the |
1402 |
detailed rotation and reorientation required when moving around the |
detailed rotation and reorientation required when moving around the |
1403 |
cube grid. The set of {\em \_EXCH} routines that contain the |
cube grid. The set of {\em \_EXCH} routines that contain the |
1431 |
|
|
1432 |
WRAPPER layer. |
WRAPPER layer. |
1433 |
|
|
1434 |
|
{\footnotesize |
1435 |
\begin{verbatim} |
\begin{verbatim} |
1436 |
|
|
1437 |
MAIN |
MAIN |
1459 |
|--THE_MODEL_MAIN :: Numerical code top-level driver routine |
|--THE_MODEL_MAIN :: Numerical code top-level driver routine |
1460 |
|
|
1461 |
\end{verbatim} |
\end{verbatim} |
1462 |
|
} |
1463 |
|
|
1464 |
Core equations plus packages. |
Core equations plus packages. |
1465 |
|
|
1466 |
|
{\footnotesize |
1467 |
\begin{verbatim} |
\begin{verbatim} |
1468 |
C |
C |
1469 |
C |
C |
1802 |
C :: events. |
C :: events. |
1803 |
C |
C |
1804 |
\end{verbatim} |
\end{verbatim} |
1805 |
|
} |
1806 |
|
|
1807 |
\subsection{Measuring and Characterizing Performance} |
\subsection{Measuring and Characterizing Performance} |
1808 |
|
|