3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
|
6 |
|
CBOP |
7 |
|
C !ROUTINE: EXCH_RX_CUBE |
8 |
|
|
9 |
|
C !INTERFACE: |
10 |
SUBROUTINE EXCH_RX_CUBE( |
SUBROUTINE EXCH_RX_CUBE( |
11 |
U array, |
U array, |
12 |
I myOLw, myOLe, myOLn, myOLs, myNz, |
I myOLw, myOLe, myOLn, myOLs, myNz, |
13 |
I exchWidthX, exchWidthY, |
I exchWidthX, exchWidthY, |
14 |
I simulationMode, cornerMode, myThid ) |
I simulationMode, cornerMode, myThid ) |
|
C /==========================================================\ |
|
|
C | SUBROUTINE EXCH_RX_CUBE | |
|
|
C | o Control edge exchanges for RX array. | |
|
|
C |==========================================================| |
|
|
C | | |
|
|
C | Controlling routine for exchange of XY edges of an array | |
|
|
C | distributed in X and Y. The routine interfaces to | |
|
|
C | communication routines that can use messages passing | |
|
|
C | exchanges, put type exchanges or get type exchanges. | |
|
|
C | This allows anything from MPI to raw memory channel to | |
|
|
C | memmap segments to be used as a inter-process and/or | |
|
|
C | inter-thread communiation and synchronisation | |
|
|
C | mechanism. | |
|
|
C | Notes -- | |
|
|
C | 1. Some low-level mechanisms such as raw memory-channel | |
|
|
C | or SGI/CRAY shmem put do not have direct Fortran bindings| |
|
|
C | and are invoked through C stub routines. | |
|
|
C | 2. Although this routine is fairly general but it does | |
|
|
C | require nSx and nSy are the same for all innvocations. | |
|
|
C | There are many common data structures ( myByLo, | |
|
|
C | westCommunicationMode, mpiIdW etc... ) tied in with | |
|
|
C | (nSx,nSy). To support arbitray nSx and nSy would require | |
|
|
C | general forms of these. | |
|
|
C | | |
|
|
C \==========================================================/ |
|
15 |
IMPLICIT NONE |
IMPLICIT NONE |
16 |
|
|
17 |
|
C !DESCRIPTION: |
18 |
|
C *==========================================================* |
19 |
|
C | SUBROUTINE EXCH_RX_CUBE |
20 |
|
C | o Control edge exchanges for RX array. |
21 |
|
C *==========================================================* |
22 |
|
C | |
23 |
|
C | Controlling routine for exchange of XY edges of an array |
24 |
|
C | distributed in X and Y. The routine interfaces to |
25 |
|
C | communication routines that can use messages passing |
26 |
|
C | exchanges, put type exchanges or get type exchanges. |
27 |
|
C | This allows anything from MPI to raw memory channel to |
28 |
|
C | memmap segments to be used as a inter-process and/or |
29 |
|
C | inter-thread communiation and synchronisation |
30 |
|
C | mechanism. |
31 |
|
C | Notes -- |
32 |
|
C | 1. Some low-level mechanisms such as raw memory-channel |
33 |
|
C | or SGI/CRAY shmem put do not have direct Fortran bindings |
34 |
|
C | and are invoked through C stub routines. |
35 |
|
C | 2. Although this routine is fairly general but it does |
36 |
|
C | require nSx and nSy are the same for all innvocations. |
37 |
|
C | There are many common data structures ( myByLo, |
38 |
|
C | westCommunicationMode, mpiIdW etc... ) tied in with |
39 |
|
C | (nSx,nSy). To support arbitray nSx and nSy would require |
40 |
|
C | general forms of these. |
41 |
|
C | |
42 |
|
C *==========================================================* |
43 |
|
|
44 |
|
C !USES: |
45 |
C == Global data == |
C == Global data == |
46 |
#include "SIZE.h" |
#include "SIZE.h" |
47 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
48 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
49 |
#include "EXCH.h" |
#include "EXCH.h" |
50 |
|
|
51 |
|
C !INPUT/OUTPUT PARAMETERS: |
52 |
C == Routine arguments == |
C == Routine arguments == |
53 |
C array - Array with edges to exchange. |
C array :: Array with edges to exchange. |
54 |
C myOLw - West, East, North and South overlap region sizes. |
C myOLw :: West, East, North and South overlap region sizes. |
55 |
C myOLe |
C myOLe |
56 |
C myOLn |
C myOLn |
57 |
C myOLs |
C myOLs |
58 |
C exchWidthX - Width of data region exchanged in X. |
C exchWidthX :: Width of data region exchanged in X. |
59 |
C exchWidthY - Width of data region exchanged in Y. |
C exchWidthY :: Width of data region exchanged in Y. |
60 |
C Note -- |
C Note -- |
61 |
C 1. In theory one could have a send width and |
C 1. In theory one could have a send width and |
62 |
C a receive width for each face of each tile. The only |
C a receive width for each face of each tile. The only |
63 |
C restriction woul be that the send width of one |
C restriction woul be that the send width of one |
64 |
C face should equal the receive width of the sent to |
C face should equal the receive width of the sent to |
65 |
C tile face. Dont know if this would be useful. I |
C tile face. Dont know if this would be useful. I |
66 |
C have left it out for now as it requires additional |
C have left it out for now as it requires additional |
67 |
C bookeeping. |
C bookeeping. |
68 |
C simulationMode - Forward or reverse mode exchange ( provides |
C simulationMode :: Forward or reverse mode exchange ( provides |
69 |
C support for adjoint integration of code. ) |
C support for adjoint integration of code. ) |
70 |
C cornerMode - Flag indicating whether corner updates are |
C cornerMode :: Flag indicating whether corner updates are |
71 |
C needed. |
C needed. |
72 |
C myThid - Thread number of this instance of S/R EXCH... |
C myThid :: Thread number of this instance of S/R EXCH... |
73 |
INTEGER myOLw |
INTEGER myOLw |
74 |
INTEGER myOLe |
INTEGER myOLe |
75 |
INTEGER myOLs |
INTEGER myOLs |
84 |
& 1-myOLs:sNy+myOLn, |
& 1-myOLs:sNy+myOLn, |
85 |
& myNZ, nSx, nSy) |
& myNZ, nSx, nSy) |
86 |
|
|
87 |
|
C !LOCAL VARIABLES: |
88 |
C == Local variables == |
C == Local variables == |
89 |
C theSimulationMode - Holds working copy of simulation mode |
C theSimulationMode :: Holds working copy of simulation mode |
90 |
C theCornerMode - Holds working copy of corner mode |
C theCornerMode :: Holds working copy of corner mode |
91 |
|
C I,J,K,bl,bt,bn,bs :: Loop and index counters |
92 |
|
C be,bw |
93 |
INTEGER theSimulationMode |
INTEGER theSimulationMode |
94 |
INTEGER theCornerMode |
INTEGER theCornerMode |
95 |
INTEGER I,J,K |
INTEGER I,J,K |
96 |
INTEGER bl,bt,bn,bs,be,bw |
INTEGER bl,bt,bn,bs,be,bw |
|
|
|
97 |
C == Statement function == |
C == Statement function == |
98 |
C tilemod - Permutes indices to return neighboring tile index on |
C tilemod - Permutes indices to return neighboring tile index on |
99 |
C six face cube. |
C six face cube. |
100 |
INTEGER tilemod |
INTEGER tilemod |
101 |
tilemod(I)=1+mod(I-1+6,6) |
tilemod(I)=1+mod(I-1+6,6) |
102 |
|
CEOP |
103 |
|
|
104 |
theSimulationMode = simulationMode |
theSimulationMode = simulationMode |
105 |
theCornerMode = cornerMode |
theCornerMode = cornerMode |