1 |
|
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
|
#include "CPP_EEOPTIONS.h" |
5 |
|
|
6 |
|
SUBROUTINE EXCH_XYZ_RX( |
7 |
|
U phi, |
8 |
|
I myThid ) |
9 |
|
C /==========================================================\ |
10 |
|
C | SUBROUTINE EXCH_XYZ_RX | |
11 |
|
C | o Handle exchanges for _RX , three-dimensional arrays. | |
12 |
|
C |==========================================================| |
13 |
|
C | Do true shared-memory data transfers and "messaging" | |
14 |
|
C | tranfers for blocking case of data transfers. | |
15 |
|
C | Applications call this routine using | |
16 |
|
C | CALL EXCH..( x, myThid ) | |
17 |
|
C | where x is a three-dimensional array with overlaps. | |
18 |
|
C | This routine does true-shared-memory copies for blocks | |
19 |
|
C | within a thread. It will also do MPI meesaging between | |
20 |
|
C | different processes. | |
21 |
|
C | Note: | |
22 |
|
C | ===== | |
23 |
|
C | If it is used, "asynchronous" messaging in which | |
24 |
|
C | communication overlaps computation is handled elsewhere | |
25 |
|
C | - see recv.F and send.F. | |
26 |
|
C | In practice MPI implementations may not be completely | |
27 |
|
C | thread safe. In principle this code is correct even for | |
28 |
|
C | mixed MPI and multi-threaded execution. | |
29 |
|
C | In multi-thread execution data managed by other threads | |
30 |
|
C | is only automatically visible to another thread if it | |
31 |
|
C | existed before the thread was created. This means that | |
32 |
|
C | for Fortran we declare arrays with overlap regions in | |
33 |
|
C | COMMON blocks. | |
34 |
|
C \==========================================================/ |
35 |
|
IMPLICIT NONE |
36 |
|
|
37 |
|
C === Global data === |
38 |
|
#include "SIZE.h" |
39 |
|
#include "EEPARAMS.h" |
40 |
|
#include "EESUPPORT.h" |
41 |
|
|
42 |
|
C === Routine arguments === |
43 |
|
C phi - Array with overlap regions are to be exchanged |
44 |
|
C myThid - My thread id. |
45 |
|
_RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
46 |
|
INTEGER myThid |
47 |
|
|
48 |
|
C == Local variables == |
49 |
|
C OL[wens] - Overlap extents in west, east, north, south. |
50 |
|
C exchWidth[XY] - Extent of regions that will be exchanged. |
51 |
|
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
52 |
|
|
53 |
|
OLw = OLx |
54 |
|
OLe = OLx |
55 |
|
OLn = OLy |
56 |
|
OLs = OLy |
57 |
|
exchWidthX = OLx |
58 |
|
exchWidthY = OLy |
59 |
|
myNz = Nr |
60 |
|
C ** NOTE ** The exchange routine we use here does not |
61 |
|
C require the preceeding and following barriers. |
62 |
|
C However, the slow, simple exchange interface |
63 |
|
C that is calling it here is meant to ensure |
64 |
|
C that threads are synchronised before exchanges |
65 |
|
C begine. |
66 |
|
IF (useCubedSphereExchange) THEN |
67 |
|
CALL EXCH_RX_CUBE( phi, |
68 |
|
I OLw, OLe, OLs, OLn, myNz, |
69 |
|
I exchWidthX, exchWidthY, |
70 |
|
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
71 |
|
ELSE |
72 |
|
CALL EXCH_RX( phi, |
73 |
|
I OLw, OLe, OLs, OLn, myNz, |
74 |
|
I exchWidthX, exchWidthY, |
75 |
|
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
76 |
|
ENDIF |
77 |
|
|
78 |
|
RETURN |
79 |
|
END |