33
34
35
37
38
39
40 USE spmd_comm_world_mod, ONLY : spmd_comm_world
41#include "implicit_f.inc"
42
43
44
45#include "spmd.inc"
46
47
48
49#include "task_c.inc"
50#include "com01_c.inc"
51
52
53
54 INTEGER IAD_ELEM(2,*),FR_ELEM(*),ITAB(*)
56 * mtf(14,*)
57
58
59
60#ifdef MPI
61 INTEGER STATUS(MPI_STATUS_SIZE),
62 * REQ_SI(NSPMD),REQ_RI(NSPMD)
63 INTEGER P, LENRV, IADS(NSPMD+1), IADR(NSPMD+1), IERROR,
64 * SIZ,LOC_PROC,MSGTYP,J,L,NOD,NB,MSGOFF
66 * DIMENSION(:), ALLOCATABLE :: bbufs,bbufr
67 DATA msgoff/154/
68
69 lenrv = (iad_elem(1,nspmd+1)-iad_elem(1,1))*9
70 ALLOCATE (bbufs(lenrv),bbufr(lenrv))
71 loc_proc=ispmd+1
72
73 iadr(1) = 1
74 l=1
75 DO p=1,nspmd
76 iadr(p) = l
77 siz = (iad_elem(1,p+1)-iad_elem(1,p))*9
78 IF(siz/=0)THEN
79 msgtyp = msgoff
81 s bbufr(l),siz,real,it_spmd(p),msgtyp,
82 g spmd_comm_world,req_ri(p),ierror)
83 l = l + siz
84 ENDIF
85 END DO
86 iadr(nspmd+1) = l
87
88
89
90 l=1
91 DO p=1,nspmd
92 iads(p)=l
93 DO j=iad_elem(1,p),iad_elem(1,p+1)-1
94 nod = fr_elem(j)
95 bbufs(l ) = mtf(1,nod)
96 bbufs(l+1) = mtf(2,nod)
97 bbufs(l+2) = mtf(3,nod)
98 bbufs(l+3) = mtf(4,nod)
99 bbufs(l+4) = mtf(5,nod)
100 bbufs(l+5) = mtf(6,nod)
101 bbufs(l+6) = mtf(7,nod)
102 bbufs(l+7) = mtf(8,nod)
103 bbufs(l+8) = mtf(9,nod)
104 l = l + 9
105 ENDDO
106 ENDDO
107 iads(nspmd+1)=l
108
109 DO p=1,nspmd
110 IF(iad_elem(1,p+1)-iad_elem(1,p)>0)THEN
111 msgtyp = msgoff
112 siz = iads(1+p)-iads(p)
113 l = iads(p)
115 s bbufs(l),siz,real,it_spmd(p),msgtyp,
116 g spmd_comm_world,req_si(p),ierror)
117 ENDIF
118 ENDDO
119
120
121
122
123 DO p = 1, nspmd
124
125 nb = iad_elem(1,p+1)-iad_elem(1,p)
126 IF(nb>0)THEN
127 CALL mpi_wait(req_ri(p),status,ierror)
128 l=iadr(p)
129 DO j=iad_elem(1,p),iad_elem(1,p+1)-1
130 nod = fr_elem(j)
131 mtf(1,nod)=mtf(1,nod)+bbufr(l)
132 mtf(2,nod)=mtf(2,nod)+bbufr(l+1)
133 mtf(3,nod)=mtf(3,nod)+bbufr(l+2)
134 mtf(4,nod)=mtf(4,nod)+bbufr(l+3)
135 mtf(5,nod)=mtf(5,nod)+bbufr(l+4)
136 mtf(6,nod)=mtf(6,nod)+bbufr(l+5)
137 mtf(7,nod)=mtf(7,nod)+bbufr(l+6)
138 mtf(8,nod)=mtf(8,nod)+bbufr(l+7)
139 mtf(9,nod)=mtf(9,nod)+bbufr(l+8)
140 l=l+9
141 ENDDO
142 ENDIF
143 ENDDO
144
145 DO p = 1, nspmd
146 siz=iads(p+1)-iads(p)
147 IF(siz>0) THEN
148 CALL mpi_wait(req_si(p),status,ierror)
149 ENDIF
150 ENDDO
151
152#endif
153 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)