/[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.9 - (show annotations) (download)
Fri Sep 28 16:49:54 2001 UTC (22 years, 8 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint44e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint46f_post, checkpoint48e_post, checkpoint50c_pre, checkpoint44f_post, checkpoint46b_post, checkpoint43a-release1mods, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, release1_p13, checkpoint48i_post, checkpoint46l_pre, chkpt44d_post, checkpoint51, checkpoint50, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint50b_pre, checkpoint44e_pre, checkpoint51f_post, release1_b1, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint48b_post, checkpoint43, checkpoint51d_post, checkpoint48c_pre, checkpoint47d_pre, release1_chkpt44d_post, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, release1_p11, checkpoint47d_post, icebear5, icebear4, icebear3, icebear2, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint46j_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, ecco_c50_e29, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, ecco_c50_e28, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47j_post, ecco_c50_e33a, branch-exfmods-tag, checkpoint44g_post, branchpoint-genmake2, checkpoint46e_pre, checkpoint48c_post, checkpoint45b_post, checkpoint46b_pre, release1-branch-end, release1_final_v1, checkpoint51b_post, checkpoint51c_post, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint44b_post, ecco_c51_e34, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint50g_post, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, checkpoint46g_post, release1_p12_pre, ecco_c44_e22, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, ecco_c44_e25, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, checkpoint46i_post, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, checkpoint50d_pre, checkpoint46e_post, release1_beta1, checkpoint51e_post, checkpoint44b_pre, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51f_pre, chkpt44c_post, checkpoint48g_post, checkpoint47h_post, checkpoint44f_pre, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint51a_post
Branch point for: c24_e25_ice, branch-exfmods-curt, release1_final, release1-branch, branch-genmake2, release1, ecco-branch, release1_50yr, icebear, release1_coupled
Changes since 1.8: +2 -2 lines
Changes for structuing protex document.

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/main.F,v 1.8 2001/09/21 03:54:35 cnh 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 "CPP_OPTIONS.h"
47 #include "CPP_EEOPTIONS.h"
48
49 CBOP
50 C !ROUTINE: MAIN
51
52 C !INTERFACE:
53 PROGRAM MAIN
54 IMPLICIT NONE
55
56 C !DESCRIPTION:
57 C *==========================================================*
58 C | PROGRAM MAIN
59 C | o MAIN wrapper for MITgcm UV implementation.
60 C *==========================================================*
61 C | MAIN controls the "execution environment".
62 C | Its main functions are
63 C | 1. call procedure EEBOOT to perform execution environment
64 C | initialisation.
65 C | 2. call procedure THE_MODEL_MAIN once for each concurrent
66 C | thread. THE_MODEL_MAIN is the user supplied top-level
67 C | routine.
68 C | 3. call procedure EEDIE to perform execution environment
69 C | shutdown.
70 C *==========================================================*
71
72 C !CALLING SEQUENCE:
73 C
74 C main()
75 C |
76 C |--eeboot() :: WRAPPER initilization
77 C |
78 C |--check_threads() :: Validate multiple thread start up.
79 C |
80 C |--the_model_main() :: Numerical code top-level driver routine
81 C |
82 C |--eedie() :: WRAPPER termination
83
84 C !USES:
85 C == Global variables ==
86 C Include all the "shared" data here. That means all common
87 C blocks used in the model. On many implementations this is not
88 C necessary but doing this is the safest method.
89 #include "SIZE.h"
90 #include "EEPARAMS.h"
91 #include "EESUPPORT.h"
92 #include "THE_MODEL_COMMON_BLOCKS.h"
93
94 C !LOCAL VARIABLES:
95 C-- Local variables
96 INTEGER myThid
97 INTEGER I
98 CEOP
99
100 C-- Set up the execution environment
101 C EEBOOT loads a execution environment parameter file
102 C ( called "eedata" by default ) and sets variables
103 C accordingly.
104 CALL EEBOOT
105
106 C-- Trap errors
107 IF ( eeBootError ) THEN
108 fatalError = .TRUE.
109 GOTO 999
110 ENDIF
111
112 C-- Start nThreads concurrent threads.
113 C Note: We do a fiddly check here. The check is performed
114 C by CHECK_THREADS. CHECK_THREADS does a count
115 C of all the threads. If after ten seconds it has not
116 C found nThreads threads are running it flags an
117 C error. This traps the case in which the input
118 C parameter nThreads is different from the actual
119 C number of concurrent threads the OS gives us. This
120 C case causes a deadlock if we do not trap it here.
121 #include "MAIN_PDIRECTIVES1.h"
122 DO I=1,nThreads
123 myThid = I
124
125 C-- Do check to see if there are nThreads threads running
126 IF ( .NOT. eeBootError ) THEN
127 CALL CHECK_THREADS( myThid )
128 ENDIF
129
130 C-- Invoke nThreads instances of the numerical model
131 IF ( .NOT. eeBootError ) THEN
132 CALL THE_MODEL_MAIN(myThid)
133 ENDIF
134
135 C-- Each threads sets flag indicating it is done
136 threadIsComplete(myThid) = .TRUE.
137 IF ( .NOT. eeBootError ) THEN
138 _BARRIER
139 ENDIF
140 ENDDO
141 #include "MAIN_PDIRECTIVES2.h"
142
143 999 CONTINUE
144 C-- Shut down execution environment
145 CALL EEDIE
146
147 C-- Write closedown status
148 IF ( fatalError ) THEN
149 STOP 'ABNORMAL END: PROGRAM MAIN'
150 ELSE
151 STOP 'NORMAL END'
152 ENDIF
153 C
154 END

  ViewVC Help
Powered by ViewVC 1.1.22