1 |
heimbach |
1.10.6.1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/eeboot.F,v 1.10.8.1 2002/03/24 04:15:51 heimbach Exp $ |
2 |
cnh |
1.10 |
C $Name: $ |
3 |
cnh |
1.1 |
|
4 |
|
|
#include "CPP_EEOPTIONS.h" |
5 |
|
|
|
6 |
cnh |
1.10 |
CBOP |
7 |
|
|
C !ROUTINE: EEBOOT |
8 |
|
|
|
9 |
|
|
C !INTERFACE: |
10 |
cnh |
1.1 |
SUBROUTINE EEBOOT |
11 |
adcroft |
1.5 |
IMPLICIT NONE |
12 |
cnh |
1.1 |
|
13 |
cnh |
1.10 |
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 |-- dfile_init() :: Initialise simple multi-process I/O pacakge. |
41 |
|
|
|
42 |
|
|
C !USES: |
43 |
cnh |
1.1 |
C == Global variables == |
44 |
|
|
#include "SIZE.h" |
45 |
|
|
#include "EEPARAMS.h" |
46 |
|
|
#include "EESUPPORT.h" |
47 |
|
|
|
48 |
cnh |
1.10 |
C !LOCAL VARIABLES: |
49 |
cnh |
1.1 |
C == Local variables == |
50 |
cnh |
1.10 |
C I :: Loop counter |
51 |
cnh |
1.1 |
INTEGER I |
52 |
cnh |
1.10 |
CEOP |
53 |
cnh |
1.1 |
|
54 |
|
|
C-- Set error reporting flags and I/O streams |
55 |
|
|
C fatalError is a flag used to indicate that the program |
56 |
|
|
C ended abnormally. |
57 |
|
|
C errorMessageUnit is the Fortran unit number used for |
58 |
|
|
C writing error messages. |
59 |
|
|
C standardMessageUnit is the Fortran unit number used for |
60 |
|
|
C writing textual, informational output. |
61 |
|
|
C eeBootError is a flag used to indicate an error in the |
62 |
|
|
C "execution environment" startup pahse as opposed |
63 |
|
|
C to the simulation pahse of the execution. |
64 |
|
|
C eeEndError is used to indicate an "execution environment" shutdown |
65 |
|
|
C error. |
66 |
|
|
C thError flag used to allow a thread to report an error. |
67 |
|
|
C This is only really used during the startup process, |
68 |
|
|
C although it could be used elsewhere. |
69 |
|
|
C allMyEdgesAreSharedMemory flag which says for a particular |
70 |
|
|
C set of blocks the only form of communication |
71 |
|
|
C it does is using shared memory. |
72 |
|
|
C threadIsRunning used during startup to enable check that all |
73 |
|
|
C the threads are running. |
74 |
|
|
fatalError = .FALSE. |
75 |
|
|
eeBootError = .FALSE. |
76 |
|
|
eeEndError = .FALSE. |
77 |
|
|
DO I=1, MAX_NO_THREADS |
78 |
|
|
thError(I) = .FALSE. |
79 |
|
|
allMyEdgesAreSharedMemory(I) = .TRUE. |
80 |
|
|
threadIsRunning(I) = .FALSE. |
81 |
|
|
threadIsComplete(I) = .FALSE. |
82 |
cnh |
1.4 |
ioErrorCount(I) = 0 |
83 |
cnh |
1.1 |
ENDDO |
84 |
heimbach |
1.10.6.1 |
standardMessageUnit = 6 |
85 |
|
|
scrUnit1 = 11 |
86 |
|
|
scrUnit2 = 12 |
87 |
|
|
eeDataUnit = 13 |
88 |
|
|
modelDataUnit = 14 |
89 |
|
|
errorMessageUnit = 15 |
90 |
|
|
cph errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3 |
91 |
|
|
C |
92 |
cnh |
1.1 |
C Annoyingly there is no universal way to have the usingMPI |
93 |
|
|
C parameter work as one might expect. This is because, on some |
94 |
|
|
C systems I/O does not work until MPI_Init has been called. The |
95 |
|
|
C solution for now is that the parameter below may need to be changed |
96 |
|
|
C manually! |
97 |
|
|
#ifdef ALLOW_USE_MPI |
98 |
|
|
usingMPI = .TRUE. |
99 |
|
|
#endif |
100 |
|
|
|
101 |
|
|
C-- Start minimal environment so that we can do I/O |
102 |
|
|
C-- to report errors. |
103 |
|
|
C Notes |
104 |
|
|
C ===== |
105 |
|
|
C o Here we start MPI and setup the I/O environment |
106 |
|
|
C thatis needed for error reporting. |
107 |
|
|
C o Under MPI I/O support is very variable until |
108 |
|
|
C MPI is started. This makes is hard to trap the case |
109 |
|
|
C where mpirun is used to start a non-MPI run or |
110 |
|
|
C we try to start MPI when mpirun was not used. |
111 |
|
|
C after it is started. |
112 |
|
|
CALL EEBOOT_MINIMAL |
113 |
|
|
IF ( eeBootError ) GOTO 999 |
114 |
|
|
|
115 |
|
|
C-- Now we can write a startup message |
116 |
|
|
CALL EEINTRO_MSG |
117 |
|
|
|
118 |
|
|
C-- Initialise parameters associated with execution environment. |
119 |
|
|
CALL EESET_PARMS |
120 |
|
|
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 |
|
|
C o Do other miscellaneous multi-processing set up steps. For |
129 |
|
|
C example under MPI we create datatypes for communication |
130 |
|
|
C of array edges. |
131 |
|
|
CALL INI_PROCS |
132 |
adcroft |
1.6 |
#ifdef LETS_MAKE_JAM |
133 |
|
|
CALL INI_JAM |
134 |
|
|
#endif |
135 |
cnh |
1.1 |
IF ( eeBootError ) GOTO 999 |
136 |
|
|
|
137 |
|
|
C-- Initialise variables to support "nThreads" of computation. |
138 |
|
|
C o Note the program is still running with a single thread of |
139 |
|
|
C execution at this stage. |
140 |
|
|
CALL INI_THREADING_ENVIRONMENT |
141 |
|
|
IF ( eeBootError ) GOTO 999 |
142 |
cnh |
1.4 |
|
143 |
adcroft |
1.7 |
#ifdef USE_DFILE |
144 |
cnh |
1.4 |
C-- Initiialise the multi-process IO package |
145 |
|
|
CALL DFILE_INIT |
146 |
adcroft |
1.7 |
#endif |
147 |
cnh |
1.1 |
|
148 |
|
|
999 CONTINUE |
149 |
|
|
RETURN |
150 |
|
|
END |