From 6d00dc539311513be9c8ae949979f2ef676c00fe Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 25 Oct 2020 20:03:56 +0100 Subject: [PATCH] Make ConsensusAlgorithms work in serial --- .../base/mpi_consensus_algorithms.templates.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/deal.II/base/mpi_consensus_algorithms.templates.h b/include/deal.II/base/mpi_consensus_algorithms.templates.h index ad878a53db..010f069785 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.templates.h +++ b/include/deal.II/base/mpi_consensus_algorithms.templates.h @@ -83,8 +83,10 @@ namespace Utilities const MPI_Comm & comm) : process(process) , comm(comm) - , my_rank(this_mpi_process(comm)) - , n_procs(n_mpi_processes(comm)) + , my_rank(Utilities::MPI::job_supports_mpi() ? this_mpi_process(comm) : + 0) + , n_procs(Utilities::MPI::job_supports_mpi() ? n_mpi_processes(comm) : + 1) {} @@ -558,20 +560,22 @@ namespace Utilities : Interface(process, comm) { // Depending on the number of processes we switch between - // implementations. We reduce the threshold for debug mode to be able to - // test also the non-blocking implementation. This feature is tested by: + // implementations. We reduce the threshold for debug mode to be + // able to test also the non-blocking implementation. This feature + // is tested by: // tests/multigrid/transfer_matrix_free_06.with_mpi=true.with_p4est=true.with_trilinos=true.mpirun=15.output #ifdef DEAL_II_WITH_MPI # if DEAL_II_MPI_VERSION_GTE(3, 0) # ifdef DEBUG - if (Utilities::MPI::n_mpi_processes(comm) > 14) + if (this->n_procs > 14) # else - if (Utilities::MPI::n_mpi_processes(comm) > 99) + if (this->n_procs > 99) # endif consensus_algo.reset(new NBX(process, comm)); else # endif #endif + if (this->n_procs > 1) consensus_algo.reset(new PEX(process, comm)); } @@ -581,7 +585,8 @@ namespace Utilities void Selector::run() { - consensus_algo->run(); + if (consensus_algo) + consensus_algo->run(); } -- 2.39.5