1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
#include "PACKAGES_CONFIG.h" |
6 |
|
|
7 |
CStartOfInterface |
CBOP |
8 |
SUBROUTINE EEBOOT |
C !ROUTINE: EEBOOT |
|
C /==========================================================\ |
|
|
C | SUBROUTINE EEBOOT | |
|
|
C | o Set up execution "environment", particularly perform | |
|
|
C | steps to initialise parallel processing. | |
|
|
C |==========================================================| |
|
|
C | Note: This routine can also be compiled with CPP | |
|
|
C | directives set so that no multi-processing is initialised| |
|
|
C | This is OK and should work fine. | |
|
|
C \==========================================================/ |
|
9 |
|
|
10 |
|
C !INTERFACE: |
11 |
|
SUBROUTINE EEBOOT( myComm ) |
12 |
|
|
13 |
|
C !DESCRIPTION: |
14 |
|
C *==========================================================* |
15 |
|
C | SUBROUTINE EEBOOT |
16 |
|
C | o Set up execution "environment", particularly perform |
17 |
|
C | steps to initialise parallel processing. |
18 |
|
C *==========================================================* |
19 |
|
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 |
|
C *==========================================================* |
23 |
|
|
24 |
|
C !CALLING SEQUENCE: |
25 |
|
C eeboot() |
26 |
|
C | |
27 |
|
C |-- eeboot_minimal() :: Minimal startup. Just enough to |
28 |
|
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 |
|
C |-- cpl_register() :: Pass attributes to the coupler |
41 |
|
C | |
42 |
|
C |-- w2_eeboot() :: Initialise WRAPPER2 execution environment |
43 |
|
|
44 |
|
C !USES: |
45 |
|
IMPLICIT NONE |
46 |
C == Global variables == |
C == Global variables == |
47 |
#include "SIZE.h" |
#include "SIZE.h" |
48 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
49 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
|
CEndOfInterface |
|
50 |
|
|
51 |
|
C !ROUTINE ARGUMENTS |
52 |
|
C == Routine arguments == |
53 |
|
C myComm :: Communicator that is passed down from |
54 |
|
C upper level driver (if there is one). |
55 |
|
INTEGER myComm |
56 |
|
|
57 |
|
C !LOCAL VARIABLES: |
58 |
C == Local variables == |
C == Local variables == |
59 |
C msgBuf - Variable for building informational messages |
C I :: Loop counter |
|
C I - Loop counter |
|
60 |
INTEGER I |
INTEGER I |
61 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
LOGICAL doReport |
62 |
|
CEOP |
63 |
|
|
64 |
C-- Set error reporting flags and I/O streams |
C-- Set error reporting flags and I/O streams |
65 |
C fatalError is a flag used to indicate that the program |
C fatalError is a flag used to indicate that the program |
71 |
C eeBootError is a flag used to indicate an error in the |
C eeBootError is a flag used to indicate an error in the |
72 |
C "execution environment" startup pahse as opposed |
C "execution environment" startup pahse as opposed |
73 |
C to the simulation pahse of the execution. |
C to the simulation pahse of the execution. |
74 |
C eeEndError is used to indicate an "execution environment" shutdown |
C eeEndError is used to indicate an "execution environment" shutdown |
75 |
C error. |
C error. |
76 |
C thError flag used to allow a thread to report an error. |
C thError flag used to allow a thread to report an error. |
77 |
C This is only really used during the startup process, |
C This is only really used during the startup process, |
78 |
C although it could be used elsewhere. |
C although it could be used elsewhere. |
79 |
C allMyEdgesAreSharedMemory flag which says for a particular |
C allMyEdgesAreSharedMemory flag which says for a particular |
80 |
C set of blocks the only form of communication |
C set of blocks the only form of communication |
81 |
C it does is using shared memory. |
C it does is using shared memory. |
82 |
C threadIsRunning used during startup to enable check that all |
C threadIsRunning used during startup to enable check that all |
83 |
C the threads are running. |
C the threads are running. |
84 |
fatalError = .FALSE. |
fatalError = .FALSE. |
|
errorMessageUnit = 0 |
|
|
standardMessageUnit = 6 |
|
85 |
eeBootError = .FALSE. |
eeBootError = .FALSE. |
86 |
eeEndError = .FALSE. |
eeEndError = .FALSE. |
87 |
DO I=1, MAX_NO_THREADS |
DO I=1, MAX_NO_THREADS |
89 |
allMyEdgesAreSharedMemory(I) = .TRUE. |
allMyEdgesAreSharedMemory(I) = .TRUE. |
90 |
threadIsRunning(I) = .FALSE. |
threadIsRunning(I) = .FALSE. |
91 |
threadIsComplete(I) = .FALSE. |
threadIsComplete(I) = .FALSE. |
92 |
|
ioErrorCount(I) = 0 |
93 |
ENDDO |
ENDDO |
94 |
scrUnit1 = 11 |
standardMessageUnit = 6 |
95 |
scrUnit2 = 12 |
#ifdef HACK_FOR_GMAO_CPL |
96 |
eeDataUnit = 13 |
scrUnit1 = 31 |
97 |
modelDataUnit = 14 |
scrUnit2 = 32 |
98 |
C Annoyingly there is no universal way to have the usingMPI |
eeDataUnit = 33 |
99 |
C parameter work as one might expect. This is because, on some |
modelDataUnit = 34 |
100 |
C systems I/O does not work until MPI_Init has been called. The |
errorMessageUnit = 35 |
101 |
C solution for now is that the parameter below may need to be changed |
#else |
102 |
C manually! |
scrUnit1 = 11 |
103 |
#ifdef ALLOW_USE_MPI |
scrUnit2 = 12 |
104 |
usingMPI = .TRUE. |
eeDataUnit = 13 |
105 |
|
modelDataUnit = 14 |
106 |
|
errorMessageUnit = 15 |
107 |
|
cph errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3 |
108 |
#endif |
#endif |
109 |
|
|
110 |
C-- Start minimal environment so that we can do I/O |
C-- Start minimal environment so that we can do I/O to report errors. |
|
C-- to report errors. |
|
111 |
C Notes |
C Notes |
112 |
C ===== |
C ===== |
113 |
C o Here we start MPI and setup the I/O environment |
C o Here we start MPI and setup the I/O environment |
114 |
C thatis needed for error reporting. |
C that is needed for error reporting. |
115 |
C o Under MPI I/O support is very variable until |
C o Under MPI I/O support is very variable until |
116 |
C MPI is started. This makes is hard to trap the case |
C MPI is started. This makes is hard to trap the case |
117 |
C where mpirun is used to start a non-MPI run or |
C where mpirun is used to start a non-MPI run or |
118 |
C we try to start MPI when mpirun was not used. |
C we try to start MPI when mpirun was not used. |
119 |
C after it is started. |
C after it is started. |
120 |
CALL EEBOOT_MINIMAL |
C jmc: test: |
121 |
|
C If necessary ( COMPONENT_MODULE defined ) add a 1rst preliminary |
122 |
|
C call to eeset_params (in EEBOOT_MINIMAL) to set useCoupler (needed |
123 |
|
C very early, and the stardard call eeset_params below comes too late) |
124 |
|
C jmc: This needs to be sorted-out in a cleaner way. |
125 |
|
CALL EEBOOT_MINIMAL( myComm ) |
126 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
127 |
|
|
128 |
C-- Now we can write a startup message |
C-- Now we can write a startup message |
129 |
CALL EEINTRO_MSG |
CALL EEINTRO_MSG |
130 |
|
|
131 |
C-- Initialise parameters associated with execution environment. |
C-- Initialise parameters associated with execution environment. |
132 |
CALL EESET_PARMS |
doReport = .TRUE. |
133 |
|
CALL EESET_PARMS ( myProcId, doReport ) |
134 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
135 |
|
|
136 |
C-- Write summary of execution environment configuration for this run |
C-- Write summary of execution environment configuration for this run |
139 |
C-- Now do the rest of the multi-process startup. |
C-- Now do the rest of the multi-process startup. |
140 |
C o Here we map processes to the model grid. |
C o Here we map processes to the model grid. |
141 |
C o Print tables of process-grid mappings. |
C o Print tables of process-grid mappings. |
142 |
C o Do other miscellaneous multi-processing set up steps. For |
C o Do other miscellaneous multi-processing set up steps. For |
143 |
C example under MPI we create datatypes for communication |
C example under MPI we create datatypes for communication |
144 |
C of array edges. |
C of array edges. |
145 |
CALL INI_PROCS |
CALL INI_PROCS |
150 |
C execution at this stage. |
C execution at this stage. |
151 |
CALL INI_THREADING_ENVIRONMENT |
CALL INI_THREADING_ENVIRONMENT |
152 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
153 |
|
|
154 |
|
#ifdef ALLOW_EXCH2 |
155 |
|
C-- Initialise WRAPPER2 execution environment |
156 |
|
CALL W2_EEBOOT |
157 |
|
#endif /* ALLOW_EXCH2 */ |
158 |
|
|
159 |
|
C-- Pass attributes to the coupler |
160 |
|
#ifdef COMPONENT_MODULE |
161 |
|
IF ( useCoupler ) CALL CPL_REGISTER |
162 |
|
#endif |
163 |
|
|
164 |
999 CONTINUE |
999 CONTINUE |
165 |
RETURN |
RETURN |
166 |
END |
END |
|
C $Id$ |
|