1include(mpifx_common.m4)
2
3dnl ************************************************************************
4dnl *** mpifx_allreduce
5dnl ************************************************************************
6
7define(`_subroutine_mpifx_allreduce',`dnl
8dnl $1: subroutine suffix
9dnl $2: dummy arguments type
10dnl $3: dummy arguments rank specifier ("", (:), (:,:), etc.)
11dnl $4: dummy arguments size (1 or size(dummyname))
12dnl $5: corresponding MPI type
13!> Reduces results on all processes (type $1).
14!!
15!! \param mycomm  MPI communicator.
16!! \param operand  Quantity to be reduced.
17!! \param result  Contains result on exit.
18!! \param operator  Reduction operator
19!! \param error  Error code on exit.
20!!
21subroutine mpifx_allreduce_$1(mycomm, operand, result, operator, error)
22  type(mpifx_comm), intent(in) :: mycomm
23  $2, intent(in) :: operand$3
24  $2, intent(inout) :: result$3
25  integer, intent(in) :: operator
26  integer, intent(out), optional :: error
27
28  integer :: error0
29
30  call mpi_allreduce(operand, result, $4, $5, operator, mycomm%id, error0)
31  call handle_errorflag(error0, "MPI_ALLREDUCE in mpifx_allreduce_$1", error)
32
33end subroutine mpifx_allreduce_$1
34')
35
36dnl ************************************************************************
37dnl *** mpifx_allreduceip
38dnl ************************************************************************
39
40define(`_subroutine_mpifx_allreduceip',`dnl
41dnl $1: subroutine suffix
42dnl $2: dummy arguments type
43dnl $3: dummy arguments rank specifier ("", (:), (:,:), etc.)
44dnl $4: dummy arguments size (1 or size(dummyname))
45dnl $5: corresponding MPI type
46!> Reduces results on one process (type $1).
47!!
48!! \param mycomm  MPI communicator.
49!! \param opres  Quantity to be reduced on input, result on exit
50!! \param operator  Reduction operator
51!! \param error  Error code on exit.
52!!
53subroutine mpifx_allreduceip_$1(mycomm, opres, operator, error)
54  type(mpifx_comm), intent(in) :: mycomm
55  $2, intent(inout) :: opres$3
56  integer, intent(in) :: operator
57  integer, intent(out), optional :: error
58
59  integer :: error0
60
61  call mpi_allreduce(MPI_IN_PLACE, opres, $4, $5, operator, mycomm%id, error0)
62  call handle_errorflag(error0, "MPI_REDUCE in mpifx_allreduceip_$1", error)
63
64end subroutine mpifx_allreduceip_$1
65')
66