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"
bd12238ff3 Jean*0002 #undef EXCH_USE_SPINNING
aa582c8e8c Jean*0003 #undef DBUG_EXCH_VEC
eacecc7041 Jean*0004
0005
48e4fc2750 Jean*0006
0007
eacecc7041 Jean*0008
0009
aa582c8e8c Jean*0010
48e4fc2750 Jean*0011
c806179eb4 Alis*0012
aa582c8e8c Jean*0013
48e4fc2750 Jean*0014 SUBROUTINE EXCH_RECV_GET_VEC_X_RL(
121ecfb57a Jean*0015 U arrayE, arrayW,
0016 I myd1, myThid )
aa582c8e8c Jean*0017
0018
48e4fc2750 Jean*0019
aa582c8e8c Jean*0020
0021
0022
0023
0024
0025
0026
c806179eb4 Alis*0027 IMPLICIT NONE
0028
0029
0030 #include "SIZE.h"
0031 #include "EEPARAMS.h"
0032 #include "EESUPPORT.h"
0033 #include "EXCH.h"
0034
aa582c8e8c Jean*0035
0036
0037
0038
0039
c806179eb4 Alis*0040 INTEGER myd1
0041 _RL arrayE(myd1, nSx, nSy), arrayW(myd1, nSx, nSy)
0042 INTEGER myThid
aa582c8e8c Jean*0043
c806179eb4 Alis*0044
aa582c8e8c Jean*0045
0046
0047
0048
b0bdd58b37 Chri*0049
0050
0051
0052
aa582c8e8c Jean*0053
0054
121ecfb57a Jean*0055 INTEGER bi, bj
0056
c806179eb4 Alis*0057 INTEGER westCommMode
0058 INTEGER eastCommMode
aa582c8e8c Jean*0059 INTEGER ioUnit
e1fb02e8f0 Jean*0060 #ifdef EXCH_USE_SPINNING
0061 INTEGER spinCount
0062 #endif
c806179eb4 Alis*0063 #ifdef ALLOW_USE_MPI
0064 INTEGER theProc, theTag, theType, theSize
0065 INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc
0066 #endif
0067
ef53b829d7 Jean*0068
c806179eb4 Alis*0069
ef53b829d7 Jean*0070
c806179eb4 Alis*0071
0072
aa582c8e8c Jean*0073
c806179eb4 Alis*0074
0075
0076
0077
aa582c8e8c Jean*0078 ioUnit = errorMessageUnit
c806179eb4 Alis*0079
bd12238ff3 Jean*0080 _BEGIN_MASTER(myThid)
0081
0082 DO bj=1,nSy
0083 DO bi=1,nSx
c806179eb4 Alis*0084 westCommMode = _tileCommModeW(bi,bj)
0085 eastCommMode = _tileCommModeE(bi,bj)
aa582c8e8c Jean*0086 #ifdef DBUG_EXCH_VEC
0087 write(ioUnit,'(A,5I6)') 'RECV_X,0 :',myProcId,bi,bj
0088 #endif
121ecfb57a Jean*0089
0090
0091
0092
c806179eb4 Alis*0093 IF ( westCommMode .EQ. COMM_MSG ) THEN
0094 #ifdef ALLOW_USE_MPI
0095 IF ( usingMPI ) THEN
48e4fc2750 Jean*0096 theProc = tilePidW(bi,bj)
0097 theTag = _tileTagRecvW(bi,bj)
0098 theType = _MPI_TYPE_RL
0099 theSize = myd1
aa582c8e8c Jean*0100 #ifdef DBUG_EXCH_VEC
48e4fc2750 Jean*0101 write(ioUnit,'(A,5I5,I8)') 'qq2xW: ',myProcId,bi,bj,
0102 & theProc,theTag,theSize
aa582c8e8c Jean*0103 #endif
48e4fc2750 Jean*0104 CALL MPI_Recv( arrayW(1,bi,bj), theSize, theType,
0105 & theProc, theTag, MPI_COMM_MODEL,
0106 & mpiStatus, mpiRc )
c806179eb4 Alis*0107
0108
aa582c8e8c Jean*0109
c806179eb4 Alis*0110
0111
aa582c8e8c Jean*0112
c806179eb4 Alis*0113
0114
0115
aa582c8e8c Jean*0116 ENDIF
c806179eb4 Alis*0117 #endif /* ALLOW_USE_MPI */
0118 ENDIF
aa582c8e8c Jean*0119 #ifdef DBUG_EXCH_VEC
0120 write(ioUnit,'(A,5I6)') 'RECV_X,1 :',myProcId,bi,bj
0121 #endif
48e4fc2750 Jean*0122
c806179eb4 Alis*0123 IF ( eastCommMode .EQ. COMM_MSG ) THEN
0124 #ifdef ALLOW_USE_MPI
0125 IF ( usingMPI ) THEN
48e4fc2750 Jean*0126 theProc = tilePidE(bi,bj)
0127 theTag = _tileTagRecvE(bi,bj)
0128 theType = _MPI_TYPE_RL
0129 theSize = myd1
aa582c8e8c Jean*0130 #ifdef DBUG_EXCH_VEC
48e4fc2750 Jean*0131 write(ioUnit,'(A,5I5,I8)') 'qq2xE: ',myProcId,bi,bj,
0132 & theProc,theTag,theSize
aa582c8e8c Jean*0133 #endif
48e4fc2750 Jean*0134 CALL MPI_Recv( arrayE(1,bi,bj), theSize, theType,
0135 & theProc, theTag, MPI_COMM_MODEL,
0136 & mpiStatus, mpiRc )
aa582c8e8c Jean*0137 ENDIF
c806179eb4 Alis*0138 #endif /* ALLOW_USE_MPI */
0139 ENDIF
aa582c8e8c Jean*0140 #ifdef DBUG_EXCH_VEC
0141 write(ioUnit,'(A,5I6)') 'RECV_X,2 :',myProcId,bi,bj
0142 #endif
c806179eb4 Alis*0143 ENDDO
0144 ENDDO
aa582c8e8c Jean*0145 #ifdef DBUG_EXCH_VEC
0146 write(ioUnit,'(A,5I6,I12)') 'RECV_X:',myProcId
0147 #endif
c806179eb4 Alis*0148
bd12238ff3 Jean*0149 IF ( .NOT.exchUsesBarrier ) THEN
0150 DO bj=1,nSy
0151 DO bi=1,nSx
0152 IF ( exchNReqsX(1,bi,bj) .GT. 0 ) THEN
0153 #ifdef ALLOW_USE_MPI
48e4fc2750 Jean*0154 IF ( usingMPI )
0155 & CALL MPI_Waitall( exchNReqsX(1,bi,bj), exchReqIdX(1,1,bi,bj),
bd12238ff3 Jean*0156 & mpiStatus, mpiRC )
0157 #endif /* ALLOW_USE_MPI */
0158 ENDIF
0159
0160 exchNReqsX(1,bi,bj) = 0
0161 ENDDO
0162 ENDDO
0163 ENDIF
0164
0165 _END_MASTER(myThid)
0166
0167
0168
0169 _BARRIER
0170
0171
0172
0173
0174 #ifdef EXCH_USE_SPINNING
c806179eb4 Alis*0175 IF ( exchUsesBarrier ) THEN
0176
0177 CALL BARRIER( myThid )
0178 ELSE
0179
0180
0181 DO bj=myByLo(myThid),myByHi(myThid)
0182 DO bi=myBxLo(myThid),myBxHi(myThid)
0183 spinCount = 0
0184 westCommMode = _tileCommModeW(bi,bj)
0185 eastCommMode = _tileCommModeE(bi,bj)
aa582c8e8c Jean*0186 #ifdef DBUG_EXCH_VEC
0187 write(ioUnit,'(A,5I6,I12)') 'spin:', myProcId,bi,bj,
0188 & westRecvAck(1,bi,bj), eastRecvAck(1,bi,bj), spinCount
0189 #endif
c806179eb4 Alis*0190 10 CONTINUE
27977973af Jean*0191 CALL FOOL_THE_COMPILER( spinCount )
c806179eb4 Alis*0192 spinCount = spinCount+1
aa582c8e8c Jean*0193 #ifdef DBUG_EXCH_VEC
0194 write(ioUnit,'(A,5I6,I12)') 'spin:', myProcId,bi,bj,
0195 & westRecvAck(1,bi,bj), eastRecvAck(1,bi,bj), spinCount
0196 IF ( myThid.EQ.1 .AND. spinCount.GT. _EXCH_SPIN_LIMIT ) THEN
0197 STOP ' S/R EXCH_RECV_GET_X: spinCount > _EXCH_SPIN_LIMIT'
0198 ENDIF
0199 #endif
0200 IF ( westRecvAck(1,bi,bj) .EQ. 0 ) GOTO 10
0201 IF ( eastRecvAck(1,bi,bj) .EQ. 0 ) GOTO 10
c806179eb4 Alis*0202
aa582c8e8c Jean*0203 westRecvAck(1,bi,bj) = 0
0204 eastRecvAck(1,bi,bj) = 0
c806179eb4 Alis*0205 ENDDO
0206 ENDDO
0207 ENDIF
bd12238ff3 Jean*0208 #endif /* EXCH_USE_SPINNING */
c806179eb4 Alis*0209
0210 RETURN
0211 END
0212
eacecc7041 Jean*0213
aa582c8e8c Jean*0214
48e4fc2750 Jean*0215
c806179eb4 Alis*0216
aa582c8e8c Jean*0217
48e4fc2750 Jean*0218 SUBROUTINE EXCH_RECV_GET_VEC_Y_RL(
121ecfb57a Jean*0219 U arrayN, arrayS,
0220 I myd1, myThid )
aa582c8e8c Jean*0221
0222
48e4fc2750 Jean*0223
aa582c8e8c Jean*0224
0225
0226
0227
0228
0229
0230
c806179eb4 Alis*0231 IMPLICIT NONE
0232
0233
0234 #include "SIZE.h"
0235 #include "EEPARAMS.h"
0236 #include "EESUPPORT.h"
0237 #include "EXCH.h"
0238
aa582c8e8c Jean*0239
0240
0241
0242
0243
c806179eb4 Alis*0244 INTEGER myd1
0245 _RL arrayN(myd1, nSx, nSy), arrayS(myd1, nSx, nSy)
0246 INTEGER myThid
aa582c8e8c Jean*0247
c806179eb4 Alis*0248
aa582c8e8c Jean*0249
0250
0251
0252
b0bdd58b37 Chri*0253
0254
0255
0256
aa582c8e8c Jean*0257
0258
121ecfb57a Jean*0259 INTEGER bi, bj
0260
c806179eb4 Alis*0261 INTEGER southCommMode
0262 INTEGER northCommMode
aa582c8e8c Jean*0263 INTEGER ioUnit
e1fb02e8f0 Jean*0264 #ifdef EXCH_USE_SPINNING
0265 INTEGER spinCount
0266 #endif
c806179eb4 Alis*0267 #ifdef ALLOW_USE_MPI
0268 INTEGER theProc, theTag, theType, theSize
0269 INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc
0270 #endif
0271
ef53b829d7 Jean*0272
c806179eb4 Alis*0273
ef53b829d7 Jean*0274
c806179eb4 Alis*0275
0276
aa582c8e8c Jean*0277
c806179eb4 Alis*0278
0279
0280
0281
aa582c8e8c Jean*0282 ioUnit = errorMessageUnit
c806179eb4 Alis*0283
bd12238ff3 Jean*0284 _BEGIN_MASTER(myThid)
0285
0286 DO bj=1,nSy
0287 DO bi=1,nSx
c806179eb4 Alis*0288 southCommMode = _tileCommModeS(bi,bj)
0289 northCommMode = _tileCommModeN(bi,bj)
aa582c8e8c Jean*0290 #ifdef DBUG_EXCH_VEC
0291 write(ioUnit,'(A,5I6)') 'RECV_Y,0 :',myProcId,bi,bj
0292 #endif
121ecfb57a Jean*0293
0294
0295
0296
c806179eb4 Alis*0297 IF ( southCommMode .EQ. COMM_MSG ) THEN
0298 #ifdef ALLOW_USE_MPI
0299 IF ( usingMPI ) THEN
48e4fc2750 Jean*0300 theProc = tilePidS(bi,bj)
0301 theTag = _tileTagRecvS(bi,bj)
0302 theType = _MPI_TYPE_RL
0303 theSize = myd1
0304 CALL MPI_Recv( arrayS(1,bi,bj), theSize, theType,
0305 & theProc, theTag, MPI_COMM_MODEL,
0306 & mpiStatus, mpiRc )
aa582c8e8c Jean*0307 ENDIF
c806179eb4 Alis*0308 #endif /* ALLOW_USE_MPI */
0309 ENDIF
aa582c8e8c Jean*0310 #ifdef DBUG_EXCH_VEC
0311 write(ioUnit,'(A,5I6)') 'RECV_Y,1 :',myProcId,bi,bj
0312 #endif
48e4fc2750 Jean*0313
c806179eb4 Alis*0314 IF ( northCommMode .EQ. COMM_MSG ) THEN
0315 #ifdef ALLOW_USE_MPI
0316 IF ( usingMPI ) THEN
48e4fc2750 Jean*0317 theProc = tilePidN(bi,bj)
0318 theTag = _tileTagRecvN(bi,bj)
0319 theType = _MPI_TYPE_RL
0320 theSize = myd1
0321 CALL MPI_Recv( arrayN(1,bi,bj), theSize, theType,
0322 & theProc, theTag, MPI_COMM_MODEL,
0323 & mpiStatus, mpiRc )
aa582c8e8c Jean*0324 ENDIF
c806179eb4 Alis*0325 #endif /* ALLOW_USE_MPI */
0326 ENDIF
aa582c8e8c Jean*0327 #ifdef DBUG_EXCH_VEC
0328 write(ioUnit,'(A,5I6)') 'RECV_Y,2 :',myProcId,bi,bj
0329 #endif
c806179eb4 Alis*0330 ENDDO
0331 ENDDO
aa582c8e8c Jean*0332 #ifdef DBUG_EXCH_VEC
0333 write(ioUnit,'(A,5I6,I12)') 'RECV_Y:',myProcId
0334 #endif
c806179eb4 Alis*0335
bd12238ff3 Jean*0336
0337 IF ( .NOT.exchUsesBarrier ) THEN
0338 DO bj=1,nSy
0339 DO bi=1,nSx
0340 IF ( exchNReqsY(1,bi,bj) .GT. 0 ) THEN
0341 #ifdef ALLOW_USE_MPI
48e4fc2750 Jean*0342 IF ( usingMPI )
0343 & CALL MPI_Waitall( exchNReqsY(1,bi,bj), exchReqIdY(1,1,bi,bj),
bd12238ff3 Jean*0344 & mpiStatus, mpiRC )
0345 #endif /* ALLOW_USE_MPI */
0346 ENDIF
0347
0348 exchNReqsY(1,bi,bj) = 0
0349 ENDDO
0350 ENDDO
0351 ENDIF
0352
0353 _END_MASTER(myThid)
0354
0355
0356
0357 _BARRIER
0358
0359
0360
0361
0362 #ifdef EXCH_USE_SPINNING
c806179eb4 Alis*0363 IF ( exchUsesBarrier ) THEN
0364
0365 CALL BARRIER( myThid )
0366 ELSE
0367
0368
0369 DO bj=myByLo(myThid),myByHi(myThid)
0370 DO bi=myBxLo(myThid),myBxHi(myThid)
0371 spinCount = 0
0372 southCommMode = _tileCommModeS(bi,bj)
0373 northCommMode = _tileCommModeN(bi,bj)
aa582c8e8c Jean*0374 #ifdef DBUG_EXCH_VEC
0375 write(ioUnit,'(A,5I6,I12)') 'spin:', myProcId,bi,bj,
0376 & southRecvAck(1,bi,bj), northRecvAck(1,bi,bj), spinCount
0377 #endif
c806179eb4 Alis*0378 10 CONTINUE
27977973af Jean*0379 CALL FOOL_THE_COMPILER( spinCount )
c806179eb4 Alis*0380 spinCount = spinCount+1
aa582c8e8c Jean*0381 #ifdef DBUG_EXCH_VEC
0382 write(ioUnit,'(A,5I6,I12)') 'spin:', myProcId,bi,bj,
0383 & southRecvAck(1,bi,bj), northRecvAck(1,bi,bj), spinCount
0384 IF ( myThid.EQ.1 .AND. spinCount.GT. _EXCH_SPIN_LIMIT ) THEN
0385 STOP ' S/R EXCH_RECV_GET_X: spinCount > _EXCH_SPIN_LIMIT'
0386 ENDIF
0387 #endif
0388 IF ( southRecvAck(1,bi,bj) .EQ. 0 ) GOTO 10
0389 IF ( northRecvAck(1,bi,bj) .EQ. 0 ) GOTO 10
c806179eb4 Alis*0390
aa582c8e8c Jean*0391 southRecvAck(1,bi,bj) = 0
0392 northRecvAck(1,bi,bj) = 0
c806179eb4 Alis*0393 ENDDO
0394 ENDDO
0395 ENDIF
bd12238ff3 Jean*0396 #endif /* EXCH_USE_SPINNING */
c806179eb4 Alis*0397
0398 RETURN
0399 END