/[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.1 by cnh, Tue Oct 9 10:33:17 2001 UTC revision 1.8 by heimbach, Wed Apr 24 09:00:53 2002 UTC
# Line 1  Line 1 
1    % $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 Chapters
8    \ref{chap:tutorialI}, \ref{chap:tutorialII} and \ref{chap: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    
# Line 11  Broadly, the goals of the software archi Line 22  Broadly, the goals of the software archi
22  three-fold  three-fold
23    
24  \begin{itemize}  \begin{itemize}
   
25  \item We wish to be able to study a very broad range  \item We wish to be able to study a very broad range
26  of interesting and challenging rotating fluids problems.  of interesting and challenging rotating fluids problems.
   
27  \item We wish the model code to be readily targeted to  \item We wish the model code to be readily targeted to
28  a wide range of platforms  a wide range of platforms
   
29  \item On any given platform we would like to be  \item On any given platform we would like to be
30  able to achieve performance comparable to an implementation  able to achieve performance comparable to an implementation
31  developed and specialized specifically for that platform.  developed and specialized specifically for that platform.
   
32  \end{itemize}  \end{itemize}
33    
34  These points are summarized in figure \ref{fig:mitgcm_architecture_goals}  These points are summarized in figure \ref{fig:mitgcm_architecture_goals}
# Line 30  a software architecture which at the hig Line 37  a software architecture which at the hig
37  of  of
38    
39  \begin{enumerate}  \begin{enumerate}
   
40  \item A core set of numerical and support code. This is discussed in detail in  \item A core set of numerical and support code. This is discussed in detail in
41  section \ref{sec:partII}.  section \ref{sect:partII}.
   
42  \item A scheme for supporting optional "pluggable" {\bf packages} (containing  \item A scheme for supporting optional "pluggable" {\bf packages} (containing
43  for example mixed-layer schemes, biogeochemical schemes, atmospheric physics).  for example mixed-layer schemes, biogeochemical schemes, atmospheric physics).
44  These packages are used both to overlay alternate dynamics and to introduce  These packages are used both to overlay alternate dynamics and to introduce
45  specialized physical content onto the core numerical code. An overview of  specialized physical content onto the core numerical code. An overview of
46  the {\bf package} scheme is given at the start of part \ref{part:packages}.  the {\bf package} scheme is given at the start of part \ref{part:packages}.
   
   
47  \item A support framework called {\bf WRAPPER} (Wrappable Application Parallel  \item A support framework called {\bf WRAPPER} (Wrappable Application Parallel
48  Programming Environment Resource), within which the core numerics and pluggable  Programming Environment Resource), within which the core numerics and pluggable
49  packages operate.  packages operate.
   
50  \end{enumerate}  \end{enumerate}
51    
52  This chapter focuses on describing the {\bf WRAPPER} environment under which  This chapter focuses on describing the {\bf WRAPPER} environment under which
53  both the core numerics and the pluggable packages function. The description  both the core numerics and the pluggable packages function. The description
54  presented here is intended to be a detailed exposistion and contains significant  presented here is intended to be a detailed exposition and contains significant
55  background material, as well as advanced details on working with the WRAPPER.  background material, as well as advanced details on working with the WRAPPER.
56  The examples section of this manual (part \ref{part:example}) contains more  The examples section of this manual (part \ref{part:example}) contains more
57  succinct, step-by-step instructions on running basic numerical  succinct, step-by-step instructions on running basic numerical
# Line 57  experiments both sequentially and in par Line 59  experiments both sequentially and in par
59  starting from an example code and adapting it to suit a particular situation  starting from an example code and adapting it to suit a particular situation
60  will be all that is required.  will be all that is required.
61    
62    
63  \begin{figure}  \begin{figure}
64  \begin{center}  \begin{center}
65   \resizebox{!}{2.5in}{  \resizebox{!}{2.5in}{\includegraphics{part4/mitgcm_goals.eps}}
   \includegraphics*[1.5in,2.4in][9.5in,6.3in]{part4/mitgcm_goals.eps}  
  }  
66  \end{center}  \end{center}
67  \caption{The MITgcm architecture is designed to allow simulation of a wide  \caption{
68    The MITgcm architecture is designed to allow simulation of a wide
69  range of physical problems on a wide range of hardware. The computational  range of physical problems on a wide range of hardware. The computational
70  resource requirements of the applications targeted range from around  resource requirements of the applications targeted range from around
71  $10^7$ bytes ( $\approx 10$ megabytes ) of memory to $10^{11}$ bytes  $10^7$ bytes ( $\approx 10$ megabytes ) of memory to $10^{11}$ bytes
72  ( $\approx 100$ gigabytes). Arithmetic operation counts for the applications of  ( $\approx 100$ gigabytes). Arithmetic operation counts for the applications of
73  interest range from $10^{9}$ floating point operations to more than $10^{17}$  interest range from $10^{9}$ floating point operations to more than $10^{17}$
74  floating point operations.} \label{fig:mitgcm_architecture_goals}  floating point operations.}
75    \label{fig:mitgcm_architecture_goals}
76  \end{figure}  \end{figure}
77    
78  \section{WRAPPER}  \section{WRAPPER}
# Line 81  Environment Resource). All numerical and Line 84  Environment Resource). All numerical and
84  to ``fit'' within the WRAPPER infrastructure. Writing code to ``fit'' within  to ``fit'' within the WRAPPER infrastructure. Writing code to ``fit'' within
85  the WRAPPER means that coding has to follow certain, relatively  the WRAPPER means that coding has to follow certain, relatively
86  straightforward, rules and conventions ( these are discussed further in  straightforward, rules and conventions ( these are discussed further in
87  section \ref{sec:specifying_a_decomposition} ).  section \ref{sect:specifying_a_decomposition} ).
88    
89  The approach taken by the WRAPPER is illustrated in figure  The approach taken by the WRAPPER is illustrated in figure
90  \ref{fig:fit_in_wrapper} which shows how the WRAPPER serves to insulate code  \ref{fig:fit_in_wrapper} which shows how the WRAPPER serves to insulate code
91  that fits within it from architectural differences between hardware platforms  that fits within it from architectural differences between hardware platforms
92  and operating systems. This allows numerical code to be easily retargetted.  and operating systems. This allows numerical code to be easily retargetted.
93    
94    
95  \begin{figure}  \begin{figure}
96  \begin{center}  \begin{center}
97   \resizebox{6in}{4.5in}{  \resizebox{!}{4.5in}{\includegraphics{part4/fit_in_wrapper.eps}}
   \includegraphics*[0.6in,0.7in][9.0in,8.5in]{part4/fit_in_wrapper.eps}  
  }  
98  \end{center}  \end{center}
99  \caption{ Numerical code is written too fit within a software support  \caption{
100    Numerical code is written too fit within a software support
101  infrastructure called WRAPPER. The WRAPPER is portable and  infrastructure called WRAPPER. The WRAPPER is portable and
102  can be sepcialized for a wide range of specific target hardware and  can be specialized for a wide range of specific target hardware and
103  programming environments, without impacting numerical code that fits  programming environments, without impacting numerical code that fits
104  within the WRAPPER. Codes that fit within the WRAPPER can generally be  within the WRAPPER. Codes that fit within the WRAPPER can generally be
105  made to run as fast on a particular platform as codes specially  made to run as fast on a particular platform as codes specially
106  optimized for that platform.  optimized for that platform.}
107  } \label{fig:fit_in_wrapper}  \label{fig:fit_in_wrapper}
108  \end{figure}  \end{figure}
109    
110  \subsection{Target hardware}  \subsection{Target hardware}
111  \label{sec:target_hardware}  \label{sect:target_hardware}
112    
113  The WRAPPER is designed to target as broad as possible a range of computer  The WRAPPER is designed to target as broad as possible a range of computer
114  systems. The original development of the WRAPPER took place on a  systems. The original development of the WRAPPER took place on a
# Line 124  native optimizations for a particular sy Line 128  native optimizations for a particular sy
128    
129  \subsection{Supporting hardware neutrality}  \subsection{Supporting hardware neutrality}
130    
131  The different systems listed in section \ref{sec:target_hardware} can be  The different systems listed in section \ref{sect:target_hardware} can be
132  categorized in many different ways. For example, one common distinction is  categorized in many different ways. For example, one common distinction is
133  between shared-memory parallel systems (SMP's, PVP's) and distributed memory  between shared-memory parallel systems (SMP's, PVP's) and distributed memory
134  parallel systems (for example x86 clusters and large MPP systems). This is one  parallel systems (for example x86 clusters and large MPP systems). This is one
# Line 142  particular machine (for example an IBM S Line 146  particular machine (for example an IBM S
146  class of machines (for example Parallel Vector Processor Systems). Instead the  class of machines (for example Parallel Vector Processor Systems). Instead the
147  WRAPPER provides applications with an  WRAPPER provides applications with an
148  abstract {\it machine model}. The machine model is very general, however, it can  abstract {\it machine model}. The machine model is very general, however, it can
149  easily be specialized to fit, in a computationally effificent manner, any  easily be specialized to fit, in a computationally efficient manner, any
150  computer architecture currently available to the scientific computing community.  computer architecture currently available to the scientific computing community.
151    
152  \subsection{Machine model parallelism}  \subsection{Machine model parallelism}
153    
154   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
155  consist of one or more logical processors that can compute concurrently.    consist of one or more logical processors that can compute concurrently.  
156  Computational work is divided amongst the logical  Computational work is divided among the logical
157  processors by allocating ``ownership'' to  processors by allocating ``ownership'' to
158  each processor of a certain set (or sets) of calculations. Each set of  each processor of a certain set (or sets) of calculations. Each set of
159  calculations owned by a particular processor is associated with a specific  calculations owned by a particular processor is associated with a specific
# Line 172  Computationally, associated with each re Line 176  Computationally, associated with each re
176  space allocated to a particular logical processor, there will be data  space allocated to a particular logical processor, there will be data
177  structures (arrays, scalar variables etc...) that hold the simulated state of  structures (arrays, scalar variables etc...) that hold the simulated state of
178  that region. We refer to these data structures as being {\bf owned} by the  that region. We refer to these data structures as being {\bf owned} by the
179  pprocessor to which their  processor to which their
180  associated region of physical space has been allocated. Individual  associated region of physical space has been allocated. Individual
181  regions that are allocated to processors are called {\bf tiles}. A  regions that are allocated to processors are called {\bf tiles}. A
182  processor can own more  processor can own more
# Line 186  independently of the other tiles, in a s Line 190  independently of the other tiles, in a s
190    
191  \begin{figure}  \begin{figure}
192  \begin{center}  \begin{center}
193   \resizebox{7in}{3in}{   \resizebox{5in}{!}{
194    \includegraphics*[0.5in,2.7in][12.5in,6.4in]{part4/domain_decomp.eps}    \includegraphics{part4/domain_decomp.eps}
195   }   }
196  \end{center}  \end{center}
197  \caption{ The WRAPPER provides support for one and two dimensional  \caption{ The WRAPPER provides support for one and two dimensional
# Line 217  computational phases a processor will re Line 221  computational phases a processor will re
221  whenever it requires values that outside the domain it owns. Periodically  whenever it requires values that outside the domain it owns. Periodically
222  processors will make calls to WRAPPER functions to communicate data between  processors will make calls to WRAPPER functions to communicate data between
223  tiles, in order to keep the overlap regions up to date (see section  tiles, in order to keep the overlap regions up to date (see section
224  \ref{sec:communication_primitives}). The WRAPPER functions can use a  \ref{sect:communication_primitives}). The WRAPPER functions can use a
225  variety of different mechanisms to communicate data between tiles.  variety of different mechanisms to communicate data between tiles.
226    
227  \begin{figure}  \begin{figure}
228  \begin{center}  \begin{center}
229   \resizebox{7in}{3in}{   \resizebox{5in}{!}{
230    \includegraphics*[4.5in,3.7in][12.5in,6.7in]{part4/tiled-world.eps}    \includegraphics{part4/tiled-world.eps}
231   }   }
232  \end{center}  \end{center}
233  \caption{ A global grid subdivided into tiles.  \caption{ A global grid subdivided into tiles.
# Line 304  value to be communicated between CPU's. Line 308  value to be communicated between CPU's.
308  \end{figure}  \end{figure}
309    
310  \subsection{Shared memory communication}  \subsection{Shared memory communication}
311  \label{sec:shared_memory_communication}  \label{sect:shared_memory_communication}
312    
313  Under shared communication independent CPU's are operating  Under shared communication independent CPU's are operating
314  on the exact same global address space at the application level.  on the exact same global address space at the application level.
# Line 330  the systems main-memory interconnect. Th Line 334  the systems main-memory interconnect. Th
334  communication very efficient provided it is used appropriately.  communication very efficient provided it is used appropriately.
335    
336  \subsubsection{Memory consistency}  \subsubsection{Memory consistency}
337  \label{sec:memory_consistency}  \label{sect:memory_consistency}
338    
339  When using shared memory communication between  When using shared memory communication between
340  multiple processors the WRAPPER level shields user applications from  multiple processors the WRAPPER level shields user applications from
# Line 354  memory, the WRAPPER provides a place to Line 358  memory, the WRAPPER provides a place to
358  ensure memory consistency for a particular platform.  ensure memory consistency for a particular platform.
359    
360  \subsubsection{Cache effects and false sharing}  \subsubsection{Cache effects and false sharing}
361  \label{sec:cache_effects_and_false_sharing}  \label{sect:cache_effects_and_false_sharing}
362    
363  Shared-memory machines often have local to processor memory caches  Shared-memory machines often have local to processor memory caches
364  which contain mirrored copies of main memory. Automatic cache-coherence  which contain mirrored copies of main memory. Automatic cache-coherence
# Line 373  in an application are potentially visibl Line 377  in an application are potentially visibl
377  threads operating within a single process is the standard mechanism for  threads operating within a single process is the standard mechanism for
378  supporting shared memory that the WRAPPER utilizes. Configuring and launching  supporting shared memory that the WRAPPER utilizes. Configuring and launching
379  code to run in multi-threaded mode on specific platforms is discussed in  code to run in multi-threaded mode on specific platforms is discussed in
380  section \ref{sec:running_with_threads}.  However, on many systems, potentially  section \ref{sect:running_with_threads}.  However, on many systems, potentially
381  very efficient mechanisms for using shared memory communication between  very efficient mechanisms for using shared memory communication between
382  multiple processes (in contrast to multiple threads within a single  multiple processes (in contrast to multiple threads within a single
383  process) also exist. In most cases this works by making a limited region of  process) also exist. In most cases this works by making a limited region of
# Line 386  distributed with the default WRAPPER sou Line 390  distributed with the default WRAPPER sou
390  nature.  nature.
391    
392  \subsection{Distributed memory communication}  \subsection{Distributed memory communication}
393  \label{sec:distributed_memory_communication}  \label{sect:distributed_memory_communication}
394  Many parallel systems are not constructed in a way where it is  Many parallel systems are not constructed in a way where it is
395  possible or practical for an application to use shared memory  possible or practical for an application to use shared memory
396  for communication. For example cluster systems consist of individual computers  for communication. For example cluster systems consist of individual computers
# Line 400  described in \ref{hoe-hill:99} substitut Line 404  described in \ref{hoe-hill:99} substitut
404  highly optimized library.  highly optimized library.
405    
406  \subsection{Communication primitives}  \subsection{Communication primitives}
407  \label{sec:communication_primitives}  \label{sect:communication_primitives}
408    
409  \begin{figure}  \begin{figure}
410  \begin{center}  \begin{center}
411   \resizebox{5in}{3in}{   \resizebox{5in}{!}{
412    \includegraphics*[1.5in,0.7in][7.9in,4.4in]{part4/comm-primm.eps}    \includegraphics{part4/comm-primm.eps}
413   }   }
414  \end{center}  \end{center}
415  \caption{Three performance critical parallel primititives are provided  \caption{Three performance critical parallel primitives are provided
416  by the WRAPPER. These primititives are always used to communicate data  by the WRAPPER. These primitives are always used to communicate data
417  between tiles. The figure shows four tiles. The curved arrows indicate  between tiles. The figure shows four tiles. The curved arrows indicate
418  exchange primitives which transfer data between the overlap regions at tile  exchange primitives which transfer data between the overlap regions at tile
419  edges and interior regions for nearest-neighbor tiles.  edges and interior regions for nearest-neighbor tiles.
# Line 485  sub-domains. Line 489  sub-domains.
489    
490  \begin{figure}  \begin{figure}
491  \begin{center}  \begin{center}
492   \resizebox{5in}{3in}{   \resizebox{5in}{!}{
493    \includegraphics*[0.5in,1.3in][7.9in,5.7in]{part4/tiling_detail.eps}    \includegraphics{part4/tiling_detail.eps}
494   }   }
495  \end{center}  \end{center}
496  \caption{The tiling strategy that the WRAPPER supports allows tiles  \caption{The tiling strategy that the WRAPPER supports allows tiles
# Line 544  WRAPPER are Line 548  WRAPPER are
548  computing CPU's.  computing CPU's.
549  \end{enumerate}  \end{enumerate}
550  This section describes the details of each of these operations.  This section describes the details of each of these operations.
551  Section \ref{sec:specifying_a_decomposition} explains how the way in which  Section \ref{sect:specifying_a_decomposition} explains how the way in which
552  a domain is decomposed (or composed) is expressed. Section  a domain is decomposed (or composed) is expressed. Section
553  \ref{sec:starting_a_code} describes practical details of running codes  \ref{sect:starting_a_code} describes practical details of running codes
554  in various different parallel modes on contemporary computer systems.  in various different parallel modes on contemporary computer systems.
555  Section \ref{sec:controlling_communication} explains the internal information  Section \ref{sect:controlling_communication} explains the internal information
556  that the WRAPPER uses to control how information is communicated between  that the WRAPPER uses to control how information is communicated between
557  tiles.  tiles.
558    
559  \subsection{Specifying a domain decomposition}  \subsection{Specifying a domain decomposition}
560  \label{sec:specifying_a_decomposition}  \label{sect:specifying_a_decomposition}
561    
562  At its heart much of the WRAPPER works only in terms of a collection of tiles  At its heart much of the WRAPPER works only in terms of a collection of tiles
563  which are interconnected to each other. This is also true of application  which are interconnected to each other. This is also true of application
# Line 589  not cause any other problems. Line 593  not cause any other problems.
593    
594  \begin{figure}  \begin{figure}
595  \begin{center}  \begin{center}
596   \resizebox{5in}{7in}{   \resizebox{5in}{!}{
597    \includegraphics*[0.5in,0.3in][7.9in,10.7in]{part4/size_h.eps}    \includegraphics{part4/size_h.eps}
598   }   }
599  \end{center}  \end{center}
600  \caption{ The three level domain decomposition hierarchy employed by the  \caption{ The three level domain decomposition hierarchy employed by the
# Line 605  be created within a single process. Each Line 609  be created within a single process. Each
609  dimensions of {\em sNx} and {\em sNy}. If, when the code is executed, these tiles are  dimensions of {\em sNx} and {\em sNy}. If, when the code is executed, these tiles are
610  allocated to different threads of a process that are then bound to  allocated to different threads of a process that are then bound to
611  different physical processors ( see the multi-threaded  different physical processors ( see the multi-threaded
612  execution discussion in section \ref{sec:starting_the_code} ) then  execution discussion in section \ref{sect:starting_the_code} ) then
613  computation will be performed concurrently on each tile. However, it is also  computation will be performed concurrently on each tile. However, it is also
614  possible to run the same decomposition within a process running a single thread on  possible to run the same decomposition within a process running a single thread on
615  a single processor. In this case the tiles will be computed over sequentially.  a single processor. In this case the tiles will be computed over sequentially.
# Line 795  thirty-two grid points, and x and y over Line 799  thirty-two grid points, and x and y over
799  There are six tiles allocated to six separate logical processors ({\em nSx=6}).  There are six tiles allocated to six separate logical processors ({\em nSx=6}).
800  This set of values can be used for a cube sphere calculation.  This set of values can be used for a cube sphere calculation.
801  Each tile of size $32 \times 32$ represents a face of the  Each tile of size $32 \times 32$ represents a face of the
802  cube. Initialising the tile connectivity correctly ( see section  cube. Initializing the tile connectivity correctly ( see section
803  \ref{sec:cube_sphere_communication}. allows the rotations associated with  \ref{sect:cube_sphere_communication}. allows the rotations associated with
804  moving between the six cube faces to be embedded within the  moving between the six cube faces to be embedded within the
805  tile-tile communication code.  tile-tile communication code.
806  \end{enumerate}  \end{enumerate}
807    
808    
809  \subsection{Starting the code}  \subsection{Starting the code}
810  \label{sec:starting_the_code}  \label{sect:starting_the_code}
811  When code is started under the WRAPPER, execution begins in a main routine {\em  When code is started under the WRAPPER, execution begins in a main routine {\em
812  eesupp/src/main.F} that is owned by the WRAPPER. Control is transferred  eesupp/src/main.F} that is owned by the WRAPPER. Control is transferred
813  to the application through a routine called {\em THE\_MODEL\_MAIN()}  to the application through a routine called {\em THE\_MODEL\_MAIN()}
# Line 812  to support subsequent calls to communica Line 816  to support subsequent calls to communica
816  by the application code. The startup calling sequence followed by the  by the application code. The startup calling sequence followed by the
817  WRAPPER is shown in figure \ref{fig:wrapper_startup}.  WRAPPER is shown in figure \ref{fig:wrapper_startup}.
818    
   
819  \begin{figure}  \begin{figure}
820    {\footnotesize
821  \begin{verbatim}  \begin{verbatim}
822    
823         MAIN           MAIN  
# Line 842  WRAPPER is shown in figure \ref{fig:wrap Line 846  WRAPPER is shown in figure \ref{fig:wrap
846    
847    
848  \end{verbatim}  \end{verbatim}
849    }
850  \caption{Main stages of the WRAPPER startup procedure.  \caption{Main stages of the WRAPPER startup procedure.
851  This process proceeds transfer of control to application code, which  This process proceeds transfer of control to application code, which
852  occurs through the procedure {\em THE\_MODEL\_MAIN()}.  occurs through the procedure {\em THE\_MODEL\_MAIN()}.
# Line 849  occurs through the procedure {\em THE\_M Line 854  occurs through the procedure {\em THE\_M
854  \end{figure}  \end{figure}
855    
856  \subsubsection{Multi-threaded execution}  \subsubsection{Multi-threaded execution}
857    \label{sect:multi-threaded-execution}
858  Prior to transferring control to the procedure {\em THE\_MODEL\_MAIN()} the  Prior to transferring control to the procedure {\em THE\_MODEL\_MAIN()} the
859  WRAPPER may cause several coarse grain threads to be initialized. The routine  WRAPPER may cause several coarse grain threads to be initialized. The routine
860  {\em THE\_MODEL\_MAIN()} is called once for each thread and is passed a single  {\em THE\_MODEL\_MAIN()} is called once for each thread and is passed a single
861  stack argument which is the thread number, stored in the  stack argument which is the thread number, stored in the
862  variable {\em myThid}. In addition to specifying a decomposition with  variable {\em myThid}. In addition to specifying a decomposition with
863  multiple tiles per process ( see section \ref{sec:specifying_a_decomposition})  multiple tiles per process ( see section \ref{sect:specifying_a_decomposition})
864  configuring and starting a code to run using multiple threads requires the following  configuring and starting a code to run using multiple threads requires the following
865  steps.\\  steps.\\
866    
# Line 904  parallelization the compiler may otherwi Line 910  parallelization the compiler may otherwi
910  \end{enumerate}  \end{enumerate}
911    
912    
 \paragraph{Environment variables}  
 On most systems multi-threaded execution also requires the setting  
 of a special environment variable. On many machines this variable  
 is called PARALLEL and its values should be set to the number  
 of parallel threads required. Generally the help pages associated  
 with the multi-threaded compiler on a machine will explain  
 how to set the required environment variables for that machines.  
   
 \paragraph{Runtime input parameters}  
 Finally the file {\em eedata} needs to be configured to indicate  
 the number of threads to be used in the x and y directions.  
 The variables {\em nTx} and {\em nTy} in this file are used to  
 specify the information required. The product of {\em nTx} and  
 {\em nTy} must be equal to the number of threads spawned i.e.  
 the setting of the environment variable PARALLEL.  
 The value of {\em nTx} must subdivide the number of sub-domains  
 in x ({\em nSx}) exactly. The value of {\em nTy} must subdivide the  
 number of sub-domains in y ({\em nSy}) exactly.  
   
913  An example of valid settings for the {\em eedata} file for a  An example of valid settings for the {\em eedata} file for a
914  domain with two subdomains in y and running with two threads is shown  domain with two subdomains in y and running with two threads is shown
915  below  below
# Line 955  Parameter:  {\em nTy} Line 942  Parameter:  {\em nTy}
942  } \\  } \\
943    
944  \subsubsection{Multi-process execution}  \subsubsection{Multi-process execution}
945    \label{sect:multi-process-execution}
946    
947  Despite its appealing programming model, multi-threaded execution remains  Despite its appealing programming model, multi-threaded execution remains
948  less common then multi-process execution. One major reason for this  less common then multi-process execution. One major reason for this
# Line 966  models varies between systems. Line 954  models varies between systems.
954    
955  Multi-process execution is more ubiquitous.  Multi-process execution is more ubiquitous.
956  In order to run code in a multi-process configuration a decomposition  In order to run code in a multi-process configuration a decomposition
957  specification is given ( in which the at least one of the  specification ( see section \ref{sect:specifying_a_decomposition})
958    is given ( in which the at least one of the
959  parameters {\em nPx} or {\em nPy} will be greater than one)  parameters {\em nPx} or {\em nPy} will be greater than one)
960  and then, as for multi-threaded operation,  and then, as for multi-threaded operation,
961  appropriate compile time and run time steps must be taken.  appropriate compile time and run time steps must be taken.
# Line 1029  using a command such as Line 1018  using a command such as
1018  \begin{verbatim}  \begin{verbatim}
1019  mpirun -np 64 -machinefile mf ./mitgcmuv  mpirun -np 64 -machinefile mf ./mitgcmuv
1020  \end{verbatim}  \end{verbatim}
1021  In this example the text {\em -np 64} specifices the number of processes  In this example the text {\em -np 64} specifies the number of processes
1022  that will be created. The numeric value {\em 64} must be equal to the  that will be created. The numeric value {\em 64} must be equal to the
1023  product of the processor grid settings of {\em nPx} and {\em nPy}  product of the processor grid settings of {\em nPx} and {\em nPy}
1024  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
# Line 1046  Parameter: {\em nPy} Line 1035  Parameter: {\em nPy}
1035  \end{minipage}  \end{minipage}
1036  } \\  } \\
1037    
1038    
1039    \paragraph{Environment variables}
1040    On most systems multi-threaded execution also requires the setting
1041    of a special environment variable. On many machines this variable
1042    is called PARALLEL and its values should be set to the number
1043    of parallel threads required. Generally the help pages associated
1044    with the multi-threaded compiler on a machine will explain
1045    how to set the required environment variables for that machines.
1046    
1047    \paragraph{Runtime input parameters}
1048    Finally the file {\em eedata} needs to be configured to indicate
1049    the number of threads to be used in the x and y directions.
1050    The variables {\em nTx} and {\em nTy} in this file are used to
1051    specify the information required. The product of {\em nTx} and
1052    {\em nTy} must be equal to the number of threads spawned i.e.
1053    the setting of the environment variable PARALLEL.
1054    The value of {\em nTx} must subdivide the number of sub-domains
1055    in x ({\em nSx}) exactly. The value of {\em nTy} must subdivide the
1056    number of sub-domains in y ({\em nSy}) exactly.
1057  The multiprocess startup of the MITgcm executable {\em mitgcmuv}  The multiprocess startup of the MITgcm executable {\em mitgcmuv}
1058  is controlled by the routines {\em EEBOOT\_MINIMAL()} and  is controlled by the routines {\em EEBOOT\_MINIMAL()} and
1059  {\em INI\_PROCS()}. The first routine performs basic steps required  {\em INI\_PROCS()}. The first routine performs basic steps required
# Line 1058  number so that process number 0 will cre Line 1066  number so that process number 0 will cre
1066  output files {\bf STDOUT.0001} and {\bf STDERR.0001} etc... These files  output files {\bf STDOUT.0001} and {\bf STDERR.0001} etc... These files
1067  are used for reporting status and configuration information and  are used for reporting status and configuration information and
1068  for reporting error conditions on a process by process basis.  for reporting error conditions on a process by process basis.
1069  The {{\em EEBOOT\_MINIMAL()} procedure also sets the variables  The {\em EEBOOT\_MINIMAL()} procedure also sets the variables
1070  {\em myProcId} and {\em MPI\_COMM\_MODEL}.  {\em myProcId} and {\em MPI\_COMM\_MODEL}.
1071  These variables are related  These variables are related
1072  to processor identification are are used later in the routine  to processor identification are are used later in the routine
# Line 1099  Parameter: {\em pidN       } Line 1107  Parameter: {\em pidN       }
1107  The WRAPPER maintains internal information that is used for communication  The WRAPPER maintains internal information that is used for communication
1108  operations and that can be customized for different platforms. This section  operations and that can be customized for different platforms. This section
1109  describes the information that is held and used.  describes the information that is held and used.
1110    
1111  \begin{enumerate}  \begin{enumerate}
1112  \item {\bf Tile-tile connectivity information} For each tile the WRAPPER  \item {\bf Tile-tile connectivity information} For each tile the WRAPPER
1113  sets a flag that sets the tile number to the north, south, east and  sets a flag that sets the tile number to the north, south, east and
# Line 1112  This information is held in the variable Line 1121  This information is held in the variable
1121  This latter set of variables can take one of the following values  This latter set of variables can take one of the following values
1122  {\em COMM\_NONE}, {\em COMM\_MSG}, {\em COMM\_PUT} and {\em COMM\_GET}.  {\em COMM\_NONE}, {\em COMM\_MSG}, {\em COMM\_PUT} and {\em COMM\_GET}.
1123  A value of {\em COMM\_NONE} is used to indicate that a tile has no  A value of {\em COMM\_NONE} is used to indicate that a tile has no
1124  neighbor to cummnicate with on a particular face. A value  neighbor to communicate with on a particular face. A value
1125  of {\em COMM\_MSG} is used to indicated that some form of distributed  of {\em COMM\_MSG} is used to indicated that some form of distributed
1126  memory communication is required to communicate between  memory communication is required to communicate between
1127  these tile faces ( see section \ref{sec:distributed_memory_communication}).  these tile faces ( see section \ref{sect:distributed_memory_communication}).
1128  A value of {\em COMM\_PUT} or {\em COMM\_GET} is used to indicate  A value of {\em COMM\_PUT} or {\em COMM\_GET} is used to indicate
1129  forms of shared memory communication ( see section  forms of shared memory communication ( see section
1130  \ref{sec:shared_memory_communication}). The {\em COMM\_PUT} value indicates  \ref{sect:shared_memory_communication}). The {\em COMM\_PUT} value indicates
1131  that a CPU should communicate by writing to data structures owned by another  that a CPU should communicate by writing to data structures owned by another
1132  CPU. A {\em COMM\_GET} value indicates that a CPU should communicate by reading  CPU. A {\em COMM\_GET} value indicates that a CPU should communicate by reading
1133  from data structures owned by another CPU. These flags affect the behavior  from data structures owned by another CPU. These flags affect the behavior
# Line 1169  the product of the parameters {\em nTx} Line 1178  the product of the parameters {\em nTx}
1178  are read from the file {\em eedata}. If the value of {\em nThreads}  are read from the file {\em eedata}. If the value of {\em nThreads}
1179  is inconsistent with the number of threads requested from the  is inconsistent with the number of threads requested from the
1180  operating system (for example by using an environment  operating system (for example by using an environment
1181  varialble as described in section \ref{sec:multi_threaded_execution})  variable as described in section \ref{sect:multi_threaded_execution})
1182  then usually an error will be reported by the routine  then usually an error will be reported by the routine
1183  {\em CHECK\_THREADS}.\\  {\em CHECK\_THREADS}.\\
1184    
# Line 1186  Parameter: {\em nTy} \\ Line 1195  Parameter: {\em nTy} \\
1195  \end{minipage}  \end{minipage}
1196  }  }
1197    
 \begin{figure}  
 \begin{verbatim}  
 C--  
 C--  Parallel directives for MIPS Pro Fortran compiler  
 C--  
 C      Parallel compiler directives for SGI with IRIX  
 C$PAR  PARALLEL DO  
 C$PAR&  CHUNK=1,MP_SCHEDTYPE=INTERLEAVE,  
 C$PAR&  SHARE(nThreads),LOCAL(myThid,I)  
 C  
       DO I=1,nThreads  
         myThid = I  
   
 C--     Invoke nThreads instances of the numerical model  
         CALL THE_MODEL_MAIN(myThid)  
   
       ENDDO  
 \end{verbatim}  
 \caption{Prior to transferring control to  
 the procedure {\em THE\_MODEL\_MAIN()} the WRAPPER may use  
 MP directives to spawn multiple threads.  
 } \label{fig:mp_directives}  
 \end{figure}  
   
   
1198  \item {\bf memsync flags}  \item {\bf memsync flags}
1199  As discussed in section \ref{sec:memory_consistency}, when using shared memory,  As discussed in section \ref{sect:memory_consistency}, when using shared memory,
1200  a low-level system function may be need to force memory consistency.  a low-level system function may be need to force memory consistency.
1201  The routine {\em MEMSYNC()} is used for this purpose. This routine should  The routine {\em MEMSYNC()} is used for this purpose. This routine should
1202  not need modifying and the information below is only provided for  not need modifying and the information below is only provided for
# Line 1228  For an Ultra Sparc system the following Line 1212  For an Ultra Sparc system the following
1212  \begin{verbatim}  \begin{verbatim}
1213  asm("membar #LoadStore|#StoreStore");  asm("membar #LoadStore|#StoreStore");
1214  \end{verbatim}  \end{verbatim}
1215  for an Alpha based sytem the euivalent code reads  for an Alpha based system the equivalent code reads
1216  \begin{verbatim}  \begin{verbatim}
1217  asm("mb");  asm("mb");
1218  \end{verbatim}  \end{verbatim}
# Line 1238  asm("lock; addl $0,0(%%esp)": : :"memory Line 1222  asm("lock; addl $0,0(%%esp)": : :"memory
1222  \end{verbatim}  \end{verbatim}
1223    
1224  \item {\bf Cache line size}  \item {\bf Cache line size}
1225  As discussed in section \ref{sec:cache_effects_and_false_sharing},  As discussed in section \ref{sect:cache_effects_and_false_sharing},
1226  milti-threaded codes explicitly avoid penalties associated with excessive  milti-threaded codes explicitly avoid penalties associated with excessive
1227  coherence traffic on an SMP system. To do this the sgared memory data structures  coherence traffic on an SMP system. To do this the shared memory data structures
1228  used by the {\em GLOBAL\_SUM}, {\em GLOBAL\_MAX} and {\em BARRIER} routines  used by the {\em GLOBAL\_SUM}, {\em GLOBAL\_MAX} and {\em BARRIER} routines
1229  are padded. The variables that control the padding are set in the  are padded. The variables that control the padding are set in the
1230  header file {\em EEPARAMS.h}. These variables are called  header file {\em EEPARAMS.h}. These variables are called
# Line 1248  header file {\em EEPARAMS.h}. These vari Line 1232  header file {\em EEPARAMS.h}. These vari
1232  {\em lShare8}. The default values should not normally need changing.  {\em lShare8}. The default values should not normally need changing.
1233  \item {\bf \_BARRIER}  \item {\bf \_BARRIER}
1234  This is a CPP macro that is expanded to a call to a routine  This is a CPP macro that is expanded to a call to a routine
1235  which synchronises all the logical processors running under the  which synchronizes all the logical processors running under the
1236  WRAPPER. Using a macro here preserves flexibility to insert  WRAPPER. Using a macro here preserves flexibility to insert
1237  a specialized call in-line into application code. By default this  a specialized call in-line into application code. By default this
1238  resolves to calling the procedure {\em BARRIER()}. The default  resolves to calling the procedure {\em BARRIER()}. The default
# Line 1256  setting for the \_BARRIER macro is given Line 1240  setting for the \_BARRIER macro is given
1240    
1241  \item {\bf \_GSUM}  \item {\bf \_GSUM}
1242  This is a CPP macro that is expanded to a call to a routine  This is a CPP macro that is expanded to a call to a routine
1243  which sums up a floating point numner  which sums up a floating point number
1244  over all the logical processors running under the  over all the logical processors running under the
1245  WRAPPER. Using a macro here provides extra flexibility to insert  WRAPPER. Using a macro here provides extra flexibility to insert
1246  a specialized call in-line into application code. By default this  a specialized call in-line into application code. By default this
1247  resolves to calling the procedure {\em GLOBAL\_SOM\_R8()} ( for  resolves to calling the procedure {\em GLOBAL\_SUM\_R8()} ( for
1248  84=bit floating point operands)  64-bit floating point operands)
1249  or {\em GLOBAL\_SOM\_R4()} (for 32-bit floating point operands). The default  or {\em GLOBAL\_SUM\_R4()} (for 32-bit floating point operands). The default
1250  setting for the \_GSUM macro is given in the file {\em CPP\_EEMACROS.h}.  setting for the \_GSUM macro is given in the file {\em CPP\_EEMACROS.h}.
1251  The \_GSUM macro is a performance critical operation, especially for  The \_GSUM macro is a performance critical operation, especially for
1252  large processor count, small tile size configurations.  large processor count, small tile size configurations.
1253  The custom communication example discussed in section \ref{sec:jam_example}  The custom communication example discussed in section \ref{sect:jam_example}
1254  shows how the macro is used to invoke a custom global sum routine  shows how the macro is used to invoke a custom global sum routine
1255  for a specific set of hardware.  for a specific set of hardware.
1256    
# Line 1280  physical fields and whether fields are 3 Line 1264  physical fields and whether fields are 3
1264  in the header file {\em CPP\_EEMACROS.h}. As with \_GSUM, the  in the header file {\em CPP\_EEMACROS.h}. As with \_GSUM, the
1265  \_EXCH operation plays a crucial role in scaling to small tile,  \_EXCH operation plays a crucial role in scaling to small tile,
1266  large logical and physical processor count configurations.  large logical and physical processor count configurations.
1267  The example in section \ref{sec:jam_example} discusses defining an  The example in section \ref{sect:jam_example} discusses defining an
1268  optimised and specialized form on the \_EXCH operation.  optimized and specialized form on the \_EXCH operation.
1269    
1270  The \_EXCH operation is also central to supporting grids such as  The \_EXCH operation is also central to supporting grids such as
1271  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
1272  between tiles. Aligning the coordinate requiring rotation with the  between tiles. Aligning the coordinate requiring rotation with the
1273  tile decomposistion, allows the coordinate transformation to  tile decomposition, allows the coordinate transformation to
1274  be embedded within a custom form of the \_EXCH primitive.  be embedded within a custom form of the \_EXCH primitive.
1275    
1276  \item {\bf Reverse Mode}  \item {\bf Reverse Mode}
1277  The communication primitives \_EXCH and \_GSUM both employ  The communication primitives \_EXCH and \_GSUM both employ
1278  hand-written adjoint forms (or reverse mode) forms.  hand-written adjoint forms (or reverse mode) forms.
1279  These reverse mode forms can be found in the  These reverse mode forms can be found in the
1280  sourc code directory {\em pkg/autodiff}.  source code directory {\em pkg/autodiff}.
1281  For the global sum primitive the reverse mode form  For the global sum primitive the reverse mode form
1282  calls are to {\em GLOBAL\_ADSUM\_R4} and  calls are to {\em GLOBAL\_ADSUM\_R4} and
1283  {\em GLOBAL\_ADSUM\_R8}. The reverse mode form of the  {\em GLOBAL\_ADSUM\_R8}. The reverse mode form of the
1284  exchamge primitives are found in routines  exchange primitives are found in routines
1285  prefixed {\em ADEXCH}. The exchange routines make calls to  prefixed {\em ADEXCH}. The exchange routines make calls to
1286  the same low-level communication primitives as the forward mode  the same low-level communication primitives as the forward mode
1287  operations. However, the routine argument {\em simulationMode}  operations. However, the routine argument {\em simulationMode}
# Line 1309  The variable {\em MAX\_NO\_THREADS} is u Line 1293  The variable {\em MAX\_NO\_THREADS} is u
1293  maximum number of OS threads that a code will use. This  maximum number of OS threads that a code will use. This
1294  value defaults to thirty-two and is set in the file {\em EEPARAMS.h}.  value defaults to thirty-two and is set in the file {\em EEPARAMS.h}.
1295  For single threaded execution it can be reduced to one if required.  For single threaded execution it can be reduced to one if required.
1296  The va;lue is largely private to the WRAPPER and application code  The value; is largely private to the WRAPPER and application code
1297  will nor normally reference the value, except in the following scenario.  will nor normally reference the value, except in the following scenario.
1298    
1299  For certain physical parametrization schemes it is necessary to have  For certain physical parametrization schemes it is necessary to have
# Line 1320  This can be achieved using a Fortran 90 Line 1304  This can be achieved using a Fortran 90
1304  if this might be unavailable then the work arrays can be extended  if this might be unavailable then the work arrays can be extended
1305  with dimensions use the tile dimensioning scheme of {\em nSx}  with dimensions use the tile dimensioning scheme of {\em nSx}
1306  and {\em nSy} ( as described in section  and {\em nSy} ( as described in section
1307  \ref{sec:specifying_a_decomposition}). However, if the configuration  \ref{sect:specifying_a_decomposition}). However, if the configuration
1308  being specified involves many more tiles than OS threads then  being specified involves many more tiles than OS threads then
1309  it can save memory resources to reduce the variable  it can save memory resources to reduce the variable
1310  {\em MAX\_NO\_THREADS} to be equal to the actual number of threads that  {\em MAX\_NO\_THREADS} to be equal to the actual number of threads that
1311  will be used and to declare the physical parameterisation  will be used and to declare the physical parameterization
1312  work arrays with a sinble {\em MAX\_NO\_THREADS} extra dimension.  work arrays with a single {\em MAX\_NO\_THREADS} extra dimension.
1313  An example of this is given in the verification experiment  An example of this is given in the verification experiment
1314  {\em aim.5l\_cs}. Here the default setting of  {\em aim.5l\_cs}. Here the default setting of
1315  {\em MAX\_NO\_THREADS} is altered to  {\em MAX\_NO\_THREADS} is altered to
# Line 1338  created with declarations of the form. Line 1322  created with declarations of the form.
1322  \begin{verbatim}  \begin{verbatim}
1323        common /FORCIN/ sst1(ngp,MAX_NO_THREADS)        common /FORCIN/ sst1(ngp,MAX_NO_THREADS)
1324  \end{verbatim}  \end{verbatim}
1325  This declaration scheme is not used widely, becuase most global data  This declaration scheme is not used widely, because most global data
1326  is used for permanent not temporary storage of state information.  is used for permanent not temporary storage of state information.
1327  In the case of permanent state information this approach cannot be used  In the case of permanent state information this approach cannot be used
1328  because there has to be enough storage allocated for all tiles.  because there has to be enough storage allocated for all tiles.
1329  However, the technique can sometimes be a useful scheme for reducing memory  However, the technique can sometimes be a useful scheme for reducing memory
1330  requirements in complex physical paramterisations.  requirements in complex physical parameterizations.
   
1331  \end{enumerate}  \end{enumerate}
1332    
1333    \begin{figure}
1334    \begin{verbatim}
1335    C--
1336    C--  Parallel directives for MIPS Pro Fortran compiler
1337    C--
1338    C      Parallel compiler directives for SGI with IRIX
1339    C$PAR  PARALLEL DO
1340    C$PAR&  CHUNK=1,MP_SCHEDTYPE=INTERLEAVE,
1341    C$PAR&  SHARE(nThreads),LOCAL(myThid,I)
1342    C
1343          DO I=1,nThreads
1344            myThid = I
1345    
1346    C--     Invoke nThreads instances of the numerical model
1347            CALL THE_MODEL_MAIN(myThid)
1348    
1349          ENDDO
1350    \end{verbatim}
1351    \caption{Prior to transferring control to
1352    the procedure {\em THE\_MODEL\_MAIN()} the WRAPPER may use
1353    MP directives to spawn multiple threads.
1354    } \label{fig:mp_directives}
1355    \end{figure}
1356    
1357    
1358  \subsubsection{Specializing the Communication Code}  \subsubsection{Specializing the Communication Code}
1359    
1360  The isolation of performance critical communication primitives and the  The isolation of performance critical communication primitives and the
1361  sub-division of the simulation domain into tiles is a powerful tool.  sub-division of the simulation domain into tiles is a powerful tool.
1362  Here we show how it can be used to improve application performance and  Here we show how it can be used to improve application performance and
1363  how it can be used to adapt to new gridding approaches.  how it can be used to adapt to new griding approaches.
1364    
1365  \subsubsection{JAM example}  \subsubsection{JAM example}
1366  \label{sec:jam_example}  \label{sect:jam_example}
1367  On some platforms a big performance boost can be obtained by  On some platforms a big performance boost can be obtained by
1368  binding the communication routines {\em \_EXCH} and  binding the communication routines {\em \_EXCH} and
1369  {\em \_GSUM} to specialized native libraries ) fro example the  {\em \_GSUM} to specialized native libraries ) fro example the
# Line 1371  communications library ( see {\em ini\_j Line 1379  communications library ( see {\em ini\_j
1379  \item The {\em \_GSUM} and {\em \_EXCH} macro definitions are replaced  \item The {\em \_GSUM} and {\em \_EXCH} macro definitions are replaced
1380  with calls to custom routines ( see {\em gsum\_jam.F} and {\em exch\_jam.F})  with calls to custom routines ( see {\em gsum\_jam.F} and {\em exch\_jam.F})
1381  \item a highly specialized form of the exchange operator (optimized  \item a highly specialized form of the exchange operator (optimized
1382  for overlap regions of width one) is substitued into the elliptic  for overlap regions of width one) is substituted into the elliptic
1383  solver routine {\em cg2d.F}.  solver routine {\em cg2d.F}.
1384  \end{itemize}  \end{itemize}
1385  Developing specialized code for other libraries follows a similar  Developing specialized code for other libraries follows a similar
1386  pattern.  pattern.
1387    
1388  \subsubsection{Cube sphere communication}  \subsubsection{Cube sphere communication}
1389  \label{sec:cube_sphere_communication}  \label{sect:cube_sphere_communication}
1390  Actual {\em \_EXCH} routine code is generated automatically from  Actual {\em \_EXCH} routine code is generated automatically from
1391  a series of template files, for example {\em exch\_rx.template}.  a series of template files, for example {\em exch\_rx.template}.
1392  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
1393  process to be maintained. One set of variations supports the  process to be maintained. One set of variations supports the
1394  cube sphere grid. Support for a cube sphere gris in MITgcm is based  cube sphere grid. Support for a cube sphere grid in MITgcm is based
1395  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).
1396  The exchage routines are then able to absorb much of the  The exchange routines are then able to absorb much of the
1397  detailed rotation and reorientation required when moving around the  detailed rotation and reorientation required when moving around the
1398  cube grid. The set of {\em \_EXCH} routines that contain the  cube grid. The set of {\em \_EXCH} routines that contain the
1399  word cube in their name perform these transformations.  word cube in their name perform these transformations.
1400  They are invoked when the run-time logical parameter  They are invoked when the run-time logical parameter
1401  {\em useCubedSphereExchange} is set true. To facilitate the  {\em useCubedSphereExchange} is set true. To facilitate the
1402  transformations on a staggered C-grid, exchange operations are defined  transformations on a staggered C-grid, exchange operations are defined
1403  separately for both vector and scalar quantitities and for  separately for both vector and scalar quantities and for
1404  grid-centered and for grid-face and corner quantities.  grid-centered and for grid-face and corner quantities.
1405  Three sets of exchange routines are defined. Routines  Three sets of exchange routines are defined. Routines
1406  with names of the form {\em exch\_rx} are used to exchange  with names of the form {\em exch\_rx} are used to exchange
# Line 1411  quantities at the C-grid vorticity point Line 1419  quantities at the C-grid vorticity point
1419    
1420  Fitting together the WRAPPER elements, package elements and  Fitting together the WRAPPER elements, package elements and
1421  MITgcm core equation elements of the source code produces calling  MITgcm core equation elements of the source code produces calling
1422  sequence shown in section \ref{sec:calling_sequence}  sequence shown in section \ref{sect:calling_sequence}
1423    
1424  \subsection{Annotated call tree for MITgcm and WRAPPER}  \subsection{Annotated call tree for MITgcm and WRAPPER}
1425  \label{sec:calling_sequence}  \label{sect:calling_sequence}
1426    
1427  WRAPPER layer.  WRAPPER layer.
1428    
1429    {\footnotesize
1430  \begin{verbatim}  \begin{verbatim}
1431    
1432         MAIN           MAIN  
# Line 1445  WRAPPER layer. Line 1454  WRAPPER layer.
1454         |--THE_MODEL_MAIN   :: Numerical code top-level driver routine         |--THE_MODEL_MAIN   :: Numerical code top-level driver routine
1455    
1456  \end{verbatim}  \end{verbatim}
1457    }
1458    
1459  Core equations plus packages.  Core equations plus packages.
1460    
1461    {\footnotesize
1462  \begin{verbatim}  \begin{verbatim}
1463  C  C
1464  C  C
# Line 1457  C  : Line 1468  C  :
1468  C  |  C  |
1469  C  |-THE_MODEL_MAIN :: Primary driver for the MITgcm algorithm  C  |-THE_MODEL_MAIN :: Primary driver for the MITgcm algorithm
1470  C    |              :: Called from WRAPPER level numerical  C    |              :: Called from WRAPPER level numerical
1471  C    |              :: code innvocation routine. On entry  C    |              :: code invocation routine. On entry
1472  C    |              :: to THE_MODEL_MAIN separate thread and  C    |              :: to THE_MODEL_MAIN separate thread and
1473  C    |              :: separate processes will have been established.  C    |              :: separate processes will have been established.
1474  C    |              :: Each thread and process will have a unique ID  C    |              :: Each thread and process will have a unique ID
# Line 1471  C    | |-INI_PARMS :: Routine to set ker Line 1482  C    | |-INI_PARMS :: Routine to set ker
1482  C    | |           :: By default kernel parameters are read from file  C    | |           :: By default kernel parameters are read from file
1483  C    | |           :: "data" in directory in which code executes.  C    | |           :: "data" in directory in which code executes.
1484  C    | |  C    | |
1485  C    | |-MON_INIT :: Initialises monitor pacakge ( see pkg/monitor )  C    | |-MON_INIT :: Initializes monitor package ( see pkg/monitor )
1486  C    | |  C    | |
1487  C    | |-INI_GRID :: Control grid array (vert. and hori.) initialisation.  C    | |-INI_GRID :: Control grid array (vert. and hori.) initialization.
1488  C    | | |        :: Grid arrays are held and described in GRID.h.  C    | | |        :: Grid arrays are held and described in GRID.h.
1489  C    | | |  C    | | |
1490  C    | | |-INI_VERTICAL_GRID        :: Initialise vertical grid arrays.  C    | | |-INI_VERTICAL_GRID        :: Initialize vertical grid arrays.
1491  C    | | |  C    | | |
1492  C    | | |-INI_CARTESIAN_GRID       :: Cartesian horiz. grid initialisation  C    | | |-INI_CARTESIAN_GRID       :: Cartesian horiz. grid initialization
1493  C    | | |                          :: (calculate grid from kernel parameters).  C    | | |                          :: (calculate grid from kernel parameters).
1494  C    | | |  C    | | |
1495  C    | | |-INI_SPHERICAL_POLAR_GRID :: Spherical polar horiz. grid  C    | | |-INI_SPHERICAL_POLAR_GRID :: Spherical polar horiz. grid
1496  C    | | |                          :: initialisation (calculate grid from  C    | | |                          :: initialization (calculate grid from
1497  C    | | |                          :: kernel parameters).  C    | | |                          :: kernel parameters).
1498  C    | | |  C    | | |
1499  C    | | |-INI_CURVILINEAR_GRID     :: General orthogonal, structured horiz.  C    | | |-INI_CURVILINEAR_GRID     :: General orthogonal, structured horiz.
1500  C    | |                            :: grid initialisations. ( input from raw  C    | |                            :: grid initializations. ( input from raw
1501  C    | |                            :: grid files, LONC.bin, DXF.bin etc... )  C    | |                            :: grid files, LONC.bin, DXF.bin etc... )
1502  C    | |  C    | |
1503  C    | |-INI_DEPTHS    :: Read (from "bathyFile") or set bathymetry/orgography.  C    | |-INI_DEPTHS    :: Read (from "bathyFile") or set bathymetry/orgography.
# Line 1497  C    | | Line 1508  C    | |
1508  C    | |-INI_LINEAR_PHSURF :: Set ref. surface Bo_surf  C    | |-INI_LINEAR_PHSURF :: Set ref. surface Bo_surf
1509  C    | |  C    | |
1510  C    | |-INI_CORI          :: Set coriolis term. zero, f-plane, beta-plane,  C    | |-INI_CORI          :: Set coriolis term. zero, f-plane, beta-plane,
1511  C    | |                   :: sphere optins are coded.  C    | |                   :: sphere options are coded.
1512  C    | |  C    | |
1513  C    | |-PACAKGES_BOOT      :: Start up the optional package environment.  C    | |-PACAKGES_BOOT      :: Start up the optional package environment.
1514  C    | |                    :: Runtime selection of active packages.  C    | |                    :: Runtime selection of active packages.
# Line 1518  C    | | Line 1529  C    | |
1529  C    | |-PACKAGES_CHECK  C    | |-PACKAGES_CHECK
1530  C    | | |  C    | | |
1531  C    | | |-KPP_CHECK           :: KPP Package. pkg/kpp  C    | | |-KPP_CHECK           :: KPP Package. pkg/kpp
1532  C    | | |-OBCS_CHECK          :: Open bndy Pacakge. pkg/obcs  C    | | |-OBCS_CHECK          :: Open bndy Package. pkg/obcs
1533  C    | | |-GMREDI_CHECK        :: GM Package. pkg/gmredi  C    | | |-GMREDI_CHECK        :: GM Package. pkg/gmredi
1534  C    | |  C    | |
1535  C    | |-PACKAGES_INIT_FIXED  C    | |-PACKAGES_INIT_FIXED
# Line 1538  C    | Line 1549  C    |
1549  C    |-CTRL_UNPACK :: Control vector support package. see pkg/ctrl  C    |-CTRL_UNPACK :: Control vector support package. see pkg/ctrl
1550  C    |  C    |
1551  C    |-ADTHE_MAIN_LOOP :: Derivative evaluating form of main time stepping loop  C    |-ADTHE_MAIN_LOOP :: Derivative evaluating form of main time stepping loop
1552  C    !                 :: Auotmatically gerenrated by TAMC/TAF.  C    !                 :: Auotmatically generated by TAMC/TAF.
1553  C    |  C    |
1554  C    |-CTRL_PACK   :: Control vector support package. see pkg/ctrl  C    |-CTRL_PACK   :: Control vector support package. see pkg/ctrl
1555  C    |  C    |
# Line 1552  C    | | | Line 1563  C    | | |
1563  C    | | |-INI_LINEAR_PHISURF :: Set ref. surface Bo_surf  C    | | |-INI_LINEAR_PHISURF :: Set ref. surface Bo_surf
1564  C    | | |  C    | | |
1565  C    | | |-INI_CORI     :: Set coriolis term. zero, f-plane, beta-plane,  C    | | |-INI_CORI     :: Set coriolis term. zero, f-plane, beta-plane,
1566  C    | | |              :: sphere optins are coded.  C    | | |              :: sphere options are coded.
1567  C    | | |  C    | | |
1568  C    | | |-INI_CG2D     :: 2d con. grad solver initialisation.  C    | | |-INI_CG2D     :: 2d con. grad solver initialisation.
1569  C    | | |-INI_CG3D     :: 3d con. grad solver initialisation.  C    | | |-INI_CG3D     :: 3d con. grad solver initialisation.
# Line 1560  C    | | |-INI_MIXING   :: Initialise di Line 1571  C    | | |-INI_MIXING   :: Initialise di
1571  C    | | |-INI_DYNVARS  :: Initialise to zero all DYNVARS.h arrays (dynamical  C    | | |-INI_DYNVARS  :: Initialise to zero all DYNVARS.h arrays (dynamical
1572  C    | | |              :: fields).  C    | | |              :: fields).
1573  C    | | |  C    | | |
1574  C    | | |-INI_FIELDS   :: Control initialising model fields to non-zero  C    | | |-INI_FIELDS   :: Control initializing model fields to non-zero
1575  C    | | | |-INI_VEL    :: Initialize 3D flow field.  C    | | | |-INI_VEL    :: Initialize 3D flow field.
1576  C    | | | |-INI_THETA  :: Set model initial temperature field.  C    | | | |-INI_THETA  :: Set model initial temperature field.
1577  C    | | | |-INI_SALT   :: Set model initial salinity field.  C    | | | |-INI_SALT   :: Set model initial salinity field.
# Line 1638  C/\  | | |-CALC_EXACT_ETA :: Change SSH Line 1649  C/\  | | |-CALC_EXACT_ETA :: Change SSH
1649  C/\  | | |-CALC_SURF_DR   :: Calculate the new surface level thickness.  C/\  | | |-CALC_SURF_DR   :: Calculate the new surface level thickness.
1650  C/\  | | |-EXF_GETFORCING :: External forcing package. ( pkg/exf )  C/\  | | |-EXF_GETFORCING :: External forcing package. ( pkg/exf )
1651  C/\  | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data.  C/\  | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data.
1652  C/\  | | | |                    :: Simple interpolcation between end-points  C/\  | | | |                    :: Simple interpolation between end-points
1653  C/\  | | | |                    :: for forcing datasets.  C/\  | | | |                    :: for forcing datasets.
1654  C/\  | | | |                    C/\  | | | |                  
1655  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.
# Line 1786  C    |-COMM_STATS     :: Summarise inter Line 1797  C    |-COMM_STATS     :: Summarise inter
1797  C                     :: events.  C                     :: events.
1798  C  C
1799  \end{verbatim}  \end{verbatim}
1800    }
1801    
1802  \subsection{Measuring and Characterizing Performance}  \subsection{Measuring and Characterizing Performance}
1803    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22