flow_allreduce_global_scalar Subroutine

public subroutine flow_allreduce_global_scalar(flow, local_values, global_values)

Sum-Allreduce for a global scalar field.

Arguments

Type IntentOptional Attributes Name
type(flow_mpi_t), intent(in) :: flow
real(kind=rk), intent(in) :: local_values(:)
real(kind=rk), intent(out) :: global_values(:)

Source Code

   subroutine flow_allreduce_global_scalar(flow, local_values, global_values)
      use mod_profiling, only : profiler_start, profiler_stop
      type(flow_mpi_t), intent(in) :: flow
      real(rk), intent(in) :: local_values(:)
      real(rk), intent(out) :: global_values(:)
      integer :: ierr

      call profiler_start('MPI_Communication')
      call MPI_Allreduce(local_values, global_values, size(local_values), &
                         MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr)
      call check_mpi(ierr, 'MPI_Allreduce flow scalar')
      call profiler_stop('MPI_Communication')
   end subroutine flow_allreduce_global_scalar