Only do CPU decomposition if needed, when using GPU

This commit is contained in:
Tong Dong Qiu 2023-03-22 11:06:36 +01:00
parent 5c1d964478
commit 0bf91691fe
2 changed files with 21 additions and 0 deletions

View File

@ -265,6 +265,13 @@ apply(Vector& rhs,
return false;
}
template<class Matrix, class Vector>
bool BdaSolverInfo<Matrix,Vector>::
gpuActive()
{
return bridge_->getUseGpu();
}
template<class Matrix, class Vector>
template<class Grid>
void BdaSolverInfo<Matrix,Vector>::

View File

@ -149,6 +149,8 @@ struct BdaSolverInfo
Vector& x,
Dune::InverseOperatorResult& result);
bool gpuActive();
int numJacobiBlocks_ = 0;
private:
@ -351,7 +353,14 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
if (isParallel() && prm_.get<std::string>("preconditioner.type") != "ParOverILU0") {
detail::makeOverlapRowsInvalid(getMatrix(), overlapRows_);
}
#if COMPILE_BDA_BRIDGE
if(!bdaBridge->gpuActive()){
prepareFlexibleSolver();
}
#else
prepareFlexibleSolver();
#endif
firstcall = false;
}
@ -401,6 +410,11 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
#endif
{
OPM_TIMEBLOCK(flexibleSolverApply);
#if COMPILE_BDA_BRIDGE
if(bdaBridge->gpuActive()){
prepareFlexibleSolver();
}
#endif
assert(flexibleSolver_.solver_);
flexibleSolver_.solver_->apply(x, *rhs_, result);
}