115
116
117
118
119
120
121 INTEGER N, DTYPE, DEST, MSGID
122
123
124 REAL BUFF(*)
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
160
161
162 INTEGER I, IAM, MPIDTYPE
163
164
165 include 'mpif.h'
166
167
168 COMMON /btmpi/ btcomm, ierr
169 INTEGER BTCOMM, IERR
170
171 IF( dtype .EQ. 1 ) THEN
172 mpidtype = mpi_byte
173 ELSE IF( dtype .EQ. 3 ) THEN
174 mpidtype = mpi_integer
175 ELSE IF( dtype .EQ. 4 ) THEN
176 mpidtype = mpi_real
177 ELSE IF( dtype .EQ. 5 ) THEN
178 mpidtype = mpi_complex
179 ELSE IF( dtype .EQ. 6 ) THEN
180 mpidtype = mpi_double_precision
181 ELSE IF( dtype .EQ. 7 ) THEN
182 mpidtype = mpi_double_complex
183 END IF
184
185
186
187 IF( dest .EQ. -1 ) THEN
190 IF( i .NE. iam ) THEN
191 CALL mpi_send(buff, n, mpidtype, i, 0, btcomm, ierr)
192 IF (ierr.NE.0)
CALL btmpierr(
"MPI_SEND", ierr)
193 END IF
194 10 CONTINUE
195 ELSE
196 CALL mpi_send(buff, n, mpidtype, dest, 0, btcomm, ierr)
197 IF (ierr.NE.0)
CALL btmpierr(
"MPI_SEND", ierr)
198 END IF
199
200 RETURN
201
202
203
subroutine btmpierr(rout, ierr0)
integer function ibtnprocs()
integer function ibtmyproc()
integer function ibtsizeof(type)