/[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.1 - (show annotations) (download)
Wed Apr 22 19:15:30 1998 UTC (26 years, 2 months ago) by cnh
Branch: MAIN
Branch point for: cnh
Initial revision

1 C $Id$
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
23 C == Global variables ==
24 C Include all the "shared" data here. That means all common
25 C blocks used in the model. On many implementations this is not
26 C necessary but doing this is the safest method.
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "EESUPPORT.h"
30 #include "THE_MODEL_COMMON_BLOCKS.h"
31
32 C-- Local variables
33 INTEGER myThid
34 INTEGER I
35
36 C-- Set up the execution environment
37 C EEBOOT loads a execution environment parameter file
38 C ( called "eedata" by default ) and sets variables
39 C accordingly.
40 CALL EEBOOT
41
42 C-- Trap errors
43 IF ( eeBootError ) THEN
44 fatalError = .TRUE.
45 GOTO 999
46 ENDIF
47
48 C-- Start nThreads concurrent threads.
49 C Note: We do a fiddly check here. The check is performed
50 C by CHECK_THREADS. CHECK_THREADS does a count
51 C of all the threads. If after ten seconds it has not
52 C found nThreads threads are running it flags an
53 C error. This traps the case in which the input
54 C parameter nThreads is different from the actual
55 C number of concurrent threads the OS gives us. This
56 C case causes a deadlock if we don't trap it here.
57 #include "MAIN_PDIRECTIVES1.h"
58 DO I=1,nThreads
59 myThid = I
60
61 C-- Do check to see if there are nThreads threads running
62 IF ( .NOT. eeBootError ) THEN
63 CALL CHECK_THREADS( myThid )
64 ENDIF
65
66 C-- Invoke nThreads instances of the numerical model
67 IF ( .NOT. eeBootError ) THEN
68 CALL THE_MODEL_MAIN(myThid)
69 ENDIF
70
71 C-- Each threads sets flag indicating it is done
72 threadIsComplete(myThid) = .TRUE.
73 IF ( .NOT. eeBootError ) THEN
74 _BARRIER
75 ENDIF
76 ENDDO
77 #include "MAIN_PDIRECTIVES2.h"
78
79 999 CONTINUE
80 C-- Shut down execution environment
81 CALL EEDIE
82
83 C-- Write closedown status
84 IF ( fatalError ) THEN
85 STOP 'ABNORMAL END: PROGRAM MAIN'
86 ELSE
87 STOP 'NORMAL END'
88 ENDIF
89 C
90 END
91
92 C $Id: $

  ViewVC Help
Powered by ViewVC 1.1.22