34
35
36
37 USE spmd_comm_world_mod, ONLY : spmd_comm_world
38#include "implicit_f.inc"
39#include "spmd.inc"
40
41
42
43#include "com01_c.inc"
44#include "com04_c.inc"
45#include "task_c.inc"
46#include "spmd_c.inc"
47
48
49
51 . x(3,*)
52 INTEGER WEIGHT(*),NODGLOB(*),NUM,SRECBUF
53
54
55
56#ifdef MPI
57 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
58 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2,SI,MSGTYP2
59
60 REAL, DIMENSION(:,:), ALLOCATABLE :: BUFSR,XGLOB
61 INTEGER, DIMENSION(:), ALLOCATABLE :: IBUF
62
63 DATA msgoff/7026/
64 DATA msgoff2/7027/
65
66
67
68 ALLOCATE(bufsr(3,numnodm))
69 ALLOCATE(xglob(3,num))
70 ALLOCATE(ibuf(numnodm))
71
72 IF (ispmd/=0) THEN
73
74 siz = 0
75 DO i=1,numnod
76 IF (weight(i)==1) THEN
77 siz = siz + 1
78 ibuf(siz) = nodglob(i)
79 bufsr(1,siz) = x(1,i)
80 bufsr(2,siz) = x(2,i)
81 bufsr(3,siz) = x(3,i)
82 END IF
83 END DO
84
85
86
87
88
89 msgtyp = msgoff2
90 CALL mpi_send(ibuf,siz,mpi_integer,it_spmd(1),msgtyp,
91 . spmd_comm_world,ierror)
92
93
94 msgtyp = msgoff
95 CALL mpi_send(bufsr,3*siz,mpi_real4,it_spmd(1),msgtyp,
96 . spmd_comm_world,ierror)
97
98
99 ELSE
100
101 DO i=1,numnod
102 IF (weight(i)==1) THEN
103 ng = nodglob(i)
104 xglob(1,ng) = x(1,i)
105 xglob(2,ng) = x(2,i)
106 xglob(3,ng) = x(3,i)
107 ENDIF
108 ENDDO
109
110
111 DO i=2,nspmd
112
113
114 msgtyp = msgoff2
115
117 . spmd_comm_world,status,ierror)
119
120 CALL mpi_recv(ibuf,siz,mpi_integer,it_spmd(i),msgtyp,
121 . spmd_comm_world,status,ierror)
122
123
124
125 msgtyp2 = msgoff
126
127 CALL mpi_recv(bufsr,siz*3,mpi_real4,it_spmd(i),msgtyp2,
128 . spmd_comm_world,status,ierror)
129
130 nrec = siz
131
132
133 DO k = 1, nrec
134 ng = ibuf(k)
135 xglob(1,ng) = bufsr(1,k)
136 xglob(2,ng) = bufsr(2,k)
137 xglob(3,ng) = bufsr(3,k)
138 ENDDO
139 ENDDO
140
141
142 DO i=1,numnodg
146 END DO
147 END IF
148
149
150 DEALLOCATE(bufsr)
151 DEALLOCATE(xglob)
152 DEALLOCATE(ibuf)
153
154#endif
155 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
subroutine mpi_get_count(status, datatype, cnt, ierr)
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
subroutine mpi_probe(source, tag, comm, status, ierr)
void write_r_c(float *w, int *len)