39
40
41
44
45
46
47 USE spmd_comm_world_mod, ONLY : spmd_comm_world
48#include "implicit_f.inc"
49
50
51
52#include "spmd.inc"
53
54
55
56#include "com01_c.inc"
57#include "task_c.inc"
58
59
60
61 INTEGER IRLEN20,,IRLEN20T,ISLEN20T,
62 . IRLEN20E,ISLEN20E,NIN,
63 . NSV(*), NLG(*), ISLINS(2,*)
64 integer
65 . solidn_normal(3,*),
66 . solidn_normal_f(3,*), solidn_normal_fe(3,*)
67
68
69
70
71#ifdef MPI
72 INTEGER P, L, ADD, NB, SIZ, LOC_PROC, I, NOD, IL, IL1, IL2,
73 . , N, MSGTYP, IERROR, MSGOFF,
74 . , N2, IALLOCS, IALLOCR
75
76
77+1),
78 . (NSPMD),REQ_RI(NSPMD),ISTOCOM
79 INTEGER ,DIMENSION(:), ALLOCATABLE :: BBUFS, BBUFR
80 DATA msgoff/164/
81
82
83
84 loc_proc = ispmd + 1
85 len20 = 3
86 len20e = 6
87 istocom=0
88
89 iallocs = len20*islen20 + len20*islen20t + len20e*islen20e
90 ierror=0
91 IF(iallocs>0)
92 + ALLOCATE(bbufs(iallocs),stat=ierror)
93 IF(ierror/=0) THEN
94 CALL ancmsg(msgid=20,anmode=aninfo)
96 END IF
97
98 iallocr = len20*irlen20 + len20*irlen20t + len20e*irlen20e
99 ierror=0
100 IF(iallocr>0)
101 + ALLOCATE(bbufr(iallocr),stat=ierror)
102 IF(ierror/=0) THEN
103 CALL ancmsg(msgid=20,anmode=aninfo)
105 END IF
106
107
108
109 l = 0
110 DO p = 1, nspmd
111 add = l+1
112 addr(p) = add
113 siz = 0
114 IF(p/=loc_proc)THEN
116 l = l + nb*len20
117
119 l = l + nb*len20e
120 siz = l+1-add
121 IF(siz>0)THEN
122 msgtyp = msgoff
124 . bbufr(add),siz,mpi_integer,it_spmd(p),msgtyp,
125 . spmd_comm_world,req_ri(p),ierror )
126 ENDIF
127 ENDIF
128 ENDDO
129 addr(nspmd+1) = addr(nspmd)+siz
130 IF(l>0) THEN
131 istocom = 1
132 ENDIF
133
134
135
136 debut=0
137 debute=0
138 l = 0
139 DO p = 1, nspmd
140 add = l+1
141 adds(p) = add
142 siz = 0
143 IF(p/=loc_proc)THEN
144 ideb = debut
146 DO i = 1, nb
147 n =
nsvsi(nin)%P(ideb+i)
148 il = nsv(n)
149 nod = nlg(il)
150 bbufs(l+1) = solidn_normal(1,nod)
151 bbufs(l+2) = solidn_normal(2,nod)
152 bbufs(l+3) = solidn_normal(3,nod)
153 l = l + len20
154 ENDDO
155 debut=debut+nb
156
157
159 ideb = debute
160 DO i = 1, nb
162 il1 = islins(1,n)
163 nod = nlg(il1)
164 bbufs(l+1) = solidn_normal(1,nod)
165 bbufs(l+2) = solidn_normal(2,nod)
166 bbufs(l+3) = solidn_normal(3,nod)
167 il2 = islins(2,n)
168 nod = nlg(il2)
169 bbufs(l+4) = solidn_normal(1,nod)
170 bbufs(l+5) = solidn_normal(2,nod)
171 bbufs(l+6) = solidn_normal(3,nod)
172 l = l + len20e
173 ENDDO
174 debute=debute+nb
175
176 siz = l+1-add
177 IF(siz>0)THEN
178 msgtyp = msgoff
179
181 . bbufs(add),siz,mpi_integer,it_spmd(p),msgtyp,
182 . spmd_comm_world,req_si(p),ierror )
183 ENDIF
184 ENDIF
185 ENDDO
186 adds(nspmd+1)=adds(nspmd)+siz
187
188
189
190 IF(istocom==1)THEN
191
192 debut = 0
193 debute= 0
194
195
196
197 DO p = 1, nspmd
198 IF(addr(p+1)-addr(p)>0) THEN
199 CALL mpi_wait(req_ri(p),status,ierror)
200 l = addr(p)-1
202 IF(nb>0)THEN
203 ideb = debut
204 DO i = 1, nb
205 solidn_normal_f(1,i+ideb) = bbufr(l+1)
206 solidn_normal_f(2,i+ideb) = bbufr(l+2)
207 solidn_normal_f(3,i+ideb) = bbufr(l+3)
208 l = l + len20
209 ENDDO
210 debut = debut + nb
211 ENDIF
212
213
214
216 IF(nb>0)THEN
217 ideb = debute
218 DO i = 1, nb
219 n1 = 2*(i+ideb-1)+1
220 n2 = 2*(i+ideb)
221 solidn_normal_fe(1,n1) = bbufr(l+1)
222 solidn_normal_fe(2,n1) = bbufr(l+2)
223 solidn_normal_fe(3,n1) = bbufr(l+3)
224 solidn_normal_fe(1,n2) = bbufr(l+4)
225 solidn_normal_fe(2,n2) = bbufr(l+5)
226 solidn_normal_fe(3,n2) = bbufr(l+6)
227 l = l + len20e
228 ENDDO
229 debute = debute + nb
230 ENDIF
231
232 END IF
233 END DO
234 END IF
235
236 IF(iallocr>0)THEN
237 DEALLOCATE(bbufr)
238 iallocr=0
239 END IF
240
241
242
243 DO p = 1, nspmd
244 IF(adds(p+1)-adds(p)>0) THEN
245 CALL mpi_wait(req_si(p),status,ierror)
246 ENDIF
247 ENDDO
248
249 IF(iallocs>0)THEN
250 DEALLOCATE(bbufs)
251 iallocs=0
252 END IF
253
254#endif
255 RETURN
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
subroutine mpi_wait(ireq, status, ierr)
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
type(int_pointer), dimension(:), allocatable nsvsi
type(int_pointer), dimension(:), allocatable nsnfie
type(int_pointer), dimension(:), allocatable nsnsie
type(int_pointer), dimension(:), allocatable nsvsie
type(int_pointer), dimension(:), allocatable nsnsi
type(int_pointer), dimension(:), allocatable nsnfi
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)