78 |
INTEGER northCommMode |
INTEGER northCommMode |
79 |
INTEGER spinCount |
INTEGER spinCount |
80 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
81 |
INTEGER theProc, theTag, theType, theSize |
INTEGER theProc, theTag, theType, theSize, pReqI |
82 |
INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc |
INTEGER mpiStatus(MPI_STATUS_SIZE,4), mpiRc |
83 |
#endif |
#endif |
84 |
CEOP |
CEOP |
95 |
IF ( usingMPI ) THEN |
IF ( usingMPI ) THEN |
96 |
#endif |
#endif |
97 |
C Set default behavior to have MPI comms done by a single thread. |
C Set default behavior to have MPI comms done by a single thread. |
98 |
C Most MPI implementations don't support concurrent comms from |
C Most MPI implementations do not support concurrent comms from |
99 |
C several threads. |
C several threads. |
100 |
IF ( nThreads .GT. 1 ) THEN |
IF ( nThreads .GT. 1 ) THEN |
101 |
_BARRIER |
_BARRIER |
157 |
theSize = sNx*exchWidthY*myNz |
theSize = sNx*exchWidthY*myNz |
158 |
IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) |
IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) |
159 |
& theSize = (sNx+2*exchWidthX)*exchWidthY*myNz |
& theSize = (sNx+2*exchWidthX)*exchWidthY*myNz |
160 |
# ifndef ALLOW_AUTODIFF_OPENAD |
# ifndef ALLOW_AUTODIFF_OPENAD_AMPI |
161 |
CALL MPI_Recv( southRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
CALL MPI_Recv( southRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
162 |
& theProc, theTag, MPI_COMM_MODEL, |
& theProc, theTag, MPI_COMM_MODEL, |
163 |
& mpiStatus, mpiRc ) |
& mpiStatus, mpiRc ) |
164 |
# else |
# else |
165 |
|
pReqI=exchNReqsY(1,bi,bj)+1 |
166 |
CALL ampi_recv_RX( |
CALL ampi_recv_RX( |
167 |
& southRecvBuf_RX(1,eBl,bi,bj) , |
& southRecvBuf_RX(1,eBl,bi,bj) , |
168 |
& theSize , |
& theSize , |
170 |
& theProc , |
& theProc , |
171 |
& theTag , |
& theTag , |
172 |
& MPI_COMM_MODEL , |
& MPI_COMM_MODEL , |
173 |
|
& exchReqIdY(pReqI,1,bi,bj), |
174 |
|
& exchNReqsY(1,bi,bj), |
175 |
& mpiStatus , |
& mpiStatus , |
176 |
& mpiRc ) |
& mpiRc ) |
177 |
# endif /* ALLOW_AUTODIFF_OPENAD */ |
# endif /* ALLOW_AUTODIFF_OPENAD_AMPI */ |
178 |
#ifndef ALWAYS_USE_MPI |
#ifndef ALWAYS_USE_MPI |
179 |
ENDIF |
ENDIF |
180 |
#endif |
#endif |
191 |
theSize = sNx*exchWidthY*myNz |
theSize = sNx*exchWidthY*myNz |
192 |
IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) |
IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) |
193 |
& theSize = (sNx+2*exchWidthX)*exchWidthY*myNz |
& theSize = (sNx+2*exchWidthX)*exchWidthY*myNz |
194 |
# ifndef ALLOW_AUTODIFF_OPENAD |
# ifndef ALLOW_AUTODIFF_OPENAD_AMPI |
195 |
CALL MPI_Recv( northRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
CALL MPI_Recv( northRecvBuf_RX(1,eBl,bi,bj), theSize, theType, |
196 |
& theProc, theTag, MPI_COMM_MODEL, |
& theProc, theTag, MPI_COMM_MODEL, |
197 |
& mpiStatus, mpiRc ) |
& mpiStatus, mpiRc ) |
198 |
# else |
# else |
199 |
|
pReqI=exchNReqsY(1,bi,bj)+1 |
200 |
CALL ampi_recv_RX( |
CALL ampi_recv_RX( |
201 |
& northRecvBuf_RX(1,eBl,bi,bj) , |
& northRecvBuf_RX(1,eBl,bi,bj) , |
202 |
& theSize , |
& theSize , |
204 |
& theProc , |
& theProc , |
205 |
& theTag , |
& theTag , |
206 |
& MPI_COMM_MODEL , |
& MPI_COMM_MODEL , |
207 |
|
& exchReqIdY(pReqI,1,bi,bj), |
208 |
|
& exchNReqsY(1,bi,bj), |
209 |
& mpiStatus , |
& mpiStatus , |
210 |
& mpiRc ) |
& mpiRc ) |
211 |
# endif /* ALLOW_AUTODIFF_OPENAD */ |
# endif /* ALLOW_AUTODIFF_OPENAD_AMPI */ |
212 |
#ifndef ALWAYS_USE_MPI |
#ifndef ALWAYS_USE_MPI |
213 |
ENDIF |
ENDIF |
214 |
#endif |
#endif |
230 |
southCommMode = _tileCommModeS(bi,bj) |
southCommMode = _tileCommModeS(bi,bj) |
231 |
northCommMode = _tileCommModeN(bi,bj) |
northCommMode = _tileCommModeN(bi,bj) |
232 |
spinCount = 0 |
spinCount = 0 |
233 |
# ifndef ALLOW_AUTODIFF_OPENAD |
# ifndef ALLOW_AUTODIFF_OPENAD_AMPI |
234 |
10 CONTINUE |
10 CONTINUE |
235 |
CALL FOOL_THE_COMPILER( spinCount ) |
CALL FOOL_THE_COMPILER( spinCount ) |
236 |
spinCount = spinCount+1 |
spinCount = spinCount+1 |
240 |
IF ( southRecvAck(eBl,bi,bj) .EQ. 0 ) GOTO 10 |
IF ( southRecvAck(eBl,bi,bj) .EQ. 0 ) GOTO 10 |
241 |
IF ( northRecvAck(eBl,bi,bj) .EQ. 0 ) GOTO 10 |
IF ( northRecvAck(eBl,bi,bj) .EQ. 0 ) GOTO 10 |
242 |
# else |
# else |
243 |
do while ((southRecvAck(eBl,bi,bj) .EQ. 0. |
do while ((southRecvAck(eBl,bi,bj) .EQ. 0. |
244 |
& .or. |
& .or. |
245 |
& northRecvAck(eBl,bi,bj) .EQ. 0. )) |
& northRecvAck(eBl,bi,bj) .EQ. 0. )) |
246 |
CALL FOOL_THE_COMPILER( spinCount ) |
CALL FOOL_THE_COMPILER( spinCount ) |
247 |
spinCount = spinCount+1 |
spinCount = spinCount+1 |
248 |
end do |
end do |
249 |
# endif /* ALLOW_AUTODIFF_OPENAD */ |
# endif /* ALLOW_AUTODIFF_OPENAD_AMPI */ |
250 |
C Clear requests |
C Clear requests |
251 |
southRecvAck(eBl,bi,bj) = 0 |
southRecvAck(eBl,bi,bj) = 0 |
252 |
northRecvAck(eBl,bi,bj) = 0 |
northRecvAck(eBl,bi,bj) = 0 |
267 |
#ifndef ALWAYS_USE_MPI |
#ifndef ALWAYS_USE_MPI |
268 |
IF ( usingMPI ) THEN |
IF ( usingMPI ) THEN |
269 |
#endif |
#endif |
270 |
|
# ifndef ALLOW_AUTODIFF_OPENAD_AMPI |
271 |
CALL MPI_Waitall( exchNReqsY(1,bi,bj), exchReqIdY(1,1,bi,bj), |
CALL MPI_Waitall( exchNReqsY(1,bi,bj), exchReqIdY(1,1,bi,bj), |
272 |
& mpiStatus, mpiRC ) |
& mpiStatus, mpiRC ) |
273 |
|
# else |
274 |
|
CALL ampi_waitall( |
275 |
|
& exchNReqsY(1,bi,bj), |
276 |
|
& exchReqIdY(1,1,bi,bj), |
277 |
|
& mpiStatus, |
278 |
|
& mpiRC ) |
279 |
|
# endif /* ALLOW_AUTODIFF_OPENAD_AMPI */ |
280 |
#ifndef ALWAYS_USE_MPI |
#ifndef ALWAYS_USE_MPI |
281 |
ENDIF |
ENDIF |
282 |
#endif |
#endif |