diff --git a/opm/simulators/flow/Main.cpp b/opm/simulators/flow/Main.cpp index 963fee78b..91864fba9 100644 --- a/opm/simulators/flow/Main.cpp +++ b/opm/simulators/flow/Main.cpp @@ -36,6 +36,7 @@ #endif #if HAVE_HYPRE +#include #include #endif @@ -173,7 +174,11 @@ void Main::initMPI() #endif // HAVE_MPI #if HAVE_HYPRE +#if HYPRE_RELEASE_NUMBER >= 22900 HYPRE_Initialize(); +#else + HYPRE_Init(); +#endif #endif } diff --git a/opm/simulators/linalg/HyprePreconditioner.hpp b/opm/simulators/linalg/HyprePreconditioner.hpp index c773fd6ab..9539967c7 100644 --- a/opm/simulators/linalg/HyprePreconditioner.hpp +++ b/opm/simulators/linalg/HyprePreconditioner.hpp @@ -56,6 +56,7 @@ public: use_gpu_ = prm_.get("use_gpu", false); // Set memory location and execution policy +#if HYPRE_USING_CUDA || HYPRE_USING_HIP if (use_gpu_) { HYPRE_SetMemoryLocation(HYPRE_MEMORY_DEVICE); HYPRE_SetExecutionPolicy(HYPRE_EXEC_DEVICE); @@ -66,7 +67,9 @@ public: HYPRE_DeviceInitialize(); HYPRE_PrintDeviceInfo(); } - else { + else +#endif + { HYPRE_SetMemoryLocation(HYPRE_MEMORY_HOST); HYPRE_SetExecutionPolicy(HYPRE_EXEC_HOST); } diff --git a/opm/simulators/linalg/PreconditionerFactory_impl.hpp b/opm/simulators/linalg/PreconditionerFactory_impl.hpp index 2d7607a3a..04bedf0e2 100644 --- a/opm/simulators/linalg/PreconditionerFactory_impl.hpp +++ b/opm/simulators/linalg/PreconditionerFactory_impl.hpp @@ -549,7 +549,8 @@ struct StandardPreconditioners { }); #if HAVE_HYPRE // Only add Hypre for scalar matrices - if constexpr (M::block_type::rows == 1 && M::block_type::cols == 1) { + if constexpr (M::block_type::rows == 1 && M::block_type::cols == 1 && + std::is_same_v) { F::addCreator("hypre", [](const O& op, const P& prm, const std::function&, std::size_t) { return std::make_shared>(op.getmat(), prm); });