Skip to content

Commit

Permalink
Merge naive lower triangular solver + updated cuSPARSE solvers
Browse files Browse the repository at this point in the history
This PR adds a naive lower triangular solver implementation for CUDA to Ginkgo,
and updates the cuSPARSE solver wrappers to use the new cuSPARSE 11.* triangular solver.

Related PR: #764
  • Loading branch information
upsj authored Dec 14, 2021
2 parents e780783 + 3916a4b commit 00a4f67
Show file tree
Hide file tree
Showing 25 changed files with 803 additions and 320 deletions.
2 changes: 0 additions & 2 deletions core/device_hooks/common_kernels.inc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ namespace lower_trs {


GKO_STUB(GKO_DECLARE_LOWER_TRS_SHOULD_PERFORM_TRANSPOSE_KERNEL);
GKO_STUB(GKO_DECLARE_LOWER_TRS_INIT_STRUCT_KERNEL);
GKO_STUB_VALUE_AND_INDEX_TYPE(GKO_DECLARE_LOWER_TRS_GENERATE_KERNEL);
GKO_STUB_VALUE_AND_INDEX_TYPE(GKO_DECLARE_LOWER_TRS_SOLVE_KERNEL);

Expand All @@ -330,7 +329,6 @@ namespace upper_trs {


GKO_STUB(GKO_DECLARE_UPPER_TRS_SHOULD_PERFORM_TRANSPOSE_KERNEL);
GKO_STUB(GKO_DECLARE_UPPER_TRS_INIT_STRUCT_KERNEL);
GKO_STUB_VALUE_AND_INDEX_TYPE(GKO_DECLARE_UPPER_TRS_GENERATE_KERNEL);
GKO_STUB_VALUE_AND_INDEX_TYPE(GKO_DECLARE_UPPER_TRS_SOLVE_KERNEL);

Expand Down
11 changes: 1 addition & 10 deletions core/solver/lower_trs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace {


GKO_REGISTER_OPERATION(generate, lower_trs::generate);
GKO_REGISTER_OPERATION(init_struct, lower_trs::init_struct);
GKO_REGISTER_OPERATION(should_perform_transpose,
lower_trs::should_perform_transpose);
GKO_REGISTER_OPERATION(solve, lower_trs::solve);
Expand Down Expand Up @@ -85,19 +84,11 @@ std::unique_ptr<LinOp> LowerTrs<ValueType, IndexType>::conj_transpose() const
}


template <typename ValueType, typename IndexType>
void LowerTrs<ValueType, IndexType>::init_trs_solve_struct()
{
this->get_executor()->run(lower_trs::make_init_struct(this->solve_struct_));
}


template <typename ValueType, typename IndexType>
void LowerTrs<ValueType, IndexType>::generate()
{
this->get_executor()->run(lower_trs::make_generate(
gko::lend(system_matrix_), gko::lend(this->solve_struct_),
parameters_.num_rhs));
gko::lend(system_matrix_), this->solve_struct_, parameters_.num_rhs));
}


Expand Down
14 changes: 4 additions & 10 deletions core/solver/lower_trs_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,10 @@ namespace lower_trs {
bool& do_transpose)


#define GKO_DECLARE_LOWER_TRS_INIT_STRUCT_KERNEL \
void init_struct(std::shared_ptr<const DefaultExecutor> exec, \
std::shared_ptr<solver::SolveStruct>& solve_struct)


#define GKO_DECLARE_LOWER_TRS_GENERATE_KERNEL(_vtype, _itype) \
void generate(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<_vtype, _itype>* matrix, \
solver::SolveStruct* solve_struct, \
#define GKO_DECLARE_LOWER_TRS_GENERATE_KERNEL(_vtype, _itype) \
void generate(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<_vtype, _itype>* matrix, \
std::shared_ptr<solver::SolveStruct>& solve_struct, \
const gko::size_type num_rhs)


Expand All @@ -80,7 +75,6 @@ namespace lower_trs {

#define GKO_DECLARE_ALL_AS_TEMPLATES \
GKO_DECLARE_LOWER_TRS_SHOULD_PERFORM_TRANSPOSE_KERNEL; \
GKO_DECLARE_LOWER_TRS_INIT_STRUCT_KERNEL; \
template <typename ValueType, typename IndexType> \
GKO_DECLARE_LOWER_TRS_SOLVE_KERNEL(ValueType, IndexType); \
template <typename ValueType, typename IndexType> \
Expand Down
11 changes: 1 addition & 10 deletions core/solver/upper_trs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace {


GKO_REGISTER_OPERATION(generate, upper_trs::generate);
GKO_REGISTER_OPERATION(init_struct, upper_trs::init_struct);
GKO_REGISTER_OPERATION(should_perform_transpose,
upper_trs::should_perform_transpose);
GKO_REGISTER_OPERATION(solve, upper_trs::solve);
Expand Down Expand Up @@ -85,19 +84,11 @@ std::unique_ptr<LinOp> UpperTrs<ValueType, IndexType>::conj_transpose() const
}


template <typename ValueType, typename IndexType>
void UpperTrs<ValueType, IndexType>::init_trs_solve_struct()
{
this->get_executor()->run(upper_trs::make_init_struct(this->solve_struct_));
}


template <typename ValueType, typename IndexType>
void UpperTrs<ValueType, IndexType>::generate()
{
this->get_executor()->run(upper_trs::make_generate(
gko::lend(system_matrix_), gko::lend(this->solve_struct_),
parameters_.num_rhs));
gko::lend(system_matrix_), this->solve_struct_, parameters_.num_rhs));
}


Expand Down
14 changes: 4 additions & 10 deletions core/solver/upper_trs_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,10 @@ namespace upper_trs {
bool& do_transpose)


#define GKO_DECLARE_UPPER_TRS_INIT_STRUCT_KERNEL \
void init_struct(std::shared_ptr<const DefaultExecutor> exec, \
std::shared_ptr<gko::solver::SolveStruct>& solve_struct)


#define GKO_DECLARE_UPPER_TRS_GENERATE_KERNEL(_vtype, _itype) \
void generate(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<_vtype, _itype>* matrix, \
solver::SolveStruct* solve_struct, \
#define GKO_DECLARE_UPPER_TRS_GENERATE_KERNEL(_vtype, _itype) \
void generate(std::shared_ptr<const DefaultExecutor> exec, \
const matrix::Csr<_vtype, _itype>* matrix, \
std::shared_ptr<gko::solver::SolveStruct>& solve_struct, \
const gko::size_type num_rhs)


Expand All @@ -80,7 +75,6 @@ namespace upper_trs {

#define GKO_DECLARE_ALL_AS_TEMPLATES \
GKO_DECLARE_UPPER_TRS_SHOULD_PERFORM_TRANSPOSE_KERNEL; \
GKO_DECLARE_UPPER_TRS_INIT_STRUCT_KERNEL; \
template <typename ValueType, typename IndexType> \
GKO_DECLARE_UPPER_TRS_SOLVE_KERNEL(ValueType, IndexType); \
template <typename ValueType, typename IndexType> \
Expand Down
Loading

0 comments on commit 00a4f67

Please sign in to comment.