da_proc_sum_real.inc
References to this file elsewhere.
1 subroutine da_proc_sum_real (value)
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Do MPI reduction operation across processors to sum a real
5 ! vector.
6 ! On return, each of the N components of the vector "value" represents
7 ! the sum of parts from each processor. The result is stored only on
8 ! the root processor, i.e., processor 0. (In this way, we do not have
9 ! to do all-to-all communication, unlike wrf_dm_sum_real, which does)
10 !
11 ! The routine generates a MPI barrier
12 !---------------------------------------------------------------------------
13
14 implicit none
15
16 real, intent(inout) :: value(:) ! Array to be summed componentwise.
17
18 #ifdef DM_PARALLEL
19 real :: apsum(size(value)) ! Sum across processors.
20
21 ! Don't trace, as called within trace routines
22 !if (trace_use_frequent) call da_trace_entry("da_proc_sum_real")
23
24 apsum(:)=0
25 call mpi_reduce(value, apsum, SIZE(value), true_mpi_real, mpi_sum, root, &
26 comm, ierr)
27
28 if (rootproc) value = apsum
29
30 !if (trace_use_frequent) call da_trace_exit("da_proc_sum_real")
31 #endif
32
33 end subroutine da_proc_sum_real
34
35