From: Peter Munch Date: Sun, 25 Oct 2020 19:03:56 +0000 (+0100) Subject: Make ConsensusAlgorithms work in serial X-Git-Tag: v9.3.0-rc1~969^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11105%2Fhead;p=dealii.git Make ConsensusAlgorithms work in serial --- 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(); }