1 subroutine da_proc_sum_ints (values)
3 !---------------------------------------------------------------------------
4 ! Purpose: Do MPI sum operation across processors to get the global sum of
5 ! an integer array. The sum is returned only on the root processor,
6 ! i.e., processor 0. (In this way, we do not have to do all-to-all
7 ! communication, unlike wrf_dm_sum_ints, which does)
9 ! The routine generates a MPI barrier
10 !---------------------------------------------------------------------------
14 integer, intent(inout) :: values(:) ! Values
17 integer, allocatable :: sums(:) ! Sum across processors.
20 ! Don't trace, as called within trace routines
21 ! if (trace_use_frequent) call da_trace_entry("da_proc_sum_ints")
23 allocate (sums(size(values)))
25 call mpi_reduce(values(:), sums(:), size(values), mpi_integer, mpi_sum, &
28 if (rootproc) values(:) = sums(:)
31 ! if (trace_use_frequent) call da_trace_exit("da_proc_sum_ints")
34 end subroutine da_proc_sum_ints