1 |
adcroft |
1.8 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/eeboot.F,v 1.7 2000/03/15 16:00:52 adcroft Exp $ |
2 |
cnh |
1.1 |
|
3 |
|
|
#include "CPP_EEOPTIONS.h" |
4 |
|
|
|
5 |
|
|
CStartOfInterface |
6 |
|
|
SUBROUTINE EEBOOT |
7 |
|
|
C /==========================================================\ |
8 |
|
|
C | SUBROUTINE EEBOOT | |
9 |
|
|
C | o Set up execution "environment", particularly perform | |
10 |
|
|
C | steps to initialise parallel processing. | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C | Note: This routine can also be compiled with CPP | |
13 |
|
|
C | directives set so that no multi-processing is initialised| |
14 |
|
|
C | This is OK and should work fine. | |
15 |
|
|
C \==========================================================/ |
16 |
adcroft |
1.5 |
IMPLICIT NONE |
17 |
cnh |
1.1 |
|
18 |
|
|
C == Global variables == |
19 |
|
|
#include "SIZE.h" |
20 |
|
|
#include "EEPARAMS.h" |
21 |
|
|
#include "EESUPPORT.h" |
22 |
|
|
CEndOfInterface |
23 |
|
|
|
24 |
|
|
C == Local variables == |
25 |
|
|
C I - Loop counter |
26 |
|
|
INTEGER I |
27 |
|
|
|
28 |
|
|
C-- Set error reporting flags and I/O streams |
29 |
|
|
C fatalError is a flag used to indicate that the program |
30 |
|
|
C ended abnormally. |
31 |
|
|
C errorMessageUnit is the Fortran unit number used for |
32 |
|
|
C writing error messages. |
33 |
|
|
C standardMessageUnit is the Fortran unit number used for |
34 |
|
|
C writing textual, informational output. |
35 |
|
|
C eeBootError is a flag used to indicate an error in the |
36 |
|
|
C "execution environment" startup pahse as opposed |
37 |
|
|
C to the simulation pahse of the execution. |
38 |
|
|
C eeEndError is used to indicate an "execution environment" shutdown |
39 |
|
|
C error. |
40 |
|
|
C thError flag used to allow a thread to report an error. |
41 |
|
|
C This is only really used during the startup process, |
42 |
|
|
C although it could be used elsewhere. |
43 |
|
|
C allMyEdgesAreSharedMemory flag which says for a particular |
44 |
|
|
C set of blocks the only form of communication |
45 |
|
|
C it does is using shared memory. |
46 |
|
|
C threadIsRunning used during startup to enable check that all |
47 |
|
|
C the threads are running. |
48 |
|
|
fatalError = .FALSE. |
49 |
|
|
errorMessageUnit = 0 |
50 |
|
|
standardMessageUnit = 6 |
51 |
|
|
eeBootError = .FALSE. |
52 |
|
|
eeEndError = .FALSE. |
53 |
|
|
DO I=1, MAX_NO_THREADS |
54 |
|
|
thError(I) = .FALSE. |
55 |
|
|
allMyEdgesAreSharedMemory(I) = .TRUE. |
56 |
|
|
threadIsRunning(I) = .FALSE. |
57 |
|
|
threadIsComplete(I) = .FALSE. |
58 |
cnh |
1.4 |
ioErrorCount(I) = 0 |
59 |
cnh |
1.1 |
ENDDO |
60 |
|
|
scrUnit1 = 11 |
61 |
|
|
scrUnit2 = 12 |
62 |
|
|
eeDataUnit = 13 |
63 |
|
|
modelDataUnit = 14 |
64 |
|
|
C Annoyingly there is no universal way to have the usingMPI |
65 |
|
|
C parameter work as one might expect. This is because, on some |
66 |
|
|
C systems I/O does not work until MPI_Init has been called. The |
67 |
|
|
C solution for now is that the parameter below may need to be changed |
68 |
|
|
C manually! |
69 |
|
|
#ifdef ALLOW_USE_MPI |
70 |
|
|
usingMPI = .TRUE. |
71 |
|
|
#endif |
72 |
|
|
|
73 |
|
|
C-- Start minimal environment so that we can do I/O |
74 |
|
|
C-- to report errors. |
75 |
|
|
C Notes |
76 |
|
|
C ===== |
77 |
|
|
C o Here we start MPI and setup the I/O environment |
78 |
|
|
C thatis needed for error reporting. |
79 |
|
|
C o Under MPI I/O support is very variable until |
80 |
|
|
C MPI is started. This makes is hard to trap the case |
81 |
|
|
C where mpirun is used to start a non-MPI run or |
82 |
|
|
C we try to start MPI when mpirun was not used. |
83 |
|
|
C after it is started. |
84 |
|
|
CALL EEBOOT_MINIMAL |
85 |
|
|
IF ( eeBootError ) GOTO 999 |
86 |
|
|
|
87 |
|
|
C-- Now we can write a startup message |
88 |
|
|
CALL EEINTRO_MSG |
89 |
|
|
|
90 |
|
|
C-- Initialise parameters associated with execution environment. |
91 |
|
|
CALL EESET_PARMS |
92 |
|
|
IF ( eeBootError ) GOTO 999 |
93 |
|
|
|
94 |
|
|
C-- Write summary of execution environment configuration for this run |
95 |
|
|
CALL EEWRITE_EEENV |
96 |
|
|
|
97 |
|
|
C-- Now do the rest of the multi-process startup. |
98 |
|
|
C o Here we map processes to the model grid. |
99 |
|
|
C o Print tables of process-grid mappings. |
100 |
|
|
C o Do other miscellaneous multi-processing set up steps. For |
101 |
|
|
C example under MPI we create datatypes for communication |
102 |
|
|
C of array edges. |
103 |
|
|
CALL INI_PROCS |
104 |
adcroft |
1.6 |
#ifdef LETS_MAKE_JAM |
105 |
|
|
CALL INI_JAM |
106 |
|
|
#endif |
107 |
cnh |
1.1 |
IF ( eeBootError ) GOTO 999 |
108 |
|
|
|
109 |
|
|
C-- Initialise variables to support "nThreads" of computation. |
110 |
|
|
C o Note the program is still running with a single thread of |
111 |
|
|
C execution at this stage. |
112 |
|
|
CALL INI_THREADING_ENVIRONMENT |
113 |
|
|
IF ( eeBootError ) GOTO 999 |
114 |
cnh |
1.4 |
|
115 |
adcroft |
1.7 |
#ifdef USE_DFILE |
116 |
cnh |
1.4 |
C-- Initiialise the multi-process IO package |
117 |
|
|
CALL DFILE_INIT |
118 |
adcroft |
1.7 |
#endif |
119 |
cnh |
1.1 |
|
120 |
|
|
999 CONTINUE |
121 |
|
|
RETURN |
122 |
|
|
END |