mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only do CPU decomposition if needed, when using GPU
This commit is contained in:
parent
5c1d964478
commit
0bf91691fe
@ -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>::
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user