/[MITgcm]/manual/s_software/text/sarch.tex
ViewVC logotype

Diff of /manual/s_software/text/sarch.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7 by cnh, Thu Feb 28 19:32:20 2002 UTC revision 1.17 by afe, Tue Mar 23 15:29:40 2004 UTC
# Line 4  This chapter focuses on describing the { Line 4  This chapter focuses on describing the {
4  both the core numerics and the pluggable packages operate. The description  both the core numerics and the pluggable packages operate. The description
5  presented here is intended to be a detailed exposition and contains significant  presented here is intended to be a detailed exposition and contains significant
6  background material, as well as advanced details on working with the WRAPPER.  background material, as well as advanced details on working with the WRAPPER.
7  The tutorial sections of this manual (see Chapters  The tutorial sections of this manual (see sections
8  \ref{chap:tutorialI}, \ref{chap:tutorialII} and \ref{chap:tutorialIII})  \ref{sect:tutorials}  and \ref{sect:tutorialIII})
9  contain more succinct, step-by-step instructions on running basic numerical  contain more succinct, step-by-step instructions on running basic numerical
10  experiments, of varous types, both sequentially and in parallel. For many  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  projects simply starting from an example code and adapting it to suit a
# Line 76  floating point operations.} Line 76  floating point operations.}
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
# Line 97  and operating systems. This allows numer Line 100  and operating systems. This allows numer
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
# Line 120  uniprocessor and multi-processor Sun sys Line 123  uniprocessor and multi-processor Sun sys
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
# Line 150  easily be specialized to fit, in a compu Line 153  easily be specialized to fit, in a compu
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.  
# Line 661  Within a {\em bi}, {\em bj} loop Line 667  Within a {\em bi}, {\em bj} loop
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
# Line 781  The global domain size is again ninety g Line 793  The global domain size is again ninety g
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 (
# Line 817  by the application code. The startup cal Line 829  by the application code. The startup cal
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  
# Line 845  WRAPPER is shown in figure \ref{fig:wrap Line 858  WRAPPER is shown in figure \ref{fig:wrap
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()}.
# Line 927  File: {\em eesupp/inc/MAIN\_PDIRECTIVES1 Line 941  File: {\em eesupp/inc/MAIN\_PDIRECTIVES1
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}\\
# Line 966  critical communication. However, in orde Line 980  critical communication. However, in orde
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  \fbox{  script, which generates the Makefile for compiling and linking MITgcm.
988  \begin{minipage}{4.75in}  (Previously this was done by setting the {\em ALLOW\_USE\_MPI} and
989  File: {\em eesupp/inc/CPP\_EEOPTIONS.h}\\  {\em ALWAYS\_USE\_MPI} flags in the {\em CPP\_EEOPTIONS.h} file.)  More
990  CPP:  {\em ALLOW\_USE\_MPI}\\  detailed information about the use of {\em genmake2} for specifying
991  CPP:  {\em ALWAYS\_USE\_MPI}\\  local compiler flags is located in section \ref{sect:genmake}.\\  
 Parameter:  {\em nPx}\\  
 Parameter:  {\em nPy}  
 \end{minipage}  
 } \\  
992    
 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
# Line 1022  product of the processor grid settings o Line 1012  product of the processor grid settings o
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{
# Line 1073  to processor identification are are used Line 1063  to processor identification are are used
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{
# Line 1107  operations and that can be customized fo Line 1102  operations and that can be customized fo
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.
# Line 1133  of the WRAPPER exchange primitive Line 1131  of the WRAPPER exchange primitive
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}
# Line 1269  The \_EXCH operation is also central to Line 1273  The \_EXCH operation is also central to
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
# Line 1286  operations. However, the routine argumen Line 1292  operations. However, the routine argumen
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
# Line 1390  a series of template files, for example Line 1397  a series of template files, for example
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
# Line 1424  sequence shown in section \ref{sect:call Line 1431  sequence shown in section \ref{sect:call
1431    
1432  WRAPPER layer.  WRAPPER layer.
1433    
1434    {\footnotesize
1435  \begin{verbatim}  \begin{verbatim}
1436    
1437         MAIN           MAIN  
# Line 1451  WRAPPER layer. Line 1459  WRAPPER layer.
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
# Line 1792  C    |-COMM_STATS     :: Summarise inter Line 1802  C    |-COMM_STATS     :: Summarise inter
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    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.22