From c1cbf7a00f7a85fa0df4c915a9bb8f728486dcb3 Mon Sep 17 00:00:00 2001 From: Tong Dong Qiu Date: Wed, 2 Feb 2022 14:48:40 +0100 Subject: [PATCH] Fix ChowPatelIlu compilation errors, introduced in recent PR --- opm/simulators/linalg/bda/opencl/BILU0.cpp | 6 +++--- opm/simulators/linalg/bda/opencl/BILU0.hpp | 4 ++++ opm/simulators/linalg/bda/opencl/BISAI.cpp | 4 ++++ opm/simulators/linalg/bda/opencl/ChowPatelIlu.cpp | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/opm/simulators/linalg/bda/opencl/BILU0.cpp b/opm/simulators/linalg/bda/opencl/BILU0.cpp index 8f89875dc..0c2bc6364 100644 --- a/opm/simulators/linalg/bda/opencl/BILU0.cpp +++ b/opm/simulators/linalg/bda/opencl/BILU0.cpp @@ -112,8 +112,8 @@ bool BILU0::analyze_matrix(BlockedMatrix *mat) invDiagVals.resize(mat->Nb * bs * bs); #if CHOW_PATEL - Lmat = std::make_unique(mat->Nb, (mat->nnzbs - mat->Nb) / 2); - Umat = std::make_unique(mat->Nb, (mat->nnzbs - mat->Nb) / 2); + Lmat = std::make_unique(mat->Nb, (mat->nnzbs - mat->Nb) / 2, bs); + Umat = std::make_unique(mat->Nb, (mat->nnzbs - mat->Nb) / 2, bs); #endif s.invDiagVals = cl::Buffer(*context, CL_MEM_READ_WRITE, sizeof(double) * bs * bs * mat->Nb); @@ -182,7 +182,7 @@ bool BILU0::create_preconditioner(BlockedMatrix *mat) } #if CHOW_PATEL - chowPatelIlu.decomposition(queue, context, + chowPatelIlu.decomposition(queue.get(), context.get(), LUmat.get(), Lmat.get(), Umat.get(), invDiagVals.data(), diagIndex, s.diagIndex, s.invDiagVals, diff --git a/opm/simulators/linalg/bda/opencl/BILU0.hpp b/opm/simulators/linalg/bda/opencl/BILU0.hpp index 7cc4ff455..b3b9ce125 100644 --- a/opm/simulators/linalg/bda/opencl/BILU0.hpp +++ b/opm/simulators/linalg/bda/opencl/BILU0.hpp @@ -121,7 +121,11 @@ public: std::pair get_preconditioner_data() { +#if CHOW_PATEL + return std::make_pair(s.Lvals, s.invDiagVals); // send dummy, BISAI is disabled when ChowPatel is selected +#else return std::make_pair(s.LUvals, s.invDiagVals); +#endif } }; diff --git a/opm/simulators/linalg/bda/opencl/BISAI.cpp b/opm/simulators/linalg/bda/opencl/BISAI.cpp index 909d5013b..0febeebd4 100644 --- a/opm/simulators/linalg/bda/opencl/BISAI.cpp +++ b/opm/simulators/linalg/bda/opencl/BISAI.cpp @@ -31,6 +31,7 @@ #include #include #include +#include // disable BISAI if ChowPatel is selected namespace Opm { @@ -44,6 +45,9 @@ template BISAI::BISAI(ILUReorder opencl_ilu_reorder_, int verbosity_) : Preconditioner(verbosity_) { +#if CHOW_PATEL + OPM_THROW(std::logic_error, "Error --linsolver=isai cannot be used if ChowPatelIlu is used, probably defined by CMake\n"); +#endif bilu0 = std::make_unique >(opencl_ilu_reorder_, verbosity_); } diff --git a/opm/simulators/linalg/bda/opencl/ChowPatelIlu.cpp b/opm/simulators/linalg/bda/opencl/ChowPatelIlu.cpp index 2ec0e4904..c4d269429 100644 --- a/opm/simulators/linalg/bda/opencl/ChowPatelIlu.cpp +++ b/opm/simulators/linalg/bda/opencl/ChowPatelIlu.cpp @@ -533,7 +533,7 @@ void ChowPatelIlu::decomposition( Timer t_total, t_preprocessing; // Ut is actually BSC format - std::unique_ptr > Ut = std::make_unique >(Nb, (nnzbs + Nb) / 2); + std::unique_ptr Ut = std::make_unique(Nb, (nnzbs + Nb) / 2, bs); Lmat->rowPointers[0] = 0; for (int i = 0; i < Nb+1; i++) { @@ -990,7 +990,7 @@ void ChowPatelIlu::gpu_decomposition( #define INSTANTIATE_BDA_FUNCTIONS(n) \ template void ChowPatelIlu::decomposition( \ cl::CommandQueue *queue, cl::Context *context, \ - BlockedMatrix *LUmat, BlockedMatrix *Lmat, BlockedMatrix *Umat, \ + BlockedMatrix *LUmat, BlockedMatrix *Lmat, BlockedMatrix *Umat, \ double *invDiagVals, std::vector& diagIndex, \ cl::Buffer& d_diagIndex, cl::Buffer& d_invDiagVals, \ cl::Buffer& d_Lvals, cl::Buffer& d_Lcols, cl::Buffer& d_Lrows, \