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;
|
static const int numEq = Indices::numEq;
|
||||||
|
|
||||||
#if HAVE_CUDA
|
#if HAVE_CUDA
|
||||||
BdaBridge *bdaBridge;
|
std::unique_ptr<BdaBridge> bdaBridge;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -252,27 +252,19 @@ protected:
|
|||||||
const bool matrix_add_well_contributions = EWOMS_GET_PARAM(TypeTag, bool, MatrixAddWellContributions);
|
const bool matrix_add_well_contributions = EWOMS_GET_PARAM(TypeTag, bool, MatrixAddWellContributions);
|
||||||
const int linear_solver_verbosity = parameters_.linear_solver_verbosity_;
|
const int linear_solver_verbosity = parameters_.linear_solver_verbosity_;
|
||||||
if(use_gpu && !matrix_add_well_contributions){
|
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;
|
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");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
bdaBridge = new BdaBridge(use_gpu, linear_solver_verbosity, maxit, tolerance);
|
bdaBridge.reset(new BdaBridge(use_gpu, linear_solver_verbosity, maxit, tolerance));
|
||||||
#else
|
#else
|
||||||
const bool use_gpu = EWOMS_GET_PARAM(TypeTag, bool, UseGpu);
|
const bool use_gpu = EWOMS_GET_PARAM(TypeTag, bool, UseGpu);
|
||||||
if(use_gpu){
|
if(use_gpu){
|
||||||
std::cerr << "Error cannot use GPU solver since CUDA was not found during compilation" << std::endl;
|
OPM_THROW(std::logic_error,"Error cannot use GPU solver since CUDA was not found during compilation");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
extractParallelGridInformationToISTL(simulator_.vanguard().grid(), parallelInformation_);
|
extractParallelGridInformationToISTL(simulator_.vanguard().grid(), parallelInformation_);
|
||||||
detail::findOverlapRowsAndColumns(simulator_.vanguard().grid(),overlapRowAndColumns_);
|
detail::findOverlapRowsAndColumns(simulator_.vanguard().grid(),overlapRowAndColumns_);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ISTLSolverEbos(){
|
|
||||||
#if HAVE_CUDA
|
|
||||||
delete bdaBridge;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// nothing to clean here
|
// nothing to clean here
|
||||||
void eraseMatrix() {
|
void eraseMatrix() {
|
||||||
matrix_for_preconditioner_.reset();
|
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_) {
|
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 HAVE_CUDA
|
||||||
if(use_gpu){
|
if(use_gpu){
|
||||||
delete backend;
|
backend.reset(new cusparseSolverBackend(linear_solver_verbosity, maxit, tolerance));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_CUDA
|
#if HAVE_CUDA
|
||||||
template <class BridgeMatrix>
|
template <class BridgeMatrix>
|
||||||
int checkZeroDiagonal(BridgeMatrix& mat) {
|
int checkZeroDiagonal(BridgeMatrix& mat) {
|
||||||
|
@ -40,7 +40,7 @@ class BdaBridge
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
#if HAVE_CUDA
|
#if HAVE_CUDA
|
||||||
cusparseSolverBackend *backend;
|
std::unique_ptr<cusparseSolverBackend> backend;
|
||||||
#endif
|
#endif
|
||||||
bool use_gpu;
|
bool use_gpu;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user