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 "com01_c.inc"
50#include "task_c.inc"
51
52
53
54 INTEGER LCOMM, ISIZE, FR_CDNM(*), IAD_CDNM(*)
56 . a(3,*),stifn(*)
57
58
59
60#ifdef MPI
61 INTEGER MSGTYP,LOC_PROC,NOD,I,J,L,IDEB,IAD,LEN,
62 . NBINDEX,INDEX,MSGOFF,SIZ,IERROR,
63 . STATUS(MPI_STATUS_SIZE),
64 . REQ_S(NSPMD),REQ_R(NSPMD),INDEXI(NSPMD)
65 DATA msgoff/1178/
67 . sbuf(lcomm*isize),rbuf(lcomm*isize)
68
69
70
71 loc_proc = ispmd + 1
72
73 ideb = 1
74 l = 0
75
76 DO i = 1, nspmd
77 len = iad_cdnm(i+1)-iad_cdnm(i)
78 IF(len>0) THEN
79 siz = len*isize
80 l=l+1
81 indexi(l)=i
82 msgtyp = msgoff
84 s rbuf(ideb),siz,real,it_spmd(i),msgtyp,
85 g spmd_comm_world,req_r(l),ierror)
86 ideb = ideb + siz
87 ENDIF
88 ENDDO
89 nbindex = l
90
91 ideb = 1
92 DO l = 1, nbindex
93 i = indexi(l)
94 len = iad_cdnm(i+1) - iad_cdnm(i)
95 iad = iad_cdnm(i)-1
96 DO j = 1, len
97 nod = fr_cdnm(iad+j)
98 sbuf(ideb) = a(1,nod)
99 sbuf(ideb+1) = a(2,nod)
100 sbuf(ideb+2) = a(3,nod)
101 sbuf(ideb+3) = stifn(nod)
102 ideb = ideb + isize
103 ENDDO
104 ENDDO
105
106 ideb = 1
107 DO l=1,nbindex
108 i = indexi(l)
109 len = iad_cdnm(i+1)-iad_cdnm(i)
110 siz = len*isize
111 msgtyp = msgoff
113 s sbuf(ideb),siz,real,it_spmd(i),msgtyp,
114 g spmd_comm_world,req_s(l),ierror)
115 ideb = ideb + siz
116 ENDDO
117
118 DO l=1,nbindex
119 CALL mpi_waitany(nbindex,req_r,index,status,ierror)
120 i = indexi(index)
121 ideb = 1+(iad_cdnm(i)-1)*isize
122 len = iad_cdnm(i+1)-iad_cdnm(i)
123 iad = iad_cdnm(i)-1
124 DO j = 1, len
125 nod = fr_cdnm(iad+j)
126 a(1,nod) = a(1,nod) + rbuf(ideb)
127 a(2,nod) = a(2,nod) + rbuf(ideb+1)
128 a(3,nod) = a(3,nod) + rbuf(ideb+2)
129 stifn(nod) = stifn(nod) + rbuf(ideb+3)
130 ideb = ideb + isize
131 ENDDO
132 ENDDO
133
134 DO l=1,nbindex
135 CALL mpi_waitany(nbindex,req_s,index,status,ierror)
136 ENDDO
137
138#endif
139 RETURN
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
subroutine mpi_waitany(cnt, array_of_requests, index, status, ierr)
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)