Computes two global dot products without constructing temporary full-size batches.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(flow_mpi_t), | intent(in) | :: | flow | |||
| real(kind=rk), | intent(in) | :: | a1(:) | |||
| real(kind=rk), | intent(in) | :: | b1(:) | |||
| real(kind=rk), | intent(in) | :: | a2(:) | |||
| real(kind=rk), | intent(in) | :: | b2(:) | |||
| real(kind=rk), | intent(out) | :: | results(2) |
subroutine flow_global_two_dots_owned(flow, a1, b1, a2, b2, results) use mod_profiling, only : profiler_start, profiler_stop type(flow_mpi_t), intent(in) :: flow real(rk), intent(in) :: a1(:), b1(:), a2(:), b2(:) real(rk), intent(out) :: results(2) real(rk) :: local_dots(2) integer :: c, ierr local_dots = zero do c = flow%first_cell, flow%last_cell local_dots(1) = local_dots(1) + a1(c) * b1(c) local_dots(2) = local_dots(2) + a2(c) * b2(c) end do if (flow%nprocs == 1) then results = local_dots return end if call profiler_start('MPI_Communication') call MPI_Allreduce(local_dots, results, 2, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr) call check_mpi(ierr, 'MPI_Allreduce two dots') call profiler_stop('MPI_Communication') end subroutine flow_global_two_dots_owned