Skip to content

Commit

Permalink
Merge "MST Preprocessing for symbolic Cholesky" (#1765)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
upsj authored Jan 16, 2025
2 parents 75b134a + 7ff5f59 commit 0b3436e
Show file tree
Hide file tree
Showing 33 changed files with 3,059 additions and 573 deletions.
31 changes: 25 additions & 6 deletions benchmark/sparse_blas/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,9 @@ class SymbolicLuNearSymmOperation : public BenchmarkOperation {

class SymbolicCholeskyOperation : public BenchmarkOperation {
public:
explicit SymbolicCholeskyOperation(const Mtx* mtx, bool symmetric)
: mtx_{mtx}, symmetric_{symmetric}, result_{}
explicit SymbolicCholeskyOperation(const Mtx* mtx, bool device,
bool symmetric)
: mtx_{mtx}, device_{device}, symmetric_{symmetric}, result_{}
{}

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

void run() override
{
gko::factorization::symbolic_cholesky(mtx_, symmetric_, result_,
forest_);
if (device_) {
gko::factorization::symbolic_cholesky_device(mtx_, symmetric_,
result_, forest_);
} else {
gko::factorization::symbolic_cholesky(mtx_, symmetric_, result_,
forest_);
}
}

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

private:
const Mtx* mtx_;
bool device_;
bool symmetric_;
std::unique_ptr<Mtx> result_;
std::unique_ptr<gko::factorization::elimination_forest<itype>> forest_;
Expand Down Expand Up @@ -791,13 +798,25 @@ const std::map<std::string,
[](const Mtx* mtx) {
return std::make_unique<SymbolicLuNearSymmOperation>(mtx);
}},
{"symbolic_cholesky_device",
[](const Mtx* mtx) {
return std::make_unique<SymbolicCholeskyOperation>(mtx, true,
false);
}},
{"symbolic_cholesky_device_symmetric",
[](const Mtx* mtx) {
return std::make_unique<SymbolicCholeskyOperation>(mtx, true,
true);
}},
{"symbolic_cholesky",
[](const Mtx* mtx) {
return std::make_unique<SymbolicCholeskyOperation>(mtx, false);
return std::make_unique<SymbolicCholeskyOperation>(mtx, false,
false);
}},
{"symbolic_cholesky_symmetric",
[](const Mtx* mtx) {
return std::make_unique<SymbolicCholeskyOperation>(mtx, true);
return std::make_unique<SymbolicCholeskyOperation>(mtx, false,
true);
}},
{"reorder_rcm",
[](const Mtx* mtx) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.reordered.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"bandwidth": 1.0,
"repetitions": 10,
"components": {
"compute_elim_forest": 1.0,
"compute_elimination_forest": 1.0,
"allocate": 1.0,
"free": 1.0,
"components::fill_array": 1.0,
Expand Down
1 change: 1 addition & 0 deletions common/cuda_hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(CUDA_HIP_SOURCES
distributed/vector_kernels.cpp
factorization/cholesky_kernels.cpp
factorization/factorization_kernels.cpp
factorization/elimination_forest_kernels.cpp
factorization/ic_kernels.cpp
factorization/ilu_kernels.cpp
factorization/lu_kernels.cpp
Expand Down
Loading

0 comments on commit 0b3436e

Please sign in to comment.