15 #include <unordered_map>
18 #include <dpsim/Config.h>
19 #include <dpsim/Definitions.h>
20 #include <dpsim/DirectLinearSolver.h>
22 #include <cusolverSp.h>
23 #include <dpsim/Cuda/CudaUtility.h>
31 cusolverSpHandle_t mCusolverhandle =
nullptr;
34 std::unique_ptr<cuda::CudaMatrix<double, int>>
mSysMat =
nullptr;
35 std::unique_ptr<Eigen::PermutationMatrix<Eigen::Dynamic>> mTransp =
nullptr;
44 void iluPreconditioner();
46 void performFactorization(SparseMatrix &systemMatrix);
51 cusparseMatDescr_t descr_L =
nullptr;
52 cusparseMatDescr_t descr_U =
nullptr;
53 csrsv2Info_t info_L =
nullptr;
54 csrsv2Info_t info_U =
nullptr;
56 void checkCusparseStatus(cusparseStatus_t status,
57 std::string additionalInfo =
"cuSparse Error:");
71 std::vector<std::pair<UInt, UInt>>
72 &listVariableSystemMatrixEntries)
override;
75 virtual void factorize(SparseMatrix &systemMatrix)
override;
78 virtual void refactorize(SparseMatrix &systemMatrix)
override;
82 std::vector<std::pair<UInt, UInt>> &
83 listVariableSystemMatrixEntries)
override;
86 virtual Matrix
solve(Matrix &rightSideVector)
override;
DirectLinearSolver()=default
Constructor.
virtual ~GpuSparseAdapter()
Destructor.
virtual void preprocessing(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
preprocessing function pre-ordering and scaling the matrix
virtual void refactorize(SparseMatrix &systemMatrix) override
refactorization without partial pivoting
cuda::Vector< double > mGpuLhsVec
LHS-Vector.
cuda::Vector< double > mGpuRhsVec
RHS-Vector.
virtual Matrix solve(Matrix &rightSideVector) override
solution function for a right hand side
virtual void partialRefactorize(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
partial refactorization withouth partial pivoting
GpuSparseAdapter()
Constructor.
std::unique_ptr< cuda::CudaMatrix< double, int > > mSysMat
Systemmatrix on Device.
virtual void factorize(SparseMatrix &systemMatrix) override
factorization function with partial pivoting
cuda::Vector< double > mGpuIntermediateVec
Intermediate Vector.
cusparseHandle_t mCusparsehandle
Solver-Handle.