1
-
2
- #ifdef BL_USE_MPI
3
- module amrex_fi_mpi
4
- use mpi
5
- implicit none
6
- end module amrex_fi_mpi
7
- #endif
8
-
9
1
module amrex_parallel_module
10
2
11
3
use iso_c_binding
12
4
#ifdef BL_USE_MPI
13
5
use amrex_fi_mpi
6
+ use amrex_mpi_reduce_int_module, only : amrex_mpi_reduce_int, amrex_mpi_allreduce_int
7
+ use amrex_mpi_reduce_real_module, only : amrex_mpi_reduce_real, amrex_mpi_allreduce_real
14
8
#endif
15
9
16
10
use amrex_error_module
@@ -141,9 +135,9 @@ subroutine amrex_parallel_reduce_sum_is (i, rank)
141
135
integer :: tmp, ierr
142
136
tmp = i
143
137
if (present (rank)) then
144
- call MPI_Reduce (tmp, i, 1 , MPI_INTEGER, MPI_SUM, rank, m_comm, ierr)
138
+ call amrex_mpi_reduce_int (tmp, i, 1 , MPI_INTEGER, MPI_SUM, rank, m_comm, ierr)
145
139
else
146
- call MPI_Allreduce (tmp, i, 1 , MPI_INTEGER, MPI_SUM, m_comm, ierr)
140
+ call amrex_mpi_allreduce_int (tmp, i, 1 , MPI_INTEGER, MPI_SUM, m_comm, ierr)
147
141
end if
148
142
#endif
149
143
end subroutine amrex_parallel_reduce_sum_is
@@ -156,9 +150,9 @@ subroutine amrex_parallel_reduce_sum_iv (i, n, rank)
156
150
integer :: tmp(n), ierr
157
151
tmp = i(1 :n)
158
152
if (present (rank)) then
159
- call MPI_Reduce (tmp, i, n, MPI_INTEGER, MPI_SUM, rank, m_comm, ierr)
153
+ call amrex_mpi_reduce_int (tmp, i, n, MPI_INTEGER, MPI_SUM, rank, m_comm, ierr)
160
154
else
161
- call MPI_Allreduce (tmp, i, n, MPI_INTEGER, MPI_SUM, m_comm, ierr)
155
+ call amrex_mpi_allreduce_int (tmp, i, n, MPI_INTEGER, MPI_SUM, m_comm, ierr)
162
156
end if
163
157
#endif
164
158
end subroutine amrex_parallel_reduce_sum_iv
@@ -171,9 +165,9 @@ subroutine amrex_parallel_reduce_sum_rs (r, rank)
171
165
integer :: ierr
172
166
tmp = r
173
167
if (present (rank)) then
174
- call MPI_Reduce (tmp, r, 1 , amrex_mpi_real, MPI_SUM, rank, m_comm, ierr)
168
+ call amrex_mpi_reduce_real (tmp, r, 1 , amrex_mpi_real, MPI_SUM, rank, m_comm, ierr)
175
169
else
176
- call MPI_Allreduce (tmp, r, 1 , amrex_mpi_real, MPI_SUM, m_comm, ierr)
170
+ call amrex_mpi_allreduce_real (tmp, r, 1 , amrex_mpi_real, MPI_SUM, m_comm, ierr)
177
171
end if
178
172
#endif
179
173
end subroutine amrex_parallel_reduce_sum_rs
@@ -187,9 +181,9 @@ subroutine amrex_parallel_reduce_sum_rv (r, n, rank)
187
181
integer :: ierr
188
182
tmp = r(1 :n)
189
183
if (present (rank)) then
190
- call MPI_Reduce (tmp, r, n, amrex_mpi_real, MPI_SUM, rank, m_comm, ierr)
184
+ call amrex_mpi_reduce_real (tmp, r, n, amrex_mpi_real, MPI_SUM, rank, m_comm, ierr)
191
185
else
192
- call MPI_Allreduce (tmp, r, n, amrex_mpi_real, MPI_SUM, m_comm, ierr)
186
+ call amrex_mpi_allreduce_real (tmp, r, n, amrex_mpi_real, MPI_SUM, m_comm, ierr)
193
187
end if
194
188
#endif
195
189
end subroutine amrex_parallel_reduce_sum_rv
@@ -201,9 +195,9 @@ subroutine amrex_parallel_reduce_max_is (i, rank)
201
195
integer :: tmp, ierr
202
196
tmp = i
203
197
if (present (rank)) then
204
- call MPI_Reduce (tmp, i, 1 , MPI_INTEGER, MPI_MAX, rank, m_comm, ierr)
198
+ call amrex_mpi_reduce_int (tmp, i, 1 , MPI_INTEGER, MPI_MAX, rank, m_comm, ierr)
205
199
else
206
- call MPI_Allreduce (tmp, i, 1 , MPI_INTEGER, MPI_MAX, m_comm, ierr)
200
+ call amrex_mpi_allreduce_int (tmp, i, 1 , MPI_INTEGER, MPI_MAX, m_comm, ierr)
207
201
end if
208
202
#endif
209
203
end subroutine amrex_parallel_reduce_max_is
@@ -216,9 +210,9 @@ subroutine amrex_parallel_reduce_max_iv (i, n, rank)
216
210
integer :: tmp(n), ierr
217
211
tmp = i(1 :n)
218
212
if (present (rank)) then
219
- call MPI_Reduce (tmp, i, n, MPI_INTEGER, MPI_MAX, rank, m_comm, ierr)
213
+ call amrex_mpi_reduce_int (tmp, i, n, MPI_INTEGER, MPI_MAX, rank, m_comm, ierr)
220
214
else
221
- call MPI_Allreduce (tmp, i, n, MPI_INTEGER, MPI_MAX, m_comm, ierr)
215
+ call amrex_mpi_allreduce_int (tmp, i, n, MPI_INTEGER, MPI_MAX, m_comm, ierr)
222
216
end if
223
217
#endif
224
218
end subroutine amrex_parallel_reduce_max_iv
@@ -231,9 +225,9 @@ subroutine amrex_parallel_reduce_max_rs (r, rank)
231
225
integer :: ierr
232
226
tmp = r
233
227
if (present (rank)) then
234
- call MPI_Reduce (tmp, r, 1 , amrex_mpi_real, MPI_MAX, rank, m_comm, ierr)
228
+ call amrex_mpi_reduce_real (tmp, r, 1 , amrex_mpi_real, MPI_MAX, rank, m_comm, ierr)
235
229
else
236
- call MPI_Allreduce (tmp, r, 1 , amrex_mpi_real, MPI_MAX, m_comm, ierr)
230
+ call amrex_mpi_allreduce_real (tmp, r, 1 , amrex_mpi_real, MPI_MAX, m_comm, ierr)
237
231
end if
238
232
#endif
239
233
end subroutine amrex_parallel_reduce_max_rs
@@ -247,9 +241,9 @@ subroutine amrex_parallel_reduce_max_rv (r, n, rank)
247
241
integer :: ierr
248
242
tmp = r(1 :n)
249
243
if (present (rank)) then
250
- call MPI_Reduce (tmp, r, n, amrex_mpi_real, MPI_MAX, rank, m_comm, ierr)
244
+ call amrex_mpi_reduce_real (tmp, r, n, amrex_mpi_real, MPI_MAX, rank, m_comm, ierr)
251
245
else
252
- call MPI_Allreduce (tmp, r, n, amrex_mpi_real, MPI_MAX, m_comm, ierr)
246
+ call amrex_mpi_allreduce_real (tmp, r, n, amrex_mpi_real, MPI_MAX, m_comm, ierr)
253
247
end if
254
248
#endif
255
249
end subroutine amrex_parallel_reduce_max_rv
@@ -261,9 +255,9 @@ subroutine amrex_parallel_reduce_min_is (i, rank)
261
255
integer :: tmp, ierr
262
256
tmp = i
263
257
if (present (rank)) then
264
- call MPI_Reduce (tmp, i, 1 , MPI_INTEGER, MPI_MIN, rank, m_comm, ierr)
258
+ call amrex_mpi_reduce_int (tmp, i, 1 , MPI_INTEGER, MPI_MIN, rank, m_comm, ierr)
265
259
else
266
- call MPI_Allreduce (tmp, i, 1 , MPI_INTEGER, MPI_MIN, m_comm, ierr)
260
+ call amrex_mpi_allreduce_int (tmp, i, 1 , MPI_INTEGER, MPI_MIN, m_comm, ierr)
267
261
end if
268
262
#endif
269
263
end subroutine amrex_parallel_reduce_min_is
@@ -276,9 +270,9 @@ subroutine amrex_parallel_reduce_min_iv (i, n, rank)
276
270
integer :: tmp(n), ierr
277
271
tmp = i(1 :n)
278
272
if (present (rank)) then
279
- call MPI_Reduce (tmp, i, n, MPI_INTEGER, MPI_MIN, rank, m_comm, ierr)
273
+ call amrex_mpi_reduce_int (tmp, i, n, MPI_INTEGER, MPI_MIN, rank, m_comm, ierr)
280
274
else
281
- call MPI_Allreduce (tmp, i, n, MPI_INTEGER, MPI_MIN, m_comm, ierr)
275
+ call amrex_mpi_allreduce_int (tmp, i, n, MPI_INTEGER, MPI_MIN, m_comm, ierr)
282
276
end if
283
277
#endif
284
278
end subroutine amrex_parallel_reduce_min_iv
@@ -291,9 +285,9 @@ subroutine amrex_parallel_reduce_min_rs (r, rank)
291
285
integer :: ierr
292
286
tmp = r
293
287
if (present (rank)) then
294
- call MPI_Reduce (tmp, r, 1 , amrex_mpi_real, MPI_MIN, rank, m_comm, ierr)
288
+ call amrex_mpi_reduce_real (tmp, r, 1 , amrex_mpi_real, MPI_MIN, rank, m_comm, ierr)
295
289
else
296
- call MPI_Allreduce (tmp, r, 1 , amrex_mpi_real, MPI_MIN, m_comm, ierr)
290
+ call amrex_mpi_allreduce_real (tmp, r, 1 , amrex_mpi_real, MPI_MIN, m_comm, ierr)
297
291
end if
298
292
#endif
299
293
end subroutine amrex_parallel_reduce_min_rs
@@ -307,9 +301,9 @@ subroutine amrex_parallel_reduce_min_rv (r, n, rank)
307
301
integer :: ierr
308
302
tmp = r(1 :n)
309
303
if (present (rank)) then
310
- call MPI_Reduce (tmp, r, n, amrex_mpi_real, MPI_MIN, rank, m_comm, ierr)
304
+ call amrex_mpi_reduce_real (tmp, r, n, amrex_mpi_real, MPI_MIN, rank, m_comm, ierr)
311
305
else
312
- call MPI_Allreduce (tmp, r, n, amrex_mpi_real, MPI_MIN, m_comm, ierr)
306
+ call amrex_mpi_allreduce_real (tmp, r, n, amrex_mpi_real, MPI_MIN, m_comm, ierr)
313
307
end if
314
308
#endif
315
309
end subroutine amrex_parallel_reduce_min_rv
0 commit comments