From 0fcad4b0fc844742359278abcbdc0e21da1a856c Mon Sep 17 00:00:00 2001 From: Razvan Nane Date: Wed, 13 Mar 2024 16:47:55 +0100 Subject: [PATCH] Bug fix: remove dep rocm & cuda on opencl for blockJacobi ILU --- opm/simulators/flow/FlowBaseVanguard.hpp | 12 ++++++------ opm/simulators/flow/FlowGenericVanguard.hpp | 6 +++--- opm/simulators/flow/GenericCpGridVanguard.cpp | 4 ++-- opm/simulators/linalg/ISTLSolverBda.hpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/opm/simulators/flow/FlowBaseVanguard.hpp b/opm/simulators/flow/FlowBaseVanguard.hpp index 10b272e97..6f74c2055 100644 --- a/opm/simulators/flow/FlowBaseVanguard.hpp +++ b/opm/simulators/flow/FlowBaseVanguard.hpp @@ -89,12 +89,12 @@ struct EdgeWeightsMethod { using type = UndefinedProperty; }; -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA template struct NumJacobiBlocks { using type = UndefinedProperty; }; -#endif // HAVE_OPENCL || HAVE_ROCSPARSE +#endif template struct OwnerCellsFirst { @@ -156,12 +156,12 @@ struct EdgeWeightsMethod { static constexpr int value = 1; }; -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA template struct NumJacobiBlocks { static constexpr int value = 0; }; -#endif // HAVE_OPENCL || HAVE_ROCSPARSE +#endif template struct OwnerCellsFirst { @@ -256,7 +256,7 @@ public: EWOMS_REGISTER_PARAM(TypeTag, int, EdgeWeightsMethod, "Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans)."); -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA EWOMS_REGISTER_PARAM(TypeTag, int, NumJacobiBlocks, "Number of blocks to be created for the Block-Jacobi preconditioner."); #endif @@ -302,7 +302,7 @@ public: fileName_ = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName); edgeWeightsMethod_ = Dune::EdgeWeightMethod(EWOMS_GET_PARAM(TypeTag, int, EdgeWeightsMethod)); -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA numJacobiBlocks_ = EWOMS_GET_PARAM(TypeTag, int, NumJacobiBlocks); #endif diff --git a/opm/simulators/flow/FlowGenericVanguard.hpp b/opm/simulators/flow/FlowGenericVanguard.hpp index 7462346fa..4085450a5 100644 --- a/opm/simulators/flow/FlowGenericVanguard.hpp +++ b/opm/simulators/flow/FlowGenericVanguard.hpp @@ -199,7 +199,7 @@ public: */ int numJacobiBlocks() const { -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA return numJacobiBlocks_; #else return 0; @@ -285,9 +285,9 @@ protected: std::string fileName_; Dune::EdgeWeightMethod edgeWeightsMethod_; -#if HAVE_OPENCL || HAVE_ROCSPARSE +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA int numJacobiBlocks_{0}; -#endif // HAVE_OPENCL || HAVE_ROCSPARSE +#endif bool ownersFirst_; #if HAVE_MPI diff --git a/opm/simulators/flow/GenericCpGridVanguard.cpp b/opm/simulators/flow/GenericCpGridVanguard.cpp index b823d8363..e9c8fe34b 100644 --- a/opm/simulators/flow/GenericCpGridVanguard.cpp +++ b/opm/simulators/flow/GenericCpGridVanguard.cpp @@ -206,14 +206,14 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod, // first cell of a well (e.g. for pressure). Hence this is now // skipped. Rank 0 had everything even before. -#if HAVE_OPENCL +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA if (partitionJacobiBlocks) { this->cell_part_ = this->grid_-> zoltanPartitionWithoutScatter(&wells, faceTrans.data(), numJacobiBlocks, zoltanImbalanceTol); } -#endif // HAVE_OPENCL +#endif } } diff --git a/opm/simulators/linalg/ISTLSolverBda.hpp b/opm/simulators/linalg/ISTLSolverBda.hpp index cac83aa73..8789c6152 100644 --- a/opm/simulators/linalg/ISTLSolverBda.hpp +++ b/opm/simulators/linalg/ISTLSolverBda.hpp @@ -195,7 +195,7 @@ public: ParentType::prepare(M,b); } -#if HAVE_OPENCL +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA // update matrix entries for solvers. if (firstcall && bdaBridge_) { // model will not change the matrix object. Hence simply store a pointer