Skip to content

Commit 0b3436e

Browse files
authored
Merge "MST Preprocessing for symbolic Cholesky" (#1765)
This adds a preprocessing step to the symbolic Cholesky algorithm, thinning out the graph into a tree with the same elimination tree for faster tree computation. Related PR: #1765
2 parents 75b134a + 7ff5f59 commit 0b3436e

33 files changed

+3059
-573
lines changed

benchmark/sparse_blas/operations.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,9 @@ class SymbolicLuNearSymmOperation : public BenchmarkOperation {
614614

615615
class SymbolicCholeskyOperation : public BenchmarkOperation {
616616
public:
617-
explicit SymbolicCholeskyOperation(const Mtx* mtx, bool symmetric)
618-
: mtx_{mtx}, symmetric_{symmetric}, result_{}
617+
explicit SymbolicCholeskyOperation(const Mtx* mtx, bool device,
618+
bool symmetric)
619+
: mtx_{mtx}, device_{device}, symmetric_{symmetric}, result_{}
619620
{}
620621

621622
std::pair<bool, double> validate() const override
@@ -643,8 +644,13 @@ class SymbolicCholeskyOperation : public BenchmarkOperation {
643644

644645
void run() override
645646
{
646-
gko::factorization::symbolic_cholesky(mtx_, symmetric_, result_,
647-
forest_);
647+
if (device_) {
648+
gko::factorization::symbolic_cholesky_device(mtx_, symmetric_,
649+
result_, forest_);
650+
} else {
651+
gko::factorization::symbolic_cholesky(mtx_, symmetric_, result_,
652+
forest_);
653+
}
648654
}
649655

650656
void write_stats(json& object) override
@@ -654,6 +660,7 @@ class SymbolicCholeskyOperation : public BenchmarkOperation {
654660

655661
private:
656662
const Mtx* mtx_;
663+
bool device_;
657664
bool symmetric_;
658665
std::unique_ptr<Mtx> result_;
659666
std::unique_ptr<gko::factorization::elimination_forest<itype>> forest_;
@@ -791,13 +798,25 @@ const std::map<std::string,
791798
[](const Mtx* mtx) {
792799
return std::make_unique<SymbolicLuNearSymmOperation>(mtx);
793800
}},
801+
{"symbolic_cholesky_device",
802+
[](const Mtx* mtx) {
803+
return std::make_unique<SymbolicCholeskyOperation>(mtx, true,
804+
false);
805+
}},
806+
{"symbolic_cholesky_device_symmetric",
807+
[](const Mtx* mtx) {
808+
return std::make_unique<SymbolicCholeskyOperation>(mtx, true,
809+
true);
810+
}},
794811
{"symbolic_cholesky",
795812
[](const Mtx* mtx) {
796-
return std::make_unique<SymbolicCholeskyOperation>(mtx, false);
813+
return std::make_unique<SymbolicCholeskyOperation>(mtx, false,
814+
false);
797815
}},
798816
{"symbolic_cholesky_symmetric",
799817
[](const Mtx* mtx) {
800-
return std::make_unique<SymbolicCholeskyOperation>(mtx, true);
818+
return std::make_unique<SymbolicCholeskyOperation>(mtx, false,
819+
true);
801820
}},
802821
{"reorder_rcm",
803822
[](const Mtx* mtx) {

benchmark/test/reference/sparse_blas.reordered.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"bandwidth": 1.0,
1010
"repetitions": 10,
1111
"components": {
12-
"compute_elim_forest": 1.0,
12+
"compute_elimination_forest": 1.0,
1313
"allocate": 1.0,
1414
"free": 1.0,
1515
"components::fill_array": 1.0,

common/cuda_hip/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(CUDA_HIP_SOURCES
1212
distributed/vector_kernels.cpp
1313
factorization/cholesky_kernels.cpp
1414
factorization/factorization_kernels.cpp
15+
factorization/elimination_forest_kernels.cpp
1516
factorization/ic_kernels.cpp
1617
factorization/ilu_kernels.cpp
1718
factorization/lu_kernels.cpp

0 commit comments

Comments
 (0)