From 351e9694330401552d51deb1227f11d240b5d2d1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 12 Jan 2022 20:49:32 -0700 Subject: [PATCH] Add a couple of assertions. --- include/deal.II/base/mpi_consensus_algorithms.h | 12 ++++++++---- .../base/mpi_consensus_algorithms.templates.h | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/deal.II/base/mpi_consensus_algorithms.h b/include/deal.II/base/mpi_consensus_algorithms.h index 307de41771..814bc1610e 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.h +++ b/include/deal.II/base/mpi_consensus_algorithms.h @@ -407,10 +407,12 @@ namespace Utilities * i.e. when this process can stop waiting for requests, no IBarrier is * needed. * - * @note The function - * Utilities::MPI::compute_point_to_point_communication_pattern() is - * used to determine the source processes, which implements a - * PEX-algorithm from @cite hoefler2010scalable. + * @note Under the hood, this function uses + * Utilities::MPI::compute_point_to_point_communication_pattern() + * to determine the source processes, which itself is based on the + * NBX-algorithm from @cite hoefler2010scalable that is implemented + * in the ConsensusAlgorithms::NBX class (a sister class to the + * current one). * * @tparam T1 The type of the elements of the vector to be sent. * @tparam T2 The type of the elements of the vector to be received. @@ -504,6 +506,8 @@ namespace Utilities clean_up_and_end_communication(); }; + + /** * A serial fall back for the above classes to allow programming * independently of whether MPI is used or not. diff --git a/include/deal.II/base/mpi_consensus_algorithms.templates.h b/include/deal.II/base/mpi_consensus_algorithms.templates.h index e9053505fb..78f97ba518 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.templates.h +++ b/include/deal.II/base/mpi_consensus_algorithms.templates.h @@ -169,6 +169,8 @@ namespace Utilities for (unsigned int index = 0; index < n_targets; ++index) { const unsigned int rank = targets[index]; + AssertIndexRange(rank, + Utilities::MPI::n_mpi_processes(this->comm)); auto &send_buffer = send_buffers[index]; this->process.create_request(rank, send_buffer); @@ -513,6 +515,7 @@ namespace Utilities for (unsigned int i = 0; i < n_targets; ++i) { const unsigned int rank = targets[i]; + AssertIndexRange(rank, Utilities::MPI::n_mpi_processes(this->comm)); // pack data which should be sent auto &send_buffer = send_buffers[i]; -- 2.39.5