/[MITgcm]/MITgcm/eesupp/src/main.F
ViewVC logotype

Contents of /MITgcm/eesupp/src/main.F

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


Revision 1.11 - (show annotations) (download)
Thu Oct 16 15:47:57 2003 UTC (20 years, 6 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint51o_pre, checkpoint51l_post, checkpoint52, checkpoint51t_post, checkpoint51n_post, checkpoint51s_post, checkpoint51n_pre, checkpoint51l_pre, checkpoint51q_post, checkpoint51r_post, checkpoint52a_pre, checkpoint51o_post, ecco_c52_e35, checkpoint51m_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-nonh, tg2-branch, checkpoint51n_branch
Changes since 1.10: +2 -1 lines
 o Cleanup the default CPP_OPTIONS.h by removing (here, commenting out) the
   PACKAGES_CONFIG.h dependency.  Essentially all of the files that need
   to include PACKAGES_CONFIG.h already do so explicitly so this removes
   the redundancy.

1 C $Header: /u/u3/gcmpack/MITgcm/eesupp/src/main.F,v 1.10 2003/10/02 21:30:22 heimbach Exp $
2 C $Name: $
3
4 CBOI
5 C
6 C !TITLE: WRAPPER CODE SYNOPSIS
7 C !AUTHORS: mitgcm developers ( support@mitgcm.org )
8 C !AFFILIATION: Massachussetts Institute of Technology
9 C !DATE:
10 C !INTRODUCTION: Wrapper synopsis and code
11 C Routines in the subdirectories under eesupp/ ( src/ and inc/ ) provide the core
12 C framework within which numerical and ancilliary software of MITgcm operates.
13 C The eesupp/ directories provide a collection of software we call {\bf WRAPPER} (
14 C ({\bf W}rappable {\bf A}pplication {\bf P}aralell {\bf P}rogramming {\bf E}nvironment {\bf R}esource).
15 C The {bf WRAPPER} provides a generic bootstrapping capability to start applications
16 C in a manner that allows them to exploit single and multi-processing environments on all present
17 C day hardware platforms (spanning vector SMP systems to distributed memory and processing cluster
18 C systems). Numerical applications must be coded to fit within the {\bf WRAPPER}. This entails
19 C applications adopting a particular style for declaring data structures representing
20 C grids and values on grids. The {\bf WRAPPER} currently provides support for grid point
21 C models using a single global indexing system. This is sufficient for latitude-logitude,
22 C cylindrical, and cartesian coordinate configurations. There is also limited support for
23 C composing grids in which no single, sructured global index can be defined. At present, this
24 C support is limited to specific configurations of projections of a cube onto the sphere.
25 C
26 C The main functions supported by the current {\bf WRAPPER} code are
27 C \begin{itemize}
28 C \item program startup and termination including creation/management of multiple
29 C threads and/or processes
30 C \item communication and synchronisatioin operations between multiple processes and/or threads
31 C \item multi-process input and output operations to disk and to other
32 C applications
33 C \end{itemize}
34 C
35 C Multi-process execution assumes the existence of MPI for process startup and termination. However,
36 C MPI does not have to be used for performance critical operations. Instead,
37 C {\bf WRAPPER} performance critical parallel primitives are implemented to allow them to bind to
38 C different low-level system software layers. Bindings exist for using {\bf WRAPPER} with portable
39 C systems such as MPI and UNIX System V IPC memory mapping, as well bindings for high-performance
40 C propreitary systems such as Myrinet GM software and Compaq IMC memory channel technology.
41 C
42 CEOI
43
44
45 C-- Get C preprocessor options
46 #include "PACKAGES_CONFIG.h"
47 #include "CPP_OPTIONS.h"
48 #include "CPP_EEOPTIONS.h"
49
50 CBOP
51 C !ROUTINE: MAIN
52
53 C !INTERFACE:
54 PROGRAM MAIN
55 IMPLICIT NONE
56
57 C !DESCRIPTION:
58 C *==========================================================*
59 C | PROGRAM MAIN
60 C | o MAIN wrapper for MITgcm UV implementation.
61 C *==========================================================*
62 C | MAIN controls the "execution environment".
63 C | Its main functions are
64 C | 1. call procedure EEBOOT to perform execution environment
65 C | initialisation.
66 C | 2. call procedure THE_MODEL_MAIN once for each concurrent
67 C | thread. THE_MODEL_MAIN is the user supplied top-level
68 C | routine.
69 C | 3. call procedure EEDIE to perform execution environment
70 C | shutdown.
71 C *==========================================================*
72
73 C !CALLING SEQUENCE:
74 C
75 C main()
76 C |
77 C |--eeboot() :: WRAPPER initilization
78 C |
79 C |--check_threads() :: Validate multiple thread start up.
80 C |
81 C |--the_model_main() :: Numerical code top-level driver routine
82 C |
83 C |--eedie() :: WRAPPER termination
84
85 C !USES:
86 C == Global variables ==
87 C Include all the "shared" data here. That means all common
88 C blocks used in the model. On many implementations this is not
89 C necessary but doing this is the safest method.
90 #include "SIZE.h"
91 #include "EEPARAMS.h"
92 #include "EESUPPORT.h"
93 #include "THE_MODEL_COMMON_BLOCKS.h"
94
95 C !LOCAL VARIABLES:
96 C-- Local variables
97 INTEGER myThid
98 INTEGER I
99 CEOP
100
101 C-- Set up the execution environment
102 C EEBOOT loads a execution environment parameter file
103 C ( called "eedata" by default ) and sets variables
104 C accordingly.
105 CALL EEBOOT
106
107 C-- Trap errors
108 IF ( eeBootError ) THEN
109 fatalError = .TRUE.
110 GOTO 999
111 ENDIF
112
113 C-- Start nThreads concurrent threads.
114 C Note: We do a fiddly check here. The check is performed
115 C by CHECK_THREADS. CHECK_THREADS does a count
116 C of all the threads. If after ten seconds it has not
117 C found nThreads threads are running it flags an
118 C error. This traps the case in which the input
119 C parameter nThreads is different from the actual
120 C number of concurrent threads the OS gives us. This
121 C case causes a deadlock if we do not trap it here.
122 #include "MAIN_PDIRECTIVES1.h"
123 DO I=1,nThreads
124 myThid = I
125
126 C-- Do check to see if there are nThreads threads running
127 IF ( .NOT. eeBootError ) THEN
128 CALL CHECK_THREADS( myThid )
129 ENDIF
130
131 C-- Invoke nThreads instances of the numerical model
132 IF ( .NOT. eeBootError ) THEN
133 #ifdef ALLOW_ADMTLM_RUN
134 CALL DSVD(myThid)
135 #else
136 CALL THE_MODEL_MAIN(myThid)
137 #endif
138 ENDIF
139
140 C-- Each threads sets flag indicating it is done
141 threadIsComplete(myThid) = .TRUE.
142 IF ( .NOT. eeBootError ) THEN
143 _BARRIER
144 ENDIF
145 ENDDO
146 #include "MAIN_PDIRECTIVES2.h"
147
148 999 CONTINUE
149 C-- Shut down execution environment
150 CALL EEDIE
151
152 C-- Write closedown status
153 IF ( fatalError ) THEN
154 STOP 'ABNORMAL END: PROGRAM MAIN'
155 ELSE
156 STOP 'NORMAL END'
157 ENDIF
158 C
159 END

  ViewVC Help
Powered by ViewVC 1.1.22