2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
CBOP |
6 |
|
|
7 |
|
C !ROUTINE: EXCH_XYZ_RX |
8 |
|
|
9 |
|
C !INTERFACE: |
10 |
SUBROUTINE EXCH_XYZ_RX( |
SUBROUTINE EXCH_XYZ_RX( |
11 |
U phi, |
U phi, |
12 |
I myThid ) |
I myThid ) |
|
C /==========================================================\ |
|
|
C | SUBROUTINE EXCH_XYZ_RX | |
|
|
C | o Handle exchanges for _RX , three-dimensional arrays. | |
|
|
C |==========================================================| |
|
|
C | Do true shared-memory data transfers and "messaging" | |
|
|
C | tranfers for blocking case of data transfers. | |
|
|
C | Applications call this routine using | |
|
|
C | CALL EXCH..( x, myThid ) | |
|
|
C | where x is a three-dimensional array with overlaps. | |
|
|
C | This routine does true-shared-memory copies for blocks | |
|
|
C | within a thread. It will also do MPI meesaging between | |
|
|
C | different processes. | |
|
|
C | Note: | |
|
|
C | ===== | |
|
|
C | If it is used, "asynchronous" messaging in which | |
|
|
C | communication overlaps computation is handled elsewhere | |
|
|
C | - see recv.F and send.F. | |
|
|
C | In practice MPI implementations may not be completely | |
|
|
C | thread safe. In principle this code is correct even for | |
|
|
C | mixed MPI and multi-threaded execution. | |
|
|
C | In multi-thread execution data managed by other threads | |
|
|
C | is only automatically visible to another thread if it | |
|
|
C | existed before the thread was created. This means that | |
|
|
C | for Fortran we declare arrays with overlap regions in | |
|
|
C | COMMON blocks. | |
|
|
C \==========================================================/ |
|
13 |
IMPLICIT NONE |
IMPLICIT NONE |
14 |
|
|
15 |
|
C !DESCRIPTION: |
16 |
|
C *==========================================================* |
17 |
|
C | SUBROUTINE EXCH_XYZ_RX |
18 |
|
C | o Handle exchanges for _RX, three-dim scalar arrays. |
19 |
|
C *==========================================================* |
20 |
|
C | Invoke appropriate exchange routine depending on type |
21 |
|
C | of grid (cube or globally indexed) to be operated on. |
22 |
|
C *==========================================================* |
23 |
|
|
24 |
|
C !USES: |
25 |
C === Global data === |
C === Global data === |
26 |
#include "SIZE.h" |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
28 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
29 |
|
|
30 |
|
C !INPUT/OUTPUT PARAMETERS: |
31 |
C === Routine arguments === |
C === Routine arguments === |
32 |
C phi - Array with overlap regions are to be exchanged |
C phi :: Array with overlap regions are to be exchanged |
33 |
C myThid - My thread id. |
C myThid :: My thread id. |
34 |
_RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
_RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
35 |
INTEGER myThid |
INTEGER myThid |
36 |
|
|
37 |
|
C !LOCAL VARIABLES: |
38 |
C == Local variables == |
C == Local variables == |
39 |
C OL[wens] - Overlap extents in west, east, north, south. |
C OL[wens] :: Overlap extents in west, east, north, south. |
40 |
C exchWidth[XY] - Extent of regions that will be exchanged. |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
41 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
42 |
|
|
43 |
|
CEOP |
44 |
|
|
45 |
OLw = OLx |
OLw = OLx |
46 |
OLe = OLx |
OLe = OLx |
47 |
OLn = OLy |
OLn = OLy |