2 |
C $Name$ |
C $Name$ |
3 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
4 |
|
|
5 |
|
CBOP |
6 |
|
C !ROUTINE: EXCH_RX_RECV_GET_X |
7 |
|
|
8 |
|
C !INTERFACE: |
9 |
SUBROUTINE EXCH_RX_RECV_GET_X( array, |
SUBROUTINE EXCH_RX_RECV_GET_X( array, |
10 |
I myOLw, myOLe, myOLs, myOLn, myNz, |
I myOLw, myOLe, myOLs, myOLn, myNz, |
11 |
I exchWidthX, exchWidthY, |
I exchWidthX, exchWidthY, |
12 |
I theSimulationMode, theCornerMode, myThid ) |
I theSimulationMode, theCornerMode, myThid ) |
|
C /==========================================================\ |
|
|
C | SUBROUTINE RECV_RX_GET_X | |
|
|
C | o "Send" or "put" X edges for RX array. | |
|
|
C |==========================================================| |
|
|
C | Routine that invokes actual message passing send or | |
|
|
C | direct "put" of data to update X faces of an XY[R] array.| |
|
|
C \==========================================================/ |
|
13 |
IMPLICIT NONE |
IMPLICIT NONE |
14 |
|
|
15 |
|
C !DESCRIPTION: |
16 |
|
C *==========================================================* |
17 |
|
C | SUBROUTINE RECV_RX_GET_X |
18 |
|
C | o "Send" or "put" X edges for RX array. |
19 |
|
C *==========================================================* |
20 |
|
C | Routine that invokes actual message passing send or |
21 |
|
C | direct "put" of data to update X faces of an XY[R] array. |
22 |
|
C *==========================================================* |
23 |
|
|
24 |
|
C !USES: |
25 |
C == Global variables == |
C == Global variables == |
26 |
#include "SIZE.h" |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
28 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
29 |
#include "EXCH.h" |
#include "EXCH.h" |
30 |
|
|
31 |
|
C !INPUT/OUTPUT PARAMETERS: |
32 |
C == Routine arguments == |
C == Routine arguments == |
33 |
C array - Array with edges to exchange. |
C array :: Array with edges to exchange. |
34 |
C myOLw - West, East, North and South overlap region sizes. |
C myOLw :: West, East, North and South overlap region sizes. |
35 |
C myOLe |
C myOLe |
36 |
C myOLn |
C myOLn |
37 |
C myOLs |
C myOLs |
38 |
C exchWidthX - Width of data region exchanged. |
C exchWidthX :: Width of data region exchanged. |
39 |
C exchWidthY |
C exchWidthY |
40 |
C theSimulationMode - Forward or reverse mode exchange ( provides |
C theSimulationMode :: Forward or reverse mode exchange ( provides |
41 |
C support for adjoint integration of code. ) |
C support for adjoint integration of code. ) |
42 |
C theCornerMode - Flag indicating whether corner updates are |
C theCornerMode :: Flag indicating whether corner updates are |
43 |
C needed. |
C needed. |
44 |
C myThid - Thread number of this instance of S/R EXCH... |
C myThid :: Thread number of this instance of S/R EXCH... |
45 |
C eBl - Edge buffer level |
C eBl :: Edge buffer level |
46 |
INTEGER myOLw |
INTEGER myOLw |
47 |
INTEGER myOLe |
INTEGER myOLe |
48 |
INTEGER myOLs |
INTEGER myOLs |
56 |
INTEGER theSimulationMode |
INTEGER theSimulationMode |
57 |
INTEGER theCornerMode |
INTEGER theCornerMode |
58 |
INTEGER myThid |
INTEGER myThid |
|
CEndOfInterface |
|
59 |
|
|
60 |
|
C !LOCAL VARIABLES: |
61 |
C == Local variables == |
C == Local variables == |
62 |
C I, J, K, iMin, iMax, iB - Loop counters and extents |
C I, J, K, iMin, iMax, iB :: Loop counters and extents |
63 |
C bi, bj |
C bi, bj |
64 |
C biW, bjW - West tile indices |
C biW, bjW :: West tile indices |
65 |
C biE, bjE - East tile indices |
C biE, bjE :: East tile indices |
66 |
C eBl - Current exchange buffer level |
C eBl :: Current exchange buffer level |
67 |
C theProc, theTag, theType, - Variables used in message building |
C theProc, theTag, theType, :: Variables used in message building |
68 |
C theSize |
C theSize |
69 |
C westCommMode - Working variables holding type |
C westCommMode :: Working variables holding type |
70 |
C eastCommMode of communication a particular |
C eastCommMode of communication a particular |
71 |
C tile face uses. |
C tile face uses. |
72 |
INTEGER I, J, K, iMin, iMax, iB, iB0 |
INTEGER I, J, K, iMin, iMax, iB, iB0 |
73 |
INTEGER bi, bj, biW, bjW, biE, bjE |
INTEGER bi, bj, biW, bjW, biE, bjE |
74 |
INTEGER eBl |
INTEGER eBl |
79 |
INTEGER theProc, theTag, theType, theSize |
INTEGER theProc, theTag, theType, theSize |
80 |
INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc |
INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc |
81 |
#endif |
#endif |
82 |
|
CEOP |
83 |
|
|
84 |
|
#ifdef USE_SINGLE_THREADED_EXCH_COMMS |
85 |
|
INTEGER myBxLoSave(MAX_NO_THREADS) |
86 |
|
INTEGER myBxHiSave(MAX_NO_THREADS) |
87 |
|
INTEGER myByLoSave(MAX_NO_THREADS) |
88 |
|
INTEGER myByHiSave(MAX_NO_THREADS) |
89 |
|
#endif /* SINGLE_THREADED_EXCH_COMMS */ |
90 |
|
|
91 |
|
#ifdef USE_SINGLE_THREADED_EXCH_COMMS |
92 |
|
_BARRIER |
93 |
|
IF ( myThid .EQ. 1 ) THEN |
94 |
|
DO I=1,nThreads |
95 |
|
myBxLoSave(I) = myBxLo(I) |
96 |
|
myBxHiSave(I) = myBxHi(I) |
97 |
|
myByLoSave(I) = myByLo(I) |
98 |
|
myByHiSave(I) = myByHi(I) |
99 |
|
myBxLo(I) = 0 |
100 |
|
myBxHi(I) = -1 |
101 |
|
myByLo(I) = 0 |
102 |
|
myByHi(I) = -1 |
103 |
|
ENDDO |
104 |
|
myBxLo(1) = 1 |
105 |
|
myBxHi(1) = nSx |
106 |
|
myByLo(1) = 1 |
107 |
|
myByHi(1) = nSy |
108 |
|
ENDIF |
109 |
|
_BARRIER |
110 |
|
#endif /* SINGLE_THREADED_EXCH_COMMS */ |
111 |
|
|
112 |
|
|
113 |
C-- Under a "put" scenario we |
C-- Under a "put" scenario we |
137 |
#endif |
#endif |
138 |
theProc = tilePidW(bi,bj) |
theProc = tilePidW(bi,bj) |
139 |
theTag = _tileTagRecvW(bi,bj) |
theTag = _tileTagRecvW(bi,bj) |
140 |
theType = MPI_DOUBLE_PRECISION |
theType = _MPI_TYPE_RX |
141 |
theSize = sNy*exchWidthX*myNz |
theSize = sNy*exchWidthX*myNz |
142 |
CALL MPI_Recv( westRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
CALL MPI_Recv( westRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
143 |
& theProc, theTag, MPI_COMM_MODEL, |
& theProc, theTag, MPI_COMM_MODEL, |
154 |
#endif |
#endif |
155 |
theProc = tilePidE(bi,bj) |
theProc = tilePidE(bi,bj) |
156 |
theTag = _tileTagRecvE(bi,bj) |
theTag = _tileTagRecvE(bi,bj) |
157 |
theType = MPI_DOUBLE_PRECISION |
theType = _MPI_TYPE_RX |
158 |
theSize = sNy*exchWidthX*myNz |
theSize = sNy*exchWidthX*myNz |
159 |
CALL MPI_Recv( eastRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
CALL MPI_Recv( eastRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
160 |
& theProc, theTag, MPI_COMM_MODEL, |
& theProc, theTag, MPI_COMM_MODEL, |
181 |
westCommMode = _tileCommModeW(bi,bj) |
westCommMode = _tileCommModeW(bi,bj) |
182 |
eastCommMode = _tileCommModeE(bi,bj) |
eastCommMode = _tileCommModeE(bi,bj) |
183 |
10 CONTINUE |
10 CONTINUE |
184 |
CALL FOOL_THE_COMPILER |
CALL FOOL_THE_COMPILER( spinCount ) |
185 |
spinCount = spinCount+1 |
spinCount = spinCount+1 |
186 |
C IF ( myThid .EQ. 1 .AND. spinCount .GT. _EXCH_SPIN_LIMIT ) THEN |
C IF ( myThid .EQ. 1 .AND. spinCount .GT. _EXCH_SPIN_LIMIT ) THEN |
187 |
C WRITE(*,*) ' eBl = ', ebl |
C WRITE(*,*) ' eBl = ', ebl |
346 |
ENDDO |
ENDDO |
347 |
ENDDO |
ENDDO |
348 |
|
|
349 |
|
#ifdef USE_SINGLE_THREADED_EXCH_COMMS |
350 |
|
_BARRIER |
351 |
|
IF ( myThid .EQ. 1 ) THEN |
352 |
|
DO I=1,nThreads |
353 |
|
myBxLo(I) = myBxLoSave(I) |
354 |
|
myBxHi(I) = myBxHiSave(I) |
355 |
|
myByLo(I) = myByLoSave(I) |
356 |
|
myByHi(I) = myByHiSave(I) |
357 |
|
ENDDO |
358 |
|
ENDIF |
359 |
|
_BARRIER |
360 |
|
#endif /* USE_SINGLE_THREADED_EXCH_COMMS */ |
361 |
|
|
362 |
RETURN |
RETURN |
363 |
END |
END |