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