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 sum=0
20 call mpi_reduce(value, sum, 1, mpi_integer, mpi_sum, root, &
21 comm, ierr)
22
23 if (rootproc) value = sum
24 #endif
25
26 end subroutine da_proc_sum_int
27
28