File indexing completed on 2018-03-02 18:40:46 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
aa582c8e8c Jean*0001 #include "CPP_EEOPTIONS.h"
0002 #undef DBUG_EXCH_VEC
eacecc7041 Jean*0003
0004
48e4fc2750 Jean*0005
0006
eacecc7041 Jean*0007
0008
aa582c8e8c Jean*0009
48e4fc2750 Jean*0010
c806179eb4 Alis*0011
aa582c8e8c Jean*0012
48e4fc2750 Jean*0013 SUBROUTINE EXCH_SEND_PUT_VEC_X_RL(
121ecfb57a Jean*0014 I arrayE, arrayW,
0015 O bufRecE, bufRecW,
0016 I myd1, myThid )
aa582c8e8c Jean*0017
0018
48e4fc2750 Jean*0019
aa582c8e8c Jean*0020
0021
0022
bd12238ff3 Jean*0023
0024
0025
aa582c8e8c Jean*0026
0027
0028
c806179eb4 Alis*0029 IMPLICIT NONE
0030
0031
0032 #include "SIZE.h"
0033 #include "EEPARAMS.h"
0034 #include "EESUPPORT.h"
0035 #include "EXCH.h"
aa582c8e8c Jean*0036
0037
0038
0039
0040
0041
0042
0043
c806179eb4 Alis*0044 INTEGER myd1
121ecfb57a Jean*0045 _RL arrayE(myd1,nSx,nSy), arrayW(myd1,nSx,nSy)
0046 _RL bufRecE(myd1,nSx,nSy), bufRecW(myd1,nSx,nSy)
c806179eb4 Alis*0047 INTEGER myThid
aa582c8e8c Jean*0048
0049
0050
0051
0052
0053
0054
b0bdd58b37 Chri*0055
0056
0057
0058
aa582c8e8c Jean*0059
0060
eacecc7041 Jean*0061 INTEGER I
c806179eb4 Alis*0062 INTEGER bi, bj, biW, bjW, biE, bjE
0063 INTEGER westCommMode
0064 INTEGER eastCommMode
0065 #ifdef ALLOW_USE_MPI
0066 INTEGER theProc, theTag, theType, theSize, mpiRc
0067 #endif
aa582c8e8c Jean*0068 #ifdef DBUG_EXCH_VEC
0069 INTEGER ioUnit
0070 #endif
0071
0072
c806179eb4 Alis*0073
ef53b829d7 Jean*0074
c806179eb4 Alis*0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
bd12238ff3 Jean*0090
0091
c806179eb4 Alis*0092
aa582c8e8c Jean*0093
bd12238ff3 Jean*0094
0095 _BARRIER
0096
0097 _BEGIN_MASTER(myThid)
0098
aa582c8e8c Jean*0099 #ifdef DBUG_EXCH_VEC
0100 ioUnit = errorMessageUnit
0101 WRITE(ioUnit,'(A,2L5)')
0102 & 'SEND_PUT_X: exchNeedsMemsync,exchUsesBarrier=',
0103 & exchNeedsMemsync,exchUsesBarrier
0104 #endif
0105
bd12238ff3 Jean*0106 DO bj=1,nSy
0107 DO bi=1,nSx
c806179eb4 Alis*0108
0109 westCommMode = _tileCommModeW(bi,bj)
0110 eastCommMode = _tileCommModeE(bi,bj)
0111 biE = _tileBiE(bi,bj)
0112 bjE = _tileBjE(bi,bj)
0113 biW = _tileBiW(bi,bj)
0114 bjW = _tileBjW(bi,bj)
0115
0116
0117 IF ( westCommMode .EQ. COMM_MSG ) THEN
0118
0119 #ifdef ALLOW_USE_MPI
0120 IF ( usingMPI ) THEN
48e4fc2750 Jean*0121 theProc = tilePidW(bi,bj)
0122 theTag = _tileTagSendW(bi,bj)
0123 theSize = myd1
0124 theType = _MPI_TYPE_RL
0125 exchNReqsX(1,bi,bj) = exchNReqsX(1,bi,bj)+1
aa582c8e8c Jean*0126 #ifdef DBUG_EXCH_VEC
0127 write(ioUnit,'(A,7I5,I8)') 'qq1xW: ',myProcId,bi,bj,
48e4fc2750 Jean*0128 & theProc,theTag, exchNReqsX(1,bi,bj),
0129 & exchReqIdX(exchNReqsX(1,bi,bj),1,bi,bj), theSize
aa582c8e8c Jean*0130 #endif
48e4fc2750 Jean*0131 CALL MPI_Isend( arrayW(1,bi,bj), theSize, theType,
0132 & theProc, theTag, MPI_COMM_MODEL,
0133 & exchReqIdX(exchNReqsX(1,bi,bj),1,bi,bj),
0134 & mpiRc )
c806179eb4 Alis*0135 ENDIF
0136 #endif /* ALLOW_USE_MPI */
aa582c8e8c Jean*0137 eastRecvAck(1,biW,bjW) = 1
c806179eb4 Alis*0138 ELSEIF ( westCommMode .EQ. COMM_PUT ) THEN
121ecfb57a Jean*0139
c806179eb4 Alis*0140 DO I=1,myd1
121ecfb57a Jean*0141 bufRecE(I,biW,bjW) = arrayW(I,bi,bj)
c806179eb4 Alis*0142 ENDDO
121ecfb57a Jean*0143 ELSEIF ( westCommMode .NE. COMM_NONE ) THEN
c806179eb4 Alis*0144 STOP ' S/R EXCH: Invalid commW mode.'
0145 ENDIF
0146
0147
0148 IF ( eastCommMode .EQ. COMM_MSG ) THEN
0149
0150 #ifdef ALLOW_USE_MPI
0151 IF ( usingMPI ) THEN
48e4fc2750 Jean*0152 theProc = tilePidE(bi,bj)
0153 theTag = _tileTagSendE(bi,bj)
0154 theSize = myd1
0155 theType = _MPI_TYPE_RL
0156 exchNReqsX(1,bi,bj) = exchNReqsX(1,bi,bj)+1
aa582c8e8c Jean*0157 #ifdef DBUG_EXCH_VEC
c806179eb4 Alis*0158
0159
aa582c8e8c Jean*0160 write(ioUnit,'(A,7I5,I8)') 'qq1xE: ',myProcId,bi,bj,
0161 & theProc,theTag, exchNReqsX(1,bi,bj),
0162 & exchReqIdX(exchNReqsX(1,bi,bj),1,bi,bj), theSize
c806179eb4 Alis*0163
0164
aa582c8e8c Jean*0165 #endif
48e4fc2750 Jean*0166 CALL MPI_Isend( arrayE(1,bi,bj), theSize, theType,
0167 & theProc, theTag, MPI_COMM_MODEL,
0168 & exchReqIdX(exchNReqsX(1,bi,bj),1,bi,bj),
0169 & mpiRc)
c806179eb4 Alis*0170 ENDIF
0171 #endif /* ALLOW_USE_MPI */
aa582c8e8c Jean*0172 westRecvAck(1,biE,bjE) = 1
c806179eb4 Alis*0173 ELSEIF ( eastCommMode .EQ. COMM_PUT ) THEN
121ecfb57a Jean*0174
c806179eb4 Alis*0175 DO I=1,myd1
121ecfb57a Jean*0176 bufRecW(I,biE,bjE) = arrayE(I,bi,bj)
c806179eb4 Alis*0177 ENDDO
121ecfb57a Jean*0178 ELSEIF ( eastCommMode .NE. COMM_NONE ) THEN
c806179eb4 Alis*0179 STOP ' S/R EXCH: Invalid commE mode.'
0180 ENDIF
0181
0182 ENDDO
0183 ENDDO
0184
bd12238ff3 Jean*0185 _END_MASTER(myThid)
0186
c806179eb4 Alis*0187
0188
0189
0190
0191
0192
0193
0194 IF ( exchNeedsMemSync ) CALL MEMSYNC
0195
0196 DO bj=myByLo(myThid),myByHi(myThid)
0197 DO bi=myBxLo(myThid),myBxHi(myThid)
0198 biE = _tileBiE(bi,bj)
0199 bjE = _tileBjE(bi,bj)
0200 biW = _tileBiW(bi,bj)
0201 bjW = _tileBjW(bi,bj)
0202 westCommMode = _tileCommModeW(bi,bj)
0203 eastCommMode = _tileCommModeE(bi,bj)
aa582c8e8c Jean*0204 IF ( westCommMode .EQ. COMM_PUT ) eastRecvAck(1,biW,bjW) = 1
0205 IF ( eastCommMode .EQ. COMM_PUT ) westRecvAck(1,biE,bjE) = 1
0206 IF ( westCommMode .EQ. COMM_GET ) eastRecvAck(1,biW,bjW) = 1
0207 IF ( eastCommMode .EQ. COMM_GET ) westRecvAck(1,biE,bjE) = 1
c806179eb4 Alis*0208 ENDDO
0209 ENDDO
0210
0211
0212
0213
0214
0215
0216
ef53b829d7 Jean*0217
c806179eb4 Alis*0218
0219
0220
0221 IF ( exchNeedsMemSync ) CALL MEMSYNC
0222
bd12238ff3 Jean*0223
0224 _BARRIER
0225
ef53b829d7 Jean*0226 RETURN
c806179eb4 Alis*0227 END
0228
eacecc7041 Jean*0229
aa582c8e8c Jean*0230
48e4fc2750 Jean*0231
eacecc7041 Jean*0232
aa582c8e8c Jean*0233
48e4fc2750 Jean*0234 SUBROUTINE EXCH_SEND_PUT_VEC_Y_RL(
121ecfb57a Jean*0235 I arrayN, arrayS,
0236 O bufRecN, bufRecS,
0237 I myd1, myThid )
aa582c8e8c Jean*0238
0239
48e4fc2750 Jean*0240
aa582c8e8c Jean*0241
0242
0243
bd12238ff3 Jean*0244
0245
0246
aa582c8e8c Jean*0247
0248
0249
c806179eb4 Alis*0250 IMPLICIT NONE
0251
0252
0253 #include "SIZE.h"
0254 #include "EEPARAMS.h"
0255 #include "EESUPPORT.h"
0256 #include "EXCH.h"
aa582c8e8c Jean*0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
c806179eb4 Alis*0269 INTEGER myd1
121ecfb57a Jean*0270 _RL arrayN(myd1,nSx,nSy), arrayS(myd1,nSx,nSy)
0271 _RL bufRecN(myd1,nSx,nSy), bufRecS(myd1,nSx,nSy)
c806179eb4 Alis*0272 INTEGER myThid
aa582c8e8c Jean*0273
0274
0275
0276
0277
0278
0279
b0bdd58b37 Chri*0280
0281
bd12238ff3 Jean*0282
b0bdd58b37 Chri*0283
aa582c8e8c Jean*0284
0285
eacecc7041 Jean*0286 INTEGER I
c806179eb4 Alis*0287 INTEGER bi, bj, biS, bjS, biN, bjN
0288 INTEGER southCommMode
0289 INTEGER northCommMode
0290 #ifdef ALLOW_USE_MPI
0291 INTEGER theProc, theTag, theType, theSize, mpiRc
0292 #endif
aa582c8e8c Jean*0293 #ifdef DBUG_EXCH_VEC
0294 INTEGER ioUnit
0295 #endif
0296
0297
c806179eb4 Alis*0298
ef53b829d7 Jean*0299
c806179eb4 Alis*0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
bd12238ff3 Jean*0315
0316
c806179eb4 Alis*0317
aa582c8e8c Jean*0318
bd12238ff3 Jean*0319
0320 _BARRIER
0321
0322 _BEGIN_MASTER(myThid)
0323
aa582c8e8c Jean*0324 #ifdef DBUG_EXCH_VEC
0325 ioUnit = errorMessageUnit
0326 #endif
0327
bd12238ff3 Jean*0328 DO bj=1,nSy
0329 DO bi=1,nSx
c806179eb4 Alis*0330
0331 southCommMode = _tileCommModeS(bi,bj)
0332 northCommMode = _tileCommModeN(bi,bj)
0333 biN = _tileBiN(bi,bj)
0334 bjN = _tileBjN(bi,bj)
0335 biS = _tileBiS(bi,bj)
0336 bjS = _tileBjS(bi,bj)
0337
0338
0339 IF ( southCommMode .EQ. COMM_MSG ) THEN
0340
0341 #ifdef ALLOW_USE_MPI
0342 IF ( usingMPI ) THEN
48e4fc2750 Jean*0343 theProc = tilePidS(bi,bj)
0344 theTag = _tileTagSendS(bi,bj)
0345 theSize = myd1
0346 theType = _MPI_TYPE_RL
0347 exchNReqsY(1,bi,bj) = exchNReqsY(1,bi,bj)+1
0348 CALL MPI_Isend( arrayS(1,bi,bj), theSize, theType,
0349 & theProc, theTag, MPI_COMM_MODEL,
0350 & exchReqIdY(exchNReqsY(1,bi,bj),1,bi,bj),
0351 & mpiRc )
c806179eb4 Alis*0352 ENDIF
0353 #endif /* ALLOW_USE_MPI */
aa582c8e8c Jean*0354 northRecvAck(1,biS,bjS) = 1
c806179eb4 Alis*0355 ELSEIF ( southCommMode .EQ. COMM_PUT ) THEN
121ecfb57a Jean*0356
c806179eb4 Alis*0357 DO I=1,myd1
121ecfb57a Jean*0358 bufRecN(I,biS,bjS) = arrayS(I,bi,bj)
c806179eb4 Alis*0359 ENDDO
121ecfb57a Jean*0360 ELSEIF ( southCommMode .NE. COMM_NONE ) THEN
c806179eb4 Alis*0361 STOP ' S/R EXCH: Invalid commS mode.'
0362 ENDIF
0363
0364
0365 IF ( northCommMode .EQ. COMM_MSG ) THEN
0366
0367 #ifdef ALLOW_USE_MPI
0368 IF ( usingMPI ) THEN
48e4fc2750 Jean*0369 theProc = tilePidN(bi,bj)
0370 theTag = _tileTagSendN(bi,bj)
0371 theSize = myd1
0372 theType = _MPI_TYPE_RL
0373 exchNReqsY(1,bi,bj) = exchNReqsY(1,bi,bj)+1
0374 CALL MPI_Isend( arrayN(1,bi,bj), theSize, theType,
0375 & theProc, theTag, MPI_COMM_MODEL,
0376 & exchReqIdY(exchNReqsY(1,bi,bj),1,bi,bj),
0377 & mpiRc )
c806179eb4 Alis*0378 ENDIF
0379 #endif /* ALLOW_USE_MPI */
aa582c8e8c Jean*0380 southRecvAck(1,biN,bjN) = 1
c806179eb4 Alis*0381 ELSEIF ( northCommMode .EQ. COMM_PUT ) THEN
121ecfb57a Jean*0382
c806179eb4 Alis*0383 DO I=1,myd1
121ecfb57a Jean*0384 bufRecS(I,biN,bjN) = arrayN(I,bi,bj)
c806179eb4 Alis*0385 ENDDO
121ecfb57a Jean*0386 ELSEIF ( northCommMode .NE. COMM_NONE ) THEN
c806179eb4 Alis*0387 STOP ' S/R EXCH: Invalid commN mode.'
0388 ENDIF
0389
0390 ENDDO
0391 ENDDO
0392
bd12238ff3 Jean*0393 _END_MASTER(myThid)
0394
c806179eb4 Alis*0395
0396
0397
0398
0399
0400
0401
0402 IF ( exchNeedsMemSync ) CALL MEMSYNC
0403
0404 DO bj=myByLo(myThid),myByHi(myThid)
0405 DO bi=myBxLo(myThid),myBxHi(myThid)
0406 biN = _tileBiN(bi,bj)
0407 bjN = _tileBjN(bi,bj)
0408 biS = _tileBiS(bi,bj)
0409 bjS = _tileBjS(bi,bj)
aa582c8e8c Jean*0410 southCommMode = _tileCommModeS(bi,bj)
c806179eb4 Alis*0411 northCommMode = _tileCommModeN(bi,bj)
aa582c8e8c Jean*0412 IF ( southCommMode .EQ. COMM_PUT ) northRecvAck(1,biS,bjS) = 1
0413 IF ( northCommMode .EQ. COMM_PUT ) southRecvAck(1,biN,bjN) = 1
0414 IF ( southCommMode .EQ. COMM_GET ) northRecvAck(1,biS,bjS) = 1
0415 IF ( northCommMode .EQ. COMM_GET ) southRecvAck(1,biN,bjN) = 1
c806179eb4 Alis*0416 ENDDO
0417 ENDDO
0418
0419
0420
0421
0422
0423
0424
ef53b829d7 Jean*0425
c806179eb4 Alis*0426
0427
0428
0429 IF ( exchNeedsMemSync ) CALL MEMSYNC
0430
bd12238ff3 Jean*0431
0432 _BARRIER
0433
ef53b829d7 Jean*0434 RETURN
c806179eb4 Alis*0435 END