/[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.6 - (show annotations) (download)
Tue May 18 17:39:21 1999 UTC (25 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint28, checkpoint29, checkpoint22, checkpoint23, checkpoint24, checkpoint25, checkpoint27, branch-atmos-merge-freeze, branch-atmos-merge-start, checkpoint26, branch-atmos-merge-shapiro, checkpoint33, checkpoint32, checkpoint31, checkpoint30, checkpoint34, branch-atmos-merge-zonalfilt, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, branch-atmos-merge-phase6, branch-atmos-merge-phase1, branch-atmos-merge-phase3, branch-atmos-merge-phase2
Branch point for: branch-atmos-merge
Changes since 1.5: +2 -1 lines
Added IMPLICIT NONE where missing and changed formatting from 'I' to 'I5'.

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/main.F,v 1.5 1998/10/28 03:11:35 cnh Exp $
2
3 C-- Get C preprocessor options
4 #include "CPP_OPTIONS.h"
5 #include "CPP_EEOPTIONS.h"
6
7 PROGRAM MAIN
8 C /==========================================================\
9 C | PROGRAM MAIN |
10 C | o MAIN wrapper for MITgcm UV implementation. |
11 C |==========================================================|
12 C | MAIN controls the "execution environment". |
13 C | Its main functions are |
14 C | 1. call procedure EEBOOT to perform execution environment|
15 C | initialisation. |
16 C | 2. call procedure THE_MODEL_MAIN once for each concurrent|
17 C | thread. THE_MODEL_MAIN is the user supplied top-level |
18 C | routine. |
19 C | 3. call procedure EEDIE to perform execution environment |
20 C | shutdown. |
21 C \==========================================================/
22 IMPLICIT NONE
23
24 C == Global variables ==
25 C Include all the "shared" data here. That means all common
26 C blocks used in the model. On many implementations this is not
27 C necessary but doing this is the safest method.
28 #include "SIZE.h"
29 #include "EEPARAMS.h"
30 #include "EESUPPORT.h"
31 #include "THE_MODEL_COMMON_BLOCKS.h"
32
33 C-- Local variables
34 INTEGER myThid
35 INTEGER I
36
37 C-- Set up the execution environment
38 C EEBOOT loads a execution environment parameter file
39 C ( called "eedata" by default ) and sets variables
40 C accordingly.
41 CALL EEBOOT
42
43 C-- Trap errors
44 IF ( eeBootError ) THEN
45 fatalError = .TRUE.
46 GOTO 999
47 ENDIF
48
49 C-- Start nThreads concurrent threads.
50 C Note: We do a fiddly check here. The check is performed
51 C by CHECK_THREADS. CHECK_THREADS does a count
52 C of all the threads. If after ten seconds it has not
53 C found nThreads threads are running it flags an
54 C error. This traps the case in which the input
55 C parameter nThreads is different from the actual
56 C number of concurrent threads the OS gives us. This
57 C case causes a deadlock if we do not trap it here.
58 #include "MAIN_PDIRECTIVES1.h"
59 DO I=1,nThreads
60 myThid = I
61
62 C-- Do check to see if there are nThreads threads running
63 IF ( .NOT. eeBootError ) THEN
64 CALL CHECK_THREADS( myThid )
65 ENDIF
66
67 C-- Invoke nThreads instances of the numerical model
68 IF ( .NOT. eeBootError ) THEN
69 CALL THE_MODEL_MAIN(myThid)
70 ENDIF
71
72 C-- Each threads sets flag indicating it is done
73 threadIsComplete(myThid) = .TRUE.
74 IF ( .NOT. eeBootError ) THEN
75 _BARRIER
76 ENDIF
77 ENDDO
78 #include "MAIN_PDIRECTIVES2.h"
79
80 999 CONTINUE
81 C-- Shut down execution environment
82 CALL EEDIE
83
84 C-- Write closedown status
85 IF ( fatalError ) THEN
86 STOP 'ABNORMAL END: PROGRAM MAIN'
87 ELSE
88 STOP 'NORMAL END'
89 ENDIF
90 C
91 END

  ViewVC Help
Powered by ViewVC 1.1.22