20 #ifndef OPM_CUSPARSESOLVER_BACKEND_HEADER_INCLUDED 21 #define OPM_CUSPARSESOLVER_BACKEND_HEADER_INCLUDED 24 #include "cublas_v2.h" 25 #include "cusparse_v2.h" 27 #include <opm/simulators/linalg/gpubridge/GpuResult.hpp> 28 #include <opm/simulators/linalg/gpubridge/GpuSolver.hpp> 29 #include <opm/simulators/linalg/gpubridge/WellContributions.hpp> 34 template<
class Scalar,
unsigned int block_size>
43 using Base::verbosity;
46 using Base::tolerance;
47 using Base::initialized;
50 cublasHandle_t cublasHandle;
51 cusparseHandle_t cusparseHandle;
53 cusparseMatDescr_t descr_B, descr_M, descr_L, descr_U;
54 bsrilu02Info_t info_M;
55 bsrsv2Info_t info_L, info_U;
57 Scalar *d_bVals, *d_mVals;
58 int *d_bCols, *d_mCols;
59 int *d_bRows, *d_mRows;
60 Scalar *d_x, *d_b, *d_r, *d_rw, *d_p;
61 Scalar *d_pw, *d_s, *d_t, *d_v;
63 Scalar *vals_contiguous;
65 bool analysis_done =
false;
67 bool useJacMatrix =
false;
107 bool analyse_matrix();
111 bool create_preconditioner();
125 Scalar tolerance,
unsigned int deviceID);
~cusparseSolverBackend()
Destroy a cusparseSolver, and free memory.
cusparseSolverBackend(int linear_solver_verbosity, int maxit, Scalar tolerance, unsigned int deviceID)
Construct a cusparseSolver.
Definition: amgclSolverBackend.cpp:49
This class is based on InverseOperatorResult struct from dune/istl/solver.hh It is needed to prevent ...
Definition: GpuResult.hpp:30
This class serves to eliminate the need to include the WellContributions into the matrix (with –matr...
Definition: GpuBridge.hpp:30
void get_result(Scalar *x) override
Get resulting vector x after linear solve, also includes post processing if necessary.
This struct resembles a blocked csr matrix, like Dune::BCRSMatrix.
Definition: BlockedMatrix.hpp:28
This class implements a cusparse-based ilu0-bicgstab solver on GPU.
Definition: cusparseSolverBackend.hpp:35
This class serves to simplify choosing between different backend solvers, such as cusparseSolver and ...
Definition: GpuSolver.hpp:45