da_proc_sum_int.inc
References to this file elsewhere.
1 subroutine da_proc_sum_int (value)
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Do MPI sum operation across processors to get the global sum of
5 ! an integer value. 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_int, which does)
8 !
9 ! The routine generates a MPI barrier
10 !---------------------------------------------------------------------------
11
12 implicit none
13
14 integer, intent(inout) :: value ! Value on processor.
15
16 #ifdef DM_PARALLEL
17 integer :: sum ! Sum across processors.
18
19 ! Don't trace, as called within trace routines
20 ! if (trace_use_frequent) call da_trace_entry("da_proc_sum_int")
21
22 sum=0
23 call mpi_reduce(value, sum, 1, mpi_integer, mpi_sum, root, &
24 comm, ierr)
25
26 if (rootproc) value = sum
27
28 ! if (trace_use_frequent) call da_trace_exit("da_proc_sum_int")
29 #endif
30
31 end subroutine da_proc_sum_int
32
33