1 |
jmc |
1.22 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/eeboot.F,v 1.21 2012/03/30 18:13:34 jmc Exp $ |
2 |
cnh |
1.10 |
C $Name: $ |
3 |
cnh |
1.1 |
|
4 |
|
|
#include "CPP_EEOPTIONS.h" |
5 |
adcroft |
1.14 |
#include "PACKAGES_CONFIG.h" |
6 |
cnh |
1.1 |
|
7 |
jmc |
1.18 |
CBOP |
8 |
cnh |
1.10 |
C !ROUTINE: EEBOOT |
9 |
|
|
|
10 |
|
|
C !INTERFACE: |
11 |
cnh |
1.1 |
SUBROUTINE EEBOOT |
12 |
|
|
|
13 |
cnh |
1.10 |
C !DESCRIPTION: |
14 |
|
|
C *==========================================================* |
15 |
jmc |
1.18 |
C | SUBROUTINE EEBOOT |
16 |
|
|
C | o Set up execution "environment", particularly perform |
17 |
|
|
C | steps to initialise parallel processing. |
18 |
cnh |
1.10 |
C *==========================================================* |
19 |
jmc |
1.18 |
C | Note: This routine can also be compiled with CPP |
20 |
|
|
C | directives set so that no multi-processing is initialised |
21 |
|
|
C | This is OK and works fine. |
22 |
cnh |
1.10 |
C *==========================================================* |
23 |
|
|
|
24 |
|
|
C !CALLING SEQUENCE: |
25 |
|
|
C eeboot() |
26 |
|
|
C | |
27 |
jmc |
1.18 |
C |-- eeboot_minimal() :: Minimal startup. Just enough to |
28 |
cnh |
1.10 |
C | allow basic I/O. |
29 |
|
|
C | |
30 |
|
|
C |-- eeintro_msg() :: Write startup greeting. |
31 |
|
|
C | |
32 |
|
|
C |-- eeset_parms() :: Set WRAPPER parameters |
33 |
|
|
C | |
34 |
|
|
C |-- eewrite_eeenv() :: Print WRAPPER parameter settings |
35 |
|
|
C | |
36 |
|
|
C |-- ini_procs() :: Associate processes with grid regions. |
37 |
|
|
C | |
38 |
|
|
C |-- ini_threading_environment() :: Associate threads with grid regions. |
39 |
|
|
C | |
40 |
jmc |
1.18 |
C |-- cpl_register() :: Pass attributes to the coupler |
41 |
|
|
C | |
42 |
|
|
C |-- w2_eeboot() :: Initialise WRAPPER2 execution environment |
43 |
cnh |
1.10 |
|
44 |
|
|
C !USES: |
45 |
jmc |
1.22 |
IMPLICIT NONE |
46 |
cnh |
1.1 |
C == Global variables == |
47 |
|
|
#include "SIZE.h" |
48 |
|
|
#include "EEPARAMS.h" |
49 |
|
|
#include "EESUPPORT.h" |
50 |
|
|
|
51 |
cnh |
1.10 |
C !LOCAL VARIABLES: |
52 |
cnh |
1.1 |
C == Local variables == |
53 |
cnh |
1.10 |
C I :: Loop counter |
54 |
cnh |
1.1 |
INTEGER I |
55 |
jmc |
1.20 |
LOGICAL doReport |
56 |
cnh |
1.10 |
CEOP |
57 |
cnh |
1.1 |
|
58 |
|
|
C-- Set error reporting flags and I/O streams |
59 |
|
|
C fatalError is a flag used to indicate that the program |
60 |
|
|
C ended abnormally. |
61 |
|
|
C errorMessageUnit is the Fortran unit number used for |
62 |
|
|
C writing error messages. |
63 |
|
|
C standardMessageUnit is the Fortran unit number used for |
64 |
|
|
C writing textual, informational output. |
65 |
|
|
C eeBootError is a flag used to indicate an error in the |
66 |
|
|
C "execution environment" startup pahse as opposed |
67 |
|
|
C to the simulation pahse of the execution. |
68 |
jmc |
1.18 |
C eeEndError is used to indicate an "execution environment" shutdown |
69 |
cnh |
1.1 |
C error. |
70 |
|
|
C thError flag used to allow a thread to report an error. |
71 |
jmc |
1.18 |
C This is only really used during the startup process, |
72 |
cnh |
1.1 |
C although it could be used elsewhere. |
73 |
|
|
C allMyEdgesAreSharedMemory flag which says for a particular |
74 |
|
|
C set of blocks the only form of communication |
75 |
|
|
C it does is using shared memory. |
76 |
jmc |
1.18 |
C threadIsRunning used during startup to enable check that all |
77 |
cnh |
1.1 |
C the threads are running. |
78 |
|
|
fatalError = .FALSE. |
79 |
|
|
eeBootError = .FALSE. |
80 |
|
|
eeEndError = .FALSE. |
81 |
|
|
DO I=1, MAX_NO_THREADS |
82 |
|
|
thError(I) = .FALSE. |
83 |
|
|
allMyEdgesAreSharedMemory(I) = .TRUE. |
84 |
|
|
threadIsRunning(I) = .FALSE. |
85 |
|
|
threadIsComplete(I) = .FALSE. |
86 |
cnh |
1.4 |
ioErrorCount(I) = 0 |
87 |
cnh |
1.1 |
ENDDO |
88 |
heimbach |
1.11 |
standardMessageUnit = 6 |
89 |
|
|
scrUnit1 = 11 |
90 |
|
|
scrUnit2 = 12 |
91 |
|
|
eeDataUnit = 13 |
92 |
|
|
modelDataUnit = 14 |
93 |
|
|
errorMessageUnit = 15 |
94 |
|
|
cph errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3 |
95 |
cnh |
1.1 |
|
96 |
jmc |
1.21 |
C-- Start minimal environment so that we can do I/O to report errors. |
97 |
cnh |
1.1 |
C Notes |
98 |
|
|
C ===== |
99 |
|
|
C o Here we start MPI and setup the I/O environment |
100 |
jmc |
1.21 |
C that is needed for error reporting. |
101 |
cnh |
1.1 |
C o Under MPI I/O support is very variable until |
102 |
|
|
C MPI is started. This makes is hard to trap the case |
103 |
jmc |
1.18 |
C where mpirun is used to start a non-MPI run or |
104 |
cnh |
1.1 |
C we try to start MPI when mpirun was not used. |
105 |
|
|
C after it is started. |
106 |
jmc |
1.18 |
C jmc: test: |
107 |
|
|
C If necessary ( COMPONENT_MODULE defined ) add a 1rst preliminary |
108 |
jmc |
1.12 |
C call to eeset_params (in EEBOOT_MINIMAL) to set useCoupler (needed |
109 |
|
|
C very early, and the stardard call eeset_params below comes too late) |
110 |
|
|
C jmc: This needs to be sorted-out in a cleaner way. |
111 |
cnh |
1.1 |
CALL EEBOOT_MINIMAL |
112 |
|
|
IF ( eeBootError ) GOTO 999 |
113 |
|
|
|
114 |
|
|
C-- Now we can write a startup message |
115 |
|
|
CALL EEINTRO_MSG |
116 |
|
|
|
117 |
|
|
C-- Initialise parameters associated with execution environment. |
118 |
jmc |
1.20 |
doReport = .TRUE. |
119 |
|
|
CALL EESET_PARMS ( doReport ) |
120 |
cnh |
1.1 |
IF ( eeBootError ) GOTO 999 |
121 |
|
|
|
122 |
|
|
C-- Write summary of execution environment configuration for this run |
123 |
|
|
CALL EEWRITE_EEENV |
124 |
|
|
|
125 |
|
|
C-- Now do the rest of the multi-process startup. |
126 |
|
|
C o Here we map processes to the model grid. |
127 |
|
|
C o Print tables of process-grid mappings. |
128 |
jmc |
1.18 |
C o Do other miscellaneous multi-processing set up steps. For |
129 |
cnh |
1.1 |
C example under MPI we create datatypes for communication |
130 |
|
|
C of array edges. |
131 |
|
|
CALL INI_PROCS |
132 |
|
|
IF ( eeBootError ) GOTO 999 |
133 |
|
|
|
134 |
|
|
C-- Initialise variables to support "nThreads" of computation. |
135 |
|
|
C o Note the program is still running with a single thread of |
136 |
|
|
C execution at this stage. |
137 |
|
|
CALL INI_THREADING_ENVIRONMENT |
138 |
|
|
IF ( eeBootError ) GOTO 999 |
139 |
jmc |
1.12 |
|
140 |
|
|
C-- Pass attributes to the coupler |
141 |
|
|
#ifdef COMPONENT_MODULE |
142 |
|
|
IF ( useCoupler ) CALL CPL_REGISTER |
143 |
|
|
#endif |
144 |
cnh |
1.4 |
|
145 |
adcroft |
1.14 |
#ifdef ALLOW_EXCH2 |
146 |
afe |
1.13 |
C-- Initialise WRAPPER2 execution environment |
147 |
|
|
CALL W2_EEBOOT |
148 |
adcroft |
1.14 |
#endif /* ALLOW_EXCH2 */ |
149 |
afe |
1.13 |
|
150 |
cnh |
1.1 |
999 CONTINUE |
151 |
|
|
RETURN |
152 |
|
|
END |