/[MITgcm]/MITgcm/pkg/flt/exch2_send_put_vec.F
ViewVC logotype

Contents of /MITgcm/pkg/flt/exch2_send_put_vec.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Thu Sep 6 16:17:21 2012 UTC (11 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.2: +32 -38 lines
- rename S/R EXCH2_RL_SEND_PUT_VEC -> EXCH2_SEND_PUT_VEC_RL
     and S/R EXCH2_RL_RECV_GET_VEC -> EXCH2_RECV_GET_VEC_RL
  so that it closer to file names (exch_send_put_vec.F, exch_recv_get_vec.F)
  and match the printed messages
- move calls to MPI_Wait from FLT_EXCH2 to EXCH2_RECV_GET_VEC_RL
  (so that flt_exch2.F is free from MPI stuff)
- move BARRIER calls directly in flt_exch2.F (easier to follow)
- fix multi-threaded MPI (had many issues).
- finish to remove ALWAYS_USE_MPI in source code that TAF does not see.

1 C $Header: /u/gcmpack/MITgcm/pkg/flt/exch2_send_put_vec.F,v 1.2 2012/09/04 00:46:15 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_EEOPTIONS.h"
6 #undef DBUG_EXCH_VEC
7
8 C-- Contents
9 C-- o EXCH2_SEND_PUT_VEC_RL
10
11 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
12 CBOP 0
13 C !ROUTINE: EXCH2_SEND_PUT_VEC_RL
14
15 C !INTERFACE:
16 SUBROUTINE EXCH2_SEND_PUT_VEC_RL(
17 I array,
18 O bufRec,
19 O theHandle,
20 I myd1, myThid )
21 C !DESCRIPTION:
22 C *==========================================================*
23 C | SUBROUTINE EXCH2_SEND_PUT_VEC_RL
24 C | o "Send" or "put" edges for RL array.
25 C *==========================================================*
26 C | Routine that invokes actual message passing send or
27 C | direct "put" of data to update buffer
28 C *==========================================================*
29
30 C !USES:
31 IMPLICIT NONE
32
33 C == Global variables ==
34 #include "SIZE.h"
35 #include "EEPARAMS.h"
36 #include "EESUPPORT.h"
37 #ifdef ALLOW_EXCH2
38 #include "W2_EXCH2_SIZE.h"
39 #include "W2_EXCH2_TOPOLOGY.h"
40 #endif
41
42 C !INPUT/OUTPUT PARAMETERS:
43 C array :: Input buffer array to send to Neighbours
44 C bufRec :: buffer array to collect Neighbour values
45 C myd1 :: size
46 C myThid :: my Thread Id. number
47 INTEGER myd1
48 _RL array(myd1,nSx,nSy,4)
49 _RL bufRec(myd1,nSx,nSy,4)
50 #ifdef ALLOW_EXCH2
51 INTEGER theHandle(2,W2_maxNeighbours,nSx,nSy)
52 #else
53 INTEGER theHandle
54 #endif
55 INTEGER myThid
56 CEOP
57
58 #ifdef ALLOW_EXCH2
59
60 C !LOCAL VARIABLES:
61 C I :: Loop counters
62 C bi, bj :: tile indices
63 C theProc :: Variables used in message building
64 C theTag :: Variables used in message building
65 C theType :: Variables used in message building
66 C theSize :: Variables used in message building
67 INTEGER I,J,sBi,sBj, nN, thisTile, tgT, tgN, dir, sDir
68 INTEGER bi, bj
69 #ifdef ALLOW_USE_MPI
70 INTEGER theProc, theTag, theType, theSize, mpiRc
71 #endif
72 #ifdef DBUG_EXCH_VEC
73 INTEGER ioUnit
74 #endif
75
76 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
77 C-- Write data to exchange buffer
78 C Various actions are possible depending on the communication mode
79 C as follows:
80 C Mode Action
81 C -------- ---------------------------
82 C COMM_NONE Do nothing
83 C
84 C COMM_MSG Message passing communication ( e.g. MPI )
85 C Fill west send buffer from this tile.
86 C Send data with tag identifying tile and direction.
87 C Fill east send buffer from this tile.
88 C Send data with tag identifying tile and direction.
89 C
90 C COMM_PUT "Put" communication ( UMP_, shmemput, etc... )
91 C Fill east receive buffer of west-neighbor tile
92 C Fill west receive buffer of east-neighbor tile
93 C Sync. memory
94 C Write data-ready Ack for east edge of west-neighbor tile
95 C Write data-ready Ack for west edge of east-neighbor tile
96 C Sync. memory
97
98 _BEGIN_MASTER(myThid)
99
100 #ifdef DBUG_EXCH_VEC
101 ioUnit = errorMessageUnit
102 #endif
103
104 DO bj=1,nSy
105 DO bi=1,nSx
106
107 thisTile = W2_myTileList(bi,bj)
108
109 C- loop over neighboring tiles
110 DO nN=1,exch2_nNeighbours(thisTile)
111
112 tgT = exch2_neighbourId(nN, thisTile )
113 dir = exch2_neighbourDir(nN,thisTile)
114 tgN = exch2_opposingSend(nN,thisTIle)
115 sDir = exch2_neighbourDir(tgN,tgT)
116
117 IF ( W2_myCommFlag(nN,bi,bj) .EQ. 'P' ) THEN
118 C find bi,bj of target tile
119 DO j=1,nSy
120 DO i=1,nSx
121 IF ( W2_myTileList(i,j).EQ.tgT ) THEN
122 sBi = i
123 sBj = j
124 ENDIF
125 ENDDO
126 ENDDO
127 DO I=1,myd1
128 bufRec(I,sBi,sBj,sDir) = array(I,bi,bj,dir)
129 ENDDO
130 #ifdef ALLOW_USE_MPI
131 ELSEIF ( usingMPI .AND.
132 & W2_myCommFlag(nN,bi,bj) .EQ. 'M' ) THEN
133 C Send the data
134 theProc = W2_tileProc(tgT) - 1
135 theTag = (thisTile-1)*W2_maxNeighbours + nN
136 theSize = myd1
137 theType = _MPI_TYPE_RL
138 #ifdef DBUG_EXCH_VEC
139 write(ioUnit,'(A,5I5,I8)') 'qq1xW: ',myProcId,bi,bj,
140 & theProc,theTag, theSize
141 #endif
142 CALL MPI_Isend(array(1,bi,bj,dir), theSize, theType,
143 & theProc, theTag, MPI_COMM_MODEL,
144 & theHandle(1,nN,bi,bj), mpiRc)
145 #endif /* ALLOW_USE_MPI */
146 ELSE
147 STOP 'S/R EXCH2_SEND_PUT_VEC_RL: Invalid commFlag.'
148 ENDIF
149
150 C- nN
151 ENDDO
152
153 C- bj,bi
154 ENDDO
155 ENDDO
156
157 _END_MASTER(myThid)
158
159 #endif /* ALLOW_EXCH2 */
160
161 RETURN
162 END

  ViewVC Help
Powered by ViewVC 1.1.22