/[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.2 - (show annotations) (download)
Thu Apr 23 20:26:42 1998 UTC (26 years, 2 months ago) by cnh
Branch: MAIN
Changes since 1.1: +3 -2 lines
Test to see how $Header version label looks.

1 C $Id: main.F,v 1.1.1.1 1998/04/22 19:15:30 cnh Exp $
2 C $Header: main.F,v 1.1.1.1 1998/04/22 19:15:30 cnh Exp $
3
4 C-- Get C preprocessor options
5 #include "CPP_OPTIONS.h"
6 #include "CPP_EEOPTIONS.h"
7
8 PROGRAM MAIN
9 C /==========================================================\
10 C | PROGRAM MAIN |
11 C | o MAIN wrapper for MITgcm UV implementation. |
12 C |==========================================================|
13 C | MAIN controls the "execution environment". |
14 C | Its main functions are |
15 C | 1. call procedure EEBOOT to perform execution environment|
16 C | initialisation. |
17 C | 2. call procedure THE_MODEL_MAIN once for each concurrent|
18 C | thread. THE_MODEL_MAIN is the user supplied top-level |
19 C | routine. |
20 C | 3. call procedure EEDIE to perform execution environment |
21 C | shutdown. |
22 C \==========================================================/
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 don't 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
92
93 C $Id: main.F,v 1.1.1.1 1998/04/22 19:15:30 cnh Exp $

  ViewVC Help
Powered by ViewVC 1.1.22