Remove redundant cpu decomposition when using gpu

This commit is contained in:
Razvan Nane 2023-10-26 06:40:06 +02:00
parent 70fcb864a0
commit cd63cc83c2
2 changed files with 23 additions and 8 deletions

View File

@ -306,14 +306,8 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
return flexibleSolver_.size();
}
void prepare(const SparseMatrixAdapter& M, Vector& b)
void initPrepare(const Matrix& M, Vector& b)
{
prepare(M.istlMatrix(), b);
}
void prepare(const Matrix& M, Vector& b)
{
OPM_TIMEBLOCK(istlSolverEbosPrepare);
const bool firstcall = (matrix_ == nullptr);
#if HAVE_MPI
if (firstcall && isParallel()) {
@ -344,6 +338,19 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
if (isParallel() && prm_[activeSolverNum_].template get<std::string>("preconditioner.type") != "ParOverILU0") {
detail::makeOverlapRowsInvalid(getMatrix(), overlapRows_);
}
}
void prepare(const SparseMatrixAdapter& M, Vector& b)
{
prepare(M.istlMatrix(), b);
}
void prepare(const Matrix& M, Vector& b)
{
OPM_TIMEBLOCK(istlSolverEbosPrepare);
initPrepare(M,b);
prepareFlexibleSolver();
}

View File

@ -182,7 +182,15 @@ public:
{
OPM_TIMEBLOCK(prepare);
[[maybe_unused]] const bool firstcall = (this->matrix_ == nullptr);
// Avoid performing the decomposition on CPU when we also do it on GPU, but we do
// need to initialize the pointers.
if(bdaBridge_){
ParentType::initPrepare(M,b);
}
else {
ParentType::prepare(M,b);
}
#if HAVE_OPENCL
// update matrix entries for solvers.