33
34
35
36 USE spmd_comm_world_mod, ONLY : spmd_comm_world
37#include "implicit_f.inc"
38
39
40
41#include "spmd.inc"
42
43
44
45#include "com01_c.inc"
46#include "task_c.inc"
47
48
49
50 INTEGER LCOMM, FR_CDNS(*), IAD_CDNS(*)
52 . stifnd(*)
53
54
55
56#ifdef MPI
57 INTEGER MSGTYP,LOC_PROC,NOD,I,J,L,IDEB,IAD,LEN,
58 . NBINDEX,INDEX,MSGOFF,SIZ,IERROR,
59 . STATUS(MPI_STATUS_SIZE),
60 . REQ_S(NSPMD),REQ_R(NSPMD),INDEXI(NSPMD)
61 DATA msgoff/1179/
63 . sbuf(lcomm),rbuf(lcomm)
64
65
66
67 loc_proc = ispmd + 1
68
69 ideb = 1
70 l = 0
71
72 DO i = 1, nspmd
73 len = iad_cdns(i+1)-iad_cdns(i)
74 IF(len>0) THEN
75 siz = len
76 l=l+1
77 indexi(l)=i
78 msgtyp = msgoff
80 s rbuf(ideb),siz,real,it_spmd(i),msgtyp,
81 g spmd_comm_world,req_r(l),ierror)
82 ideb = ideb + siz
83 ENDIF
84 ENDDO
85 nbindex = l
86
87 ideb = 1
88 DO l = 1, nbindex
89 i = indexi(l)
90 len = iad_cdns(i+1) - iad_cdns(i)
91 iad = iad_cdns(i)-1
92 DO j = 1, len
93 nod = fr_cdns(iad+j)
94 sbuf(ideb) = stifnd(nod)
95 ideb = ideb + 1
96 ENDDO
97 ENDDO
98
99 ideb = 1
100 DO l=1,nbindex
101 i = indexi(l)
102 len = iad_cdns(i+1)-iad_cdns(i)
103 siz = len
104 msgtyp = msgoff
106 s sbuf(ideb),siz,real,it_spmd(i),msgtyp,
107 g spmd_comm_world,req_s(l),ierror)
108 ideb = ideb + siz
109 ENDDO
110
111 DO l=1,nbindex
112 CALL mpi_waitany(nbindex,req_r,index,status,ierror)
113 i = indexi(index)
114 ideb = iad_cdns(i)
115 len = iad_cdns(i+1)-iad_cdns(i)
116 iad = iad_cdns(i)-1
117 DO j = 1, len
118 nod = fr_cdns(iad+j)
119 stifnd(nod) = stifnd(nod) + rbuf(ideb)
120 ideb = ideb + 1
121 ENDDO
122 ENDDO
123
124 DO l=1,nbindex
125 CALL mpi_waitany(nbindex,req_s,index,status,ierror)
126 ENDDO
127
128#endif
129 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)