1 |
cnh |
1.4 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/inc/EESUPPORT.h,v 1.3 1998/09/05 17:52:13 cnh Exp $ |
2 |
cnh |
1.1 |
C |
3 |
|
|
C /==========================================================\ |
4 |
|
|
C | EESUPPORT.h | |
5 |
|
|
C |==========================================================| |
6 |
|
|
C | Support data structures for the MITgcm UV "execution | |
7 |
|
|
C | environment" code. This data should be private to the | |
8 |
|
|
C | execution environment routines. Data which needs to be | |
9 |
|
|
C | accessed directly by the numerical model goes in | |
10 |
|
|
C | EEPARAMS.h. | |
11 |
|
|
C \==========================================================/ |
12 |
|
|
|
13 |
|
|
C ERROR_HEADER - String which prefixes error messages |
14 |
|
|
CHARACTER*(*) ERROR_HEADER |
15 |
|
|
PARAMETER ( ERROR_HEADER = ' *** ERROR ***' ) |
16 |
|
|
C PROCESS_HEADER - String which prefixes processor number |
17 |
|
|
CHARACTER*(*) PROCESS_HEADER |
18 |
|
|
PARAMETER ( PROCESS_HEADER = 'PID.TID' ) |
19 |
|
|
|
20 |
cnh |
1.4 |
C MAX_NUM_COMM_MODES - Maximum number of communication modes |
21 |
cnh |
1.1 |
C COMM_NONE - No edge communication |
22 |
cnh |
1.4 |
C COMM_MSG - Use messages to communicate edges |
23 |
|
|
C COMM_PUT - Use put to communicate edges |
24 |
|
|
C COMM_GET - Use get to communicate edges |
25 |
|
|
C Note - commName holds an identifying name for each communication |
26 |
|
|
C mode. The COMM_ parameters are used to index commName |
27 |
|
|
C so the COMM_ parameters need to be in the range |
28 |
|
|
C 1 : MAX_NUM_COMM_MODES. |
29 |
|
|
INTEGER MAX_NUM_COMM_MODES |
30 |
|
|
PARAMETER ( MAX_NUM_COMM_MODES = 4 ) |
31 |
cnh |
1.1 |
INTEGER COMM_NONE |
32 |
cnh |
1.4 |
PARAMETER ( COMM_NONE = 1 ) |
33 |
|
|
INTEGER COMM_MSG |
34 |
|
|
PARAMETER ( COMM_MSG = 2 ) |
35 |
|
|
INTEGER COMM_PUT |
36 |
|
|
PARAMETER ( COMM_PUT = 3 ) |
37 |
|
|
INTEGER COMM_GET |
38 |
|
|
PARAMETER ( COMM_GET = 4 ) |
39 |
|
|
COMMON /EESUPP_COMMNAME/ commName |
40 |
|
|
CHARACTER*10 commName(MAX_NUM_COMM_MODES) |
41 |
|
|
|
42 |
|
|
C Tile identifiers |
43 |
|
|
C Tiles have a number that is unique over the global domain. |
44 |
|
|
C A tile that is not there has its number set to NULL_TILE |
45 |
|
|
INTEGER NULL_TILE |
46 |
|
|
PARAMETER ( NULL_TILE = -1 ) |
47 |
|
|
|
48 |
cnh |
1.1 |
|
49 |
|
|
C-- COMMON /EESUPP_C/ Execution environment support character variables |
50 |
|
|
C myProcessStr - String identifying my process number |
51 |
|
|
COMMON /EESUPP_C/ myProcessStr |
52 |
|
|
CHARACTER*128 myProcessStr |
53 |
|
|
|
54 |
|
|
C-- COMMON /EESUPP_L/ Execution environment support logical variables |
55 |
|
|
C initMPError - Flag indicating error during multi-processing |
56 |
|
|
C initialisation. |
57 |
|
|
C finMPError - Flag indicating error during multi-processing |
58 |
|
|
C termination. |
59 |
|
|
C ThError - Thread detected an error. |
60 |
|
|
C usingMPI - Flag controlling use of MPI routines. This flag |
61 |
|
|
C allows either MPI or threads to be used in a |
62 |
|
|
C shared memory environment which can be a useful |
63 |
|
|
C debugging/performance analysis tool. |
64 |
|
|
C usingSyncMessages - Flag that causes blocking communication to be used |
65 |
|
|
C if possible. When false non-blocking EXCH routines |
66 |
|
|
C will be used if possible. |
67 |
|
|
C notUsingXPeriodicity - Flag indicating no X/Y boundary wrap around |
68 |
|
|
C notUsingYPeriodicity This affects the communication routines but |
69 |
|
|
C is generally ignored in the numerical model |
70 |
|
|
C code. |
71 |
|
|
C threadIsRunning, threadIsComplete - Flags used to check for correct behaviour |
72 |
|
|
C of multi-threaded code. |
73 |
|
|
C threadIsRunning is used to check that the |
74 |
|
|
C threads we need are running. This catches the |
75 |
|
|
C situation where a program eedata file has nTthreads |
76 |
|
|
C greater than the setenv PARALLEL or NCPUS variable. |
77 |
|
|
C threadIsComplete is used to flag that a thread has |
78 |
|
|
C reached the end of the model. This is used as a check to |
79 |
|
|
C trap problems that might occur if one thread "escapes" |
80 |
|
|
C the main.F master loop. This should not happen |
81 |
|
|
C if the multi-threading compilation tools works right. |
82 |
|
|
C But (see for example KAP) this is not always the case! |
83 |
cnh |
1.3 |
C printMapIncludesZeros - Flag that controls whether character constant map code ignores |
84 |
|
|
C exact zero values. |
85 |
cnh |
1.1 |
COMMON /EESUPP_L/ thError, threadIsRunning, threadIsComplete, |
86 |
|
|
& allMyEdgesAreSharedMemory, usingMPI, usingSyncMessages, |
87 |
cnh |
1.3 |
& notUsingXPeriodicity, notUsingYPeriodicity, |
88 |
|
|
& printMapIncludesZeros |
89 |
cnh |
1.1 |
LOGICAL thError(MAX_NO_THREADS) |
90 |
|
|
LOGICAL threadIsRunning(MAX_NO_THREADS) |
91 |
|
|
LOGICAL threadIsComplete(MAX_NO_THREADS) |
92 |
|
|
LOGICAL allMyEdgesAreSharedMemory(MAX_NO_THREADS) |
93 |
|
|
LOGICAL usingMPI |
94 |
|
|
LOGICAL usingSyncMessages |
95 |
|
|
LOGICAL notUsingXPeriodicity |
96 |
|
|
LOGICAL notUsingYPeriodicity |
97 |
cnh |
1.3 |
LOGICAL printMapIncludesZeros |
98 |
cnh |
1.1 |
|
99 |
|
|
C-- COMMON /EESUPP_I/ Parallel support integer globals |
100 |
cnh |
1.4 |
C pidW - Process ID of neighbor to West |
101 |
|
|
C pidE - ditto East |
102 |
|
|
C pidN - ditto North |
103 |
|
|
C pidS - ditto South |
104 |
cnh |
1.1 |
C Note: pid[XY] is not necessairily the UNIX |
105 |
|
|
C process id - it is just an identifying |
106 |
|
|
C number. |
107 |
cnh |
1.4 |
C myPid - My own process id |
108 |
|
|
C nProcs - Number of processes |
109 |
|
|
C westCommunicationMode - Mode of communication for each tile face |
110 |
|
|
C eastCommunicationMode |
111 |
|
|
C northCommunicationMode |
112 |
|
|
C southCommunicationMode |
113 |
|
|
C bi0 - Low cartesian tile index for this process |
114 |
|
|
C bj0 Note - In a tile distribution with holes bi0 and bj0 |
115 |
|
|
C are not useful. Neighboring tile indices must |
116 |
|
|
C be derived some other way. |
117 |
|
|
C tileNo - Tile identification number for my tile and |
118 |
|
|
C tileNo[WENS] my N,S,E,W neighbor tiles. |
119 |
|
|
C tilePid[WENS] - Process identification number for |
120 |
|
|
C my N,S,E,W neighbor tiles. |
121 |
|
|
C nTx, nTy - No. threads in X and Y. This assumes a simple |
122 |
|
|
C cartesian gridding of the threads which is not |
123 |
|
|
C required elsewhere but that makes it easier. |
124 |
cnh |
1.1 |
COMMON /EESUPP_I/ |
125 |
cnh |
1.4 |
& myPid, nProcs, pidW, pidE, pidN, pidS, |
126 |
|
|
& tileCommModeW, tileCommModeE, |
127 |
|
|
& tileCommModeN, tileCommModeS, |
128 |
|
|
& tileNo, tileNoW, tileNoE, tileNoS, tileNoN, |
129 |
|
|
& tilePidW, tilePidE, tilePidS, tilePidN, |
130 |
|
|
& tileBiW, tileBiE, tileBiS, tileBiN, |
131 |
|
|
& tileBjW, tileBjE, tileBjS, tileBjN, |
132 |
|
|
& tileTagSendW, tileTagSendE, tileTagSendS, tileTagSendN, |
133 |
|
|
& tileTagRecvW, tileTagRecvE, tileTagRecvS, tileTagRecvN |
134 |
|
|
INTEGER myPid |
135 |
|
|
INTEGER nProcs |
136 |
cnh |
1.1 |
INTEGER pidW |
137 |
|
|
INTEGER pidE |
138 |
cnh |
1.4 |
INTEGER pidN |
139 |
cnh |
1.1 |
INTEGER pidS |
140 |
cnh |
1.4 |
INTEGER tileCommModeW ( nSx, nSy ) |
141 |
|
|
INTEGER tileCommModeE ( nSx, nSy ) |
142 |
|
|
INTEGER tileCommModeN ( nSx, nSy ) |
143 |
|
|
INTEGER tileCommModeS ( nSx, nSy ) |
144 |
|
|
INTEGER tileNo( nSx, nSy ) |
145 |
|
|
INTEGER tileNoW( nSx, nSy ) |
146 |
|
|
INTEGER tileNoE( nSx, nSy ) |
147 |
|
|
INTEGER tileNoN( nSx, nSy ) |
148 |
|
|
INTEGER tileNoS( nSx, nSy ) |
149 |
|
|
INTEGER tilePidW( nSx, nSy ) |
150 |
|
|
INTEGER tilePidE( nSx, nSy ) |
151 |
|
|
INTEGER tilePidN( nSx, nSy ) |
152 |
|
|
INTEGER tilePidS( nSx, nSy ) |
153 |
|
|
INTEGER tileBiW( nSx, nSy ) |
154 |
|
|
INTEGER tileBiE( nSx, nSy ) |
155 |
|
|
INTEGER tileBiN( nSx, nSy ) |
156 |
|
|
INTEGER tileBiS( nSx, nSy ) |
157 |
|
|
INTEGER tileBjW( nSx, nSy ) |
158 |
|
|
INTEGER tileBjE( nSx, nSy ) |
159 |
|
|
INTEGER tileBjN( nSx, nSy ) |
160 |
|
|
INTEGER tileBjS( nSx, nSy ) |
161 |
|
|
INTEGER tileTagSendW( nSx, nSy ) |
162 |
|
|
INTEGER tileTagSendE( nSx, nSy ) |
163 |
|
|
INTEGER tileTagSendN( nSx, nSy ) |
164 |
|
|
INTEGER tileTagSendS( nSx, nSy ) |
165 |
|
|
INTEGER tileTagRecvW( nSx, nSy ) |
166 |
|
|
INTEGER tileTagRecvE( nSx, nSy ) |
167 |
|
|
INTEGER tileTagRecvN( nSx, nSy ) |
168 |
|
|
INTEGER tileTagRecvS( nSx, nSy ) |
169 |
cnh |
1.1 |
|
170 |
|
|
#ifdef ALLOW_USE_MPI |
171 |
|
|
C-- Include MPI standard Fortran header file |
172 |
|
|
#include "mpif.h" |
173 |
|
|
#define _mpiTRUE_ 1 |
174 |
|
|
#define _mpiFALSE_ 0 |
175 |
|
|
|
176 |
|
|
C-- COMMON /EESUPP_MPI_I/ MPI parallel support integer globals |
177 |
|
|
C mpiPidW - MPI process id for west neighbor. |
178 |
|
|
C mpiPidE - MPI process id for east neighbor. |
179 |
|
|
C mpiPidN - MPI process id for north neighbor. |
180 |
|
|
C mpiPidS - MPI process id for south neighbor. |
181 |
|
|
C mpiPidNW - MPI process id for northwest neighbor. |
182 |
|
|
C mpiPidNE - MPI process id for northeast neighbor. |
183 |
|
|
C mpiPidSW - MPI process id for southwest neighbor. |
184 |
|
|
C mpiPidSE - MPI process id for southeast neighbor. |
185 |
|
|
C mpiPidIO - MPI process to use for IO. |
186 |
|
|
C mpiNprocs - No. of MPI processes. |
187 |
|
|
C mpiMyId - MPI process id of me. |
188 |
|
|
C mpiComm - MPI communicator to use. |
189 |
|
|
C mpiPx - My MPI proc. grid X coord |
190 |
|
|
C mpiPy - My MPI proc. grid Y coord |
191 |
|
|
C mpiXGlobalLo - My bottom-left (south-west) x-coordinate in |
192 |
|
|
C global domain. |
193 |
|
|
C mpiYGlobalLo - My bottom-left (south-west) y-coordinate in |
194 |
|
|
C global domain. |
195 |
|
|
C mpiTypeXFaceBlock_xy_r4 - Primitives for communicating edge |
196 |
|
|
C mpiTypeXFaceBlock_xy_r8 of a block. |
197 |
|
|
C mpiTypeYFaceBlock_xy_r4 XFace is used in east-west transfer |
198 |
|
|
C mpiTypeYFaceBlock_xy_r8 YFace is used in nrth-south transfer |
199 |
|
|
C mpiTypeXFaceBlock_xyz_r4 xy is used in two-dimensional arrays |
200 |
|
|
C mpiTypeXFaceBlock_xyz_r8 xyz is used with three-dimensional arrays |
201 |
|
|
C mpiTypeYFaceBlock_xyz_r4 r4 is used for real*4 data |
202 |
|
|
C mpiTypeYFaceBlock_xyz_r8 r8 is used for real*8 data |
203 |
|
|
C mpiTypeXFaceThread_xy_r4 - Composites of the above primitives |
204 |
|
|
C mpiTypeXFaceThread_xy_r8 for communicating edges of all blocks |
205 |
|
|
C mpiTypeYFaceThread_xy_r4 owned by a thread. |
206 |
|
|
C mpiTypeYFaceThread_xy_r8 |
207 |
|
|
C mpiTypeXFaceThread_xyz_r4 |
208 |
|
|
C mpiTypeXFaceThread_xyz_r8 |
209 |
|
|
C mpiTypeYFaceThread_xyz_r4 |
210 |
|
|
C mpiTypeYFaceBlock_xyz_r8 |
211 |
|
|
C mpiTagE - Tags are needed to mark requests when MPI is running |
212 |
|
|
C mpiTagW between multithreaded processes or when the same process. |
213 |
|
|
C mpiTagS is a neighbor in more than one direction. The tags ensure that |
214 |
|
|
C mpiTagN a thread will get the message it is looking for. |
215 |
|
|
C mpiTagSW The scheme adopted is to tag messages according to |
216 |
|
|
C mpiTagSE the direction they are travelling. Thus a message |
217 |
|
|
C mpiTagNW travelling east is tagged mpiTagE. However, in a |
218 |
|
|
C mpiTagNE multi-threaded environemnt several messages could |
219 |
|
|
C be travelling east from the same process at the |
220 |
|
|
C same time. The tag is therefore modified to |
221 |
|
|
C be mpiTag[EWS...]*nThreads+myThid. This requires that |
222 |
|
|
C each thread also know the thread ids of its "neighbor" |
223 |
|
|
C threads. |
224 |
|
|
COMMON /EESUPP_MPI_I/ |
225 |
|
|
& mpiPidW, mpiPidE, mpiPidS, mpiPidN, |
226 |
|
|
& mpiPidSE, mpiPidSW, mpiPidNE, mpiPidNW, |
227 |
|
|
& mpiPidIo, mpiMyId, mpiNProcs, mpiComm, |
228 |
|
|
& mpiPx, mpiPy, mpiXGlobalLo, mpiYGlobalLo, |
229 |
|
|
& mpiTypeXFaceBlock_xy_r4, mpiTypeXFaceBlock_xy_r8, |
230 |
|
|
& mpiTypeYFaceBlock_xy_r4, mpiTypeYFaceBlock_xy_r8, |
231 |
|
|
& mpiTypeXFaceBlock_xyz_r4, mpiTypeXFaceBlock_xyz_r8, |
232 |
|
|
& mpiTypeYFaceBlock_xyz_r4, mpiTypeYFaceBlock_xyz_r8, |
233 |
|
|
& mpiTypeXFaceThread_xy_r4, mpiTypeXFaceThread_xy_r8, |
234 |
|
|
& mpiTypeYFaceThread_xy_r4, mpiTypeYFaceThread_xy_r8, |
235 |
|
|
& mpiTypeXFaceThread_xyz_r4, mpiTypeXFaceThread_xyz_r8, |
236 |
|
|
& mpiTypeYFaceThread_xyz_r4, mpiTypeYFaceThread_xyz_r8, |
237 |
|
|
& mpiTagE, mpiTagW, mpiTagN, mpiTagS, |
238 |
|
|
& mpiTagSE, mpiTagSW, mpiTagNW, mpiTagNE |
239 |
|
|
|
240 |
|
|
INTEGER mpiPidW |
241 |
|
|
INTEGER mpiPidE |
242 |
|
|
INTEGER mpiPidS |
243 |
|
|
INTEGER mpiPidN |
244 |
|
|
INTEGER mpiPidSW |
245 |
|
|
INTEGER mpiPidSE |
246 |
|
|
INTEGER mpiPidNW |
247 |
|
|
INTEGER mpiPidNE |
248 |
|
|
INTEGER mpiPidIO |
249 |
|
|
INTEGER mpiMyId |
250 |
|
|
INTEGER mpiNProcs |
251 |
|
|
INTEGER mpiComm |
252 |
|
|
INTEGER mpiPx |
253 |
|
|
INTEGER mpiPy |
254 |
|
|
INTEGER mpiXGlobalLo |
255 |
|
|
INTEGER mpiYGlobalLo |
256 |
|
|
INTEGER mpiTypeXFaceBlock_xy_r4 |
257 |
|
|
INTEGER mpiTypeXFaceBlock_xy_r8 |
258 |
|
|
INTEGER mpiTypeYFaceBlock_xy_r4 |
259 |
|
|
INTEGER mpiTypeYFaceBlock_xy_r8 |
260 |
|
|
INTEGER mpiTypeXFaceBlock_xyz_r4 |
261 |
|
|
INTEGER mpiTypeXFaceBlock_xyz_r8 |
262 |
|
|
INTEGER mpiTypeYFaceBlock_xyz_r4 |
263 |
|
|
INTEGER mpiTypeYFaceBlock_xyz_r8 |
264 |
|
|
INTEGER mpiTypeXFaceThread_xy_r4(MAX_NO_THREADS) |
265 |
|
|
INTEGER mpiTypeXFaceThread_xy_r8(MAX_NO_THREADS) |
266 |
|
|
INTEGER mpiTypeYFaceThread_xy_r4(MAX_NO_THREADS) |
267 |
|
|
INTEGER mpiTypeYFaceThread_xy_r8(MAX_NO_THREADS) |
268 |
|
|
INTEGER mpiTypeXFaceThread_xyz_r4(MAX_NO_THREADS) |
269 |
|
|
INTEGER mpiTypeXFaceThread_xyz_r8(MAX_NO_THREADS) |
270 |
|
|
INTEGER mpiTypeYFaceThread_xyz_r4(MAX_NO_THREADS) |
271 |
|
|
INTEGER mpiTypeYFaceThread_xyz_r8(MAX_NO_THREADS) |
272 |
|
|
INTEGER mpiTagNW |
273 |
|
|
INTEGER mpiTagNE |
274 |
|
|
INTEGER mpiTagSW |
275 |
|
|
INTEGER mpiTagSE |
276 |
|
|
INTEGER mpiTagW |
277 |
|
|
INTEGER mpiTagE |
278 |
|
|
INTEGER mpiTagN |
279 |
|
|
INTEGER mpiTagS |
280 |
|
|
#endif /* ALLOW_USE_MPI */ |
281 |
|
|
|