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