mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Replaced exit() with OPM_THROW. Replaced primitive pointer with unique_ptr.
This commit is contained in:
parent
13e524dba2
commit
293bd5816f
@ -225,7 +225,7 @@ protected:
|
||||
static const int numEq = Indices::numEq;
|
||||
|
||||
#if HAVE_CUDA
|
||||
BdaBridge *bdaBridge;
|
||||
std::unique_ptr<BdaBridge> bdaBridge;
|
||||
#endif
|
||||
|
||||
public:
|
||||
@ -252,27 +252,19 @@ protected:
|
||||
const bool matrix_add_well_contributions = EWOMS_GET_PARAM(TypeTag, bool, MatrixAddWellContributions);
|
||||
const int linear_solver_verbosity = parameters_.linear_solver_verbosity_;
|
||||
if(use_gpu && !matrix_add_well_contributions){
|
||||
std::cerr << "Error cannot use GPU solver if command line parameter --matrix-add-well-contributions is false, because the GPU solver performs a standard bicgstab" << std::endl;
|
||||
exit(1);
|
||||
OPM_THROW(std::logic_error,"Error cannot use GPU solver if command line parameter --matrix-add-well-contributions is false, because the GPU solver performs a standard bicgstab");
|
||||
}
|
||||
bdaBridge = new BdaBridge(use_gpu, linear_solver_verbosity, maxit, tolerance);
|
||||
bdaBridge.reset(new BdaBridge(use_gpu, linear_solver_verbosity, maxit, tolerance));
|
||||
#else
|
||||
const bool use_gpu = EWOMS_GET_PARAM(TypeTag, bool, UseGpu);
|
||||
if(use_gpu){
|
||||
std::cerr << "Error cannot use GPU solver since CUDA was not found during compilation" << std::endl;
|
||||
exit(1);
|
||||
OPM_THROW(std::logic_error,"Error cannot use GPU solver since CUDA was not found during compilation");
|
||||
}
|
||||
#endif
|
||||
extractParallelGridInformationToISTL(simulator_.vanguard().grid(), parallelInformation_);
|
||||
detail::findOverlapRowsAndColumns(simulator_.vanguard().grid(),overlapRowAndColumns_);
|
||||
}
|
||||
|
||||
~ISTLSolverEbos(){
|
||||
#if HAVE_CUDA
|
||||
delete bdaBridge;
|
||||
#endif
|
||||
}
|
||||
|
||||
// nothing to clean here
|
||||
void eraseMatrix() {
|
||||
matrix_for_preconditioner_.reset();
|
||||
|
@ -35,21 +35,14 @@ namespace Opm
|
||||
{
|
||||
|
||||
BdaBridge::BdaBridge(bool use_gpu_, int linear_solver_verbosity OPM_UNUSED, int maxit OPM_UNUSED, double tolerance OPM_UNUSED) : use_gpu(use_gpu_) {
|
||||
#if HAVE_CUDA
|
||||
if(use_gpu){
|
||||
backend = new cusparseSolverBackend(linear_solver_verbosity, maxit, tolerance);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
BdaBridge::~BdaBridge(){
|
||||
#if HAVE_CUDA
|
||||
if(use_gpu){
|
||||
delete backend;
|
||||
backend.reset(new cusparseSolverBackend(linear_solver_verbosity, maxit, tolerance));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_CUDA
|
||||
template <class BridgeMatrix>
|
||||
int checkZeroDiagonal(BridgeMatrix& mat) {
|
||||
|
@ -40,7 +40,7 @@ class BdaBridge
|
||||
{
|
||||
private:
|
||||
#if HAVE_CUDA
|
||||
cusparseSolverBackend *backend;
|
||||
std::unique_ptr<cusparseSolverBackend> backend;
|
||||
#endif
|
||||
bool use_gpu;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user