Fix ChowPatelIlu compilation errors,

introduced in recent PR
This commit is contained in:
Tong Dong Qiu 2022-02-02 14:48:40 +01:00
parent 6c8ada4cd2
commit c1cbf7a00f
4 changed files with 13 additions and 5 deletions

View File

@ -112,8 +112,8 @@ bool BILU0<block_size>::analyze_matrix(BlockedMatrix *mat)
invDiagVals.resize(mat->Nb * bs * bs); invDiagVals.resize(mat->Nb * bs * bs);
#if CHOW_PATEL #if CHOW_PATEL
Lmat = std::make_unique<BlockedMatrix>(mat->Nb, (mat->nnzbs - mat->Nb) / 2); Lmat = std::make_unique<BlockedMatrix>(mat->Nb, (mat->nnzbs - mat->Nb) / 2, bs);
Umat = std::make_unique<BlockedMatrix>(mat->Nb, (mat->nnzbs - mat->Nb) / 2); Umat = std::make_unique<BlockedMatrix>(mat->Nb, (mat->nnzbs - mat->Nb) / 2, bs);
#endif #endif
s.invDiagVals = cl::Buffer(*context, CL_MEM_READ_WRITE, sizeof(double) * bs * bs * mat->Nb); s.invDiagVals = cl::Buffer(*context, CL_MEM_READ_WRITE, sizeof(double) * bs * bs * mat->Nb);
@ -182,7 +182,7 @@ bool BILU0<block_size>::create_preconditioner(BlockedMatrix *mat)
} }
#if CHOW_PATEL #if CHOW_PATEL
chowPatelIlu.decomposition(queue, context, chowPatelIlu.decomposition(queue.get(), context.get(),
LUmat.get(), Lmat.get(), Umat.get(), LUmat.get(), Lmat.get(), Umat.get(),
invDiagVals.data(), diagIndex, invDiagVals.data(), diagIndex,
s.diagIndex, s.invDiagVals, s.diagIndex, s.invDiagVals,

View File

@ -121,7 +121,11 @@ public:
std::pair<cl::Buffer, cl::Buffer> get_preconditioner_data() std::pair<cl::Buffer, cl::Buffer> 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); return std::make_pair(s.LUvals, s.invDiagVals);
#endif
} }
}; };

View File

@ -31,6 +31,7 @@
#include <opm/simulators/linalg/bda/opencl/BISAI.hpp> #include <opm/simulators/linalg/bda/opencl/BISAI.hpp>
#include <opm/simulators/linalg/bda/opencl/openclKernels.hpp> #include <opm/simulators/linalg/bda/opencl/openclKernels.hpp>
#include <opm/simulators/linalg/bda/Reorder.hpp> #include <opm/simulators/linalg/bda/Reorder.hpp>
#include <opm/simulators/linalg/bda/opencl/ChowPatelIlu.hpp> // disable BISAI if ChowPatel is selected
namespace Opm namespace Opm
{ {
@ -44,6 +45,9 @@ template <unsigned int block_size>
BISAI<block_size>::BISAI(ILUReorder opencl_ilu_reorder_, int verbosity_) : BISAI<block_size>::BISAI(ILUReorder opencl_ilu_reorder_, int verbosity_) :
Preconditioner<block_size>(verbosity_) Preconditioner<block_size>(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<BILU0<block_size> >(opencl_ilu_reorder_, verbosity_); bilu0 = std::make_unique<BILU0<block_size> >(opencl_ilu_reorder_, verbosity_);
} }

View File

@ -533,7 +533,7 @@ void ChowPatelIlu<block_size>::decomposition(
Timer t_total, t_preprocessing; Timer t_total, t_preprocessing;
// Ut is actually BSC format // Ut is actually BSC format
std::unique_ptr<BlockedMatrix<bs> > Ut = std::make_unique<BlockedMatrix<bs> >(Nb, (nnzbs + Nb) / 2); std::unique_ptr<BlockedMatrix> Ut = std::make_unique<BlockedMatrix>(Nb, (nnzbs + Nb) / 2, bs);
Lmat->rowPointers[0] = 0; Lmat->rowPointers[0] = 0;
for (int i = 0; i < Nb+1; i++) { for (int i = 0; i < Nb+1; i++) {
@ -990,7 +990,7 @@ void ChowPatelIlu<block_size>::gpu_decomposition(
#define INSTANTIATE_BDA_FUNCTIONS(n) \ #define INSTANTIATE_BDA_FUNCTIONS(n) \
template void ChowPatelIlu<n>::decomposition( \ template void ChowPatelIlu<n>::decomposition( \
cl::CommandQueue *queue, cl::Context *context, \ cl::CommandQueue *queue, cl::Context *context, \
BlockedMatrix<n> *LUmat, BlockedMatrix<n> *Lmat, BlockedMatrix<n> *Umat, \ BlockedMatrix *LUmat, BlockedMatrix *Lmat, BlockedMatrix *Umat, \
double *invDiagVals, std::vector<int>& diagIndex, \ double *invDiagVals, std::vector<int>& diagIndex, \
cl::Buffer& d_diagIndex, cl::Buffer& d_invDiagVals, \ cl::Buffer& d_diagIndex, cl::Buffer& d_invDiagVals, \
cl::Buffer& d_Lvals, cl::Buffer& d_Lcols, cl::Buffer& d_Lrows, \ cl::Buffer& d_Lvals, cl::Buffer& d_Lcols, cl::Buffer& d_Lrows, \