2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
#include "PACKAGES_CONFIG.h" |
6 |
|
|
7 |
CBOP |
CBOP |
8 |
C !ROUTINE: EEBOOT |
C !ROUTINE: EEBOOT |
9 |
|
|
10 |
C !INTERFACE: |
C !INTERFACE: |
11 |
SUBROUTINE EEBOOT |
SUBROUTINE EEBOOT( myComm ) |
|
IMPLICIT NONE |
|
12 |
|
|
13 |
C !DESCRIPTION: |
C !DESCRIPTION: |
14 |
C *==========================================================* |
C *==========================================================* |
15 |
C | SUBROUTINE EEBOOT |
C | SUBROUTINE EEBOOT |
16 |
C | o Set up execution "environment", particularly perform |
C | o Set up execution "environment", particularly perform |
17 |
C | steps to initialise parallel processing. |
C | steps to initialise parallel processing. |
18 |
C *==========================================================* |
C *==========================================================* |
19 |
C | Note: This routine can also be compiled with CPP |
C | Note: This routine can also be compiled with CPP |
20 |
C | directives set so that no multi-processing is initialised |
C | directives set so that no multi-processing is initialised |
21 |
C | This is OK and works fine. |
C | This is OK and works fine. |
22 |
C *==========================================================* |
C *==========================================================* |
23 |
|
|
24 |
C !CALLING SEQUENCE: |
C !CALLING SEQUENCE: |
25 |
C eeboot() |
C eeboot() |
26 |
C | |
C | |
27 |
C |-- eeboot_minimal() :: Minimal startup. Just enough to |
C |-- eeboot_minimal() :: Minimal startup. Just enough to |
28 |
C | allow basic I/O. |
C | allow basic I/O. |
29 |
C | |
C | |
30 |
C |-- eeintro_msg() :: Write startup greeting. |
C |-- eeintro_msg() :: Write startup greeting. |
37 |
C | |
C | |
38 |
C |-- ini_threading_environment() :: Associate threads with grid regions. |
C |-- ini_threading_environment() :: Associate threads with grid regions. |
39 |
C | |
C | |
40 |
C |-- dfile_init() :: Initialise simple multi-process I/O pacakge. |
C |-- cpl_register() :: Pass attributes to the coupler |
41 |
|
C | |
42 |
|
C |-- w2_eeboot() :: Initialise WRAPPER2 execution environment |
43 |
|
|
44 |
C !USES: |
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" |
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: |
C !LOCAL VARIABLES: |
58 |
C == Local variables == |
C == Local variables == |
59 |
C I :: Loop counter |
C I :: Loop counter |
60 |
INTEGER I |
INTEGER I |
61 |
|
LOGICAL doReport |
62 |
CEOP |
CEOP |
63 |
|
|
64 |
C-- Set error reporting flags and I/O streams |
C-- Set error reporting flags and I/O streams |
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. |
85 |
eeBootError = .FALSE. |
eeBootError = .FALSE. |
92 |
ioErrorCount(I) = 0 |
ioErrorCount(I) = 0 |
93 |
ENDDO |
ENDDO |
94 |
standardMessageUnit = 6 |
standardMessageUnit = 6 |
95 |
|
#ifdef HACK_FOR_GMAO_CPL |
96 |
|
scrUnit1 = 31 |
97 |
|
scrUnit2 = 32 |
98 |
|
eeDataUnit = 33 |
99 |
|
modelDataUnit = 34 |
100 |
|
errorMessageUnit = 35 |
101 |
|
standardMessageUnit = 36 |
102 |
|
#else |
103 |
scrUnit1 = 11 |
scrUnit1 = 11 |
104 |
scrUnit2 = 12 |
scrUnit2 = 12 |
105 |
eeDataUnit = 13 |
eeDataUnit = 13 |
106 |
modelDataUnit = 14 |
modelDataUnit = 14 |
107 |
errorMessageUnit = 15 |
errorMessageUnit = 15 |
108 |
cph errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3 |
cph errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3 |
|
C |
|
|
C Annoyingly there is no universal way to have the usingMPI |
|
|
C parameter work as one might expect. This is because, on some |
|
|
C systems I/O does not work until MPI_Init has been called. The |
|
|
C solution for now is that the parameter below may need to be changed |
|
|
C manually! |
|
|
#ifdef ALLOW_USE_MPI |
|
|
usingMPI = .TRUE. |
|
109 |
#endif |
#endif |
110 |
|
|
111 |
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. |
|
112 |
C Notes |
C Notes |
113 |
C ===== |
C ===== |
114 |
C o Here we start MPI and setup the I/O environment |
C o Here we start MPI and setup the I/O environment |
115 |
C thatis needed for error reporting. |
C that is needed for error reporting. |
116 |
C o Under MPI I/O support is very variable until |
C o Under MPI I/O support is very variable until |
117 |
C MPI is started. This makes is hard to trap the case |
C MPI is started. This makes is hard to trap the case |
118 |
C where mpirun is used to start a non-MPI run or |
C where mpirun is used to start a non-MPI run or |
119 |
C we try to start MPI when mpirun was not used. |
C we try to start MPI when mpirun was not used. |
120 |
C after it is started. |
C after it is started. |
121 |
CALL EEBOOT_MINIMAL |
C jmc: test: |
122 |
|
C If necessary ( COMPONENT_MODULE defined ) add a 1rst preliminary |
123 |
|
C call to eeset_params (in EEBOOT_MINIMAL) to set useCoupler (needed |
124 |
|
C very early, and the stardard call eeset_params below comes too late) |
125 |
|
C jmc: This needs to be sorted-out in a cleaner way. |
126 |
|
CALL EEBOOT_MINIMAL( myComm ) |
127 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
128 |
|
|
129 |
C-- Now we can write a startup message |
C-- Now we can write a startup message |
130 |
CALL EEINTRO_MSG |
CALL EEINTRO_MSG |
131 |
|
|
132 |
C-- Initialise parameters associated with execution environment. |
C-- Initialise parameters associated with execution environment. |
133 |
CALL EESET_PARMS |
doReport = .TRUE. |
134 |
|
CALL EESET_PARMS ( myProcId, doReport ) |
135 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
136 |
|
|
137 |
C-- Write summary of execution environment configuration for this run |
C-- Write summary of execution environment configuration for this run |
140 |
C-- Now do the rest of the multi-process startup. |
C-- Now do the rest of the multi-process startup. |
141 |
C o Here we map processes to the model grid. |
C o Here we map processes to the model grid. |
142 |
C o Print tables of process-grid mappings. |
C o Print tables of process-grid mappings. |
143 |
C o Do other miscellaneous multi-processing set up steps. For |
C o Do other miscellaneous multi-processing set up steps. For |
144 |
C example under MPI we create datatypes for communication |
C example under MPI we create datatypes for communication |
145 |
C of array edges. |
C of array edges. |
146 |
CALL INI_PROCS |
CALL INI_PROCS |
|
#ifdef LETS_MAKE_JAM |
|
|
CALL INI_JAM |
|
|
#endif |
|
147 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
148 |
|
|
149 |
C-- Initialise variables to support "nThreads" of computation. |
C-- Initialise variables to support "nThreads" of computation. |
152 |
CALL INI_THREADING_ENVIRONMENT |
CALL INI_THREADING_ENVIRONMENT |
153 |
IF ( eeBootError ) GOTO 999 |
IF ( eeBootError ) GOTO 999 |
154 |
|
|
155 |
#ifdef USE_DFILE |
#ifdef ALLOW_EXCH2 |
156 |
C-- Initiialise the multi-process IO package |
C-- Initialise WRAPPER2 execution environment |
157 |
CALL DFILE_INIT |
CALL W2_EEBOOT |
158 |
|
#endif /* ALLOW_EXCH2 */ |
159 |
|
|
160 |
|
C-- Pass attributes to the coupler |
161 |
|
#ifdef COMPONENT_MODULE |
162 |
|
IF ( useCoupler ) CALL CPL_REGISTER |
163 |
#endif |
#endif |
164 |
|
|
165 |
999 CONTINUE |
999 CONTINUE |
166 |
RETURN |
RETURN |
167 |
END |
END |