parallel_reductions Module

Every call goes through MPI_Allreduce so call sites remain correct at any rank count. At -np 1 the operations are identities; bit-identity with the pre-MPI serial code is preserved by construction.

We deliberately use separate send/recv buffers rather than =MPI_IN_PLACE=: MS-MPI's legacy =mpi= module mishandles =MPI_IN_PLACE= at =-np 1=, returning garbage instead of the input value. Two-buffer Allreduce is the textbook form and works on every MPI implementation we care about.

See mpi_runtime.F90 for the rationale behind the mpi_f08 / legacy mpi cpp split.



Functions

public function par_max_real(local) result(global)

Return the maximum of a scalar real(wp) across all ranks.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: local

Return Value real(kind=wp)

public function par_sum_real(local) result(global)

Return the sum of a scalar real(wp) across all ranks.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: local

Return Value real(kind=wp)

public function par_lor(local) result(global)

Return the logical OR of a scalar logical across all ranks.

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: local

Return Value logical