From d8b42a02ec04281832f095c92f182e8b7d4d9aa9 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Tue, 31 Mar 2020 15:05:09 +0200 Subject: [PATCH 1/4] [amg] Only construct parallel helper if MPI was found --- dumux/linear/amgbackend.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh index 840933a97a..7c49d40d6b 100644 --- a/dumux/linear/amgbackend.hh +++ b/dumux/linear/amgbackend.hh @@ -82,8 +82,10 @@ public: const typename LinearSolverTraits::DofMapper& dofMapper, const std::string& paramGroup = "") : LinearSolver(paramGroup) +#if HAVE_MPI , phelper_(std::make_shared>(gridView, dofMapper)) , isParallel_(Dune::MPIHelper::getCollectiveCommunication().size() > 1) +#endif { reset(); } @@ -224,9 +226,11 @@ private: solver.apply(x, b, result_); } +#if HAVE_MPI std::shared_ptr> phelper_; +#endif Dune::InverseOperatorResult result_; - bool isParallel_; + bool isParallel_ = false; bool firstCall_; }; -- GitLab From ad39cda34df59598dcc21f2a5951811495728a3a Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Tue, 31 Mar 2020 15:06:29 +0200 Subject: [PATCH 2/4] [istlfactory] Only construct parallel helper if MPI is found --- dumux/linear/istlsolverfactorybackend.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dumux/linear/istlsolverfactorybackend.hh b/dumux/linear/istlsolverfactorybackend.hh index fa96f2e425..71e330eb9c 100644 --- a/dumux/linear/istlsolverfactorybackend.hh +++ b/dumux/linear/istlsolverfactorybackend.hh @@ -85,8 +85,10 @@ public: const typename LinearSolverTraits::DofMapper& dofMapper, const std::string& paramGroup = "") : paramGroup_(paramGroup) +#if HAVE_MPI , parallelHelper_(std::make_unique>(gridView, dofMapper)) , isParallel_(Dune::MPIHelper::getCollectiveCommunication().size() > 1) +#endif { reset(); } @@ -227,8 +229,10 @@ private: } const std::string paramGroup_; +#if HAVE_MPI std::unique_ptr> parallelHelper_; - bool isParallel_; +#endif + bool isParallel_ = false; bool firstCall_; Dune::InverseOperatorResult result_; -- GitLab From 942650f5a469a0624364c40838b7d3ce56065a2f Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Tue, 31 Mar 2020 15:10:19 +0200 Subject: [PATCH 3/4] [linearsolvertraits] Parallel types should only exists if MPI is found --- dumux/linear/linearsolvertraits.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dumux/linear/linearsolvertraits.hh b/dumux/linear/linearsolvertraits.hh index dcca6e0a75..154071021c 100644 --- a/dumux/linear/linearsolvertraits.hh +++ b/dumux/linear/linearsolvertraits.hh @@ -125,11 +125,13 @@ struct LinearSolverTraitsBase template using Sequential = SequentialSolverTraits; +#if HAVE_MPI template using ParallelOverlapping = OverlappingSolverTraits; template using ParallelNonoverlapping = NonoverlappingSolverTraits; +#endif }; //! Box: use overlapping or non-overlapping model depending on the grid -- GitLab From 676ac4bc38acd7567d8751b7eea588ee547e4354 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Tue, 31 Mar 2020 15:22:17 +0200 Subject: [PATCH 4/4] [amg] Use unique_ptr internally for parallel helper --- dumux/linear/amgbackend.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh index 7c49d40d6b..9243548481 100644 --- a/dumux/linear/amgbackend.hh +++ b/dumux/linear/amgbackend.hh @@ -83,7 +83,7 @@ public: const std::string& paramGroup = "") : LinearSolver(paramGroup) #if HAVE_MPI - , phelper_(std::make_shared>(gridView, dofMapper)) + , phelper_(std::make_unique>(gridView, dofMapper)) , isParallel_(Dune::MPIHelper::getCollectiveCommunication().size() > 1) #endif { @@ -227,7 +227,7 @@ private: } #if HAVE_MPI - std::shared_ptr> phelper_; + std::unique_ptr> phelper_; #endif Dune::InverseOperatorResult result_; bool isParallel_ = false; -- GitLab