15 #include <unordered_map>
18 #include <dpsim/Config.h>
19 #include <dpsim/Definitions.h>
20 #include <dpsim/DirectLinearSolver.h>
22 #include <cuda_runtime.h>
23 #include <cusolverDn.h>
25 #define CUDA_ERROR_HANDLER(func) \
28 if ((error = func) != cudaSuccess) \
29 std::cerr << cudaGetErrorString(error) << std::endl; \
58 void allocateDeviceMemory();
60 void copySystemMatrixToDevice(Matrix systemMatrix);
62 void LUfactorization();
76 std::vector<std::pair<UInt, UInt>>
77 &listVariableSystemMatrixEntries)
override;
80 virtual void factorize(SparseMatrix &systemMatrix)
override;
83 virtual void refactorize(SparseMatrix &systemMatrix)
override;
87 std::vector<std::pair<UInt, UInt>> &
88 listVariableSystemMatrixEntries)
override;
91 virtual Matrix
solve(Matrix &rightSideVector)
override;
DirectLinearSolver()=default
Constructor.
GpuDenseAdapter()
Constructor.
cusolverDnHandle_t mCusolverHandle
Solver-Handle.
virtual Matrix solve(Matrix &rightSideVector) override
solution function for a right hand side
cudaStream_t mStream
Stream.
virtual void factorize(SparseMatrix &systemMatrix) override
factorization function with partial pivoting
virtual void partialRefactorize(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
partial refactorization withouth partial pivoting
virtual void preprocessing(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
preprocessing function pre-ordering and scaling the matrix
virtual ~GpuDenseAdapter()
Destructor.
virtual void refactorize(SparseMatrix &systemMatrix) override
refactorization without partial pivoting
Variables for solving one Equation-system (All pointer are device-pointer)
double * matrix
Device copy of System-Matrix.
double * vector
Device copy of Vector.
int * pivSeq
Pivoting-Sequence.
UInt size
Size of one dimension.
double * workSpace
Device-Workspace for getrf.