Skip to content

Commit a6ae521

Browse files
fix missing task in task based hlu
1 parent fa05662 commit a6ae521

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file.
3838
### Fixed
3939

4040
- Fix uninitialized values in `Partitioning_N`.
41+
- Fix bug in task-based HLU, PR#81 thanks to @ABoisneault.
4142

4243
## [1.0.2] - 2026-02-14
4344

‎include/htool/hmatrix/linalg/task_based_factorization.hpp‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ void task_based_lu_factorization(HMatrix<CoefficientPrecision, CoordinatePrecisi
9393
}
9494
}
9595
} else if (hmatrix.is_dense()) {
96-
lu_factorization(*hmatrix.get_dense_data());
96+
#if defined(_OPENMP) && !defined(HTOOL_WITH_PYTHON_INTERFACE)
97+
# pragma omp task default(none) \
98+
shared(hmatrix) \
99+
depend(inout : hmatrix)
100+
101+
#endif
102+
{
103+
lu_factorization(*hmatrix.get_dense_data());
104+
}
97105
} else {
98106
htool::Logger::get_instance().log(LogLevel::ERROR, "Operation is not implemented for task_based_lu_factorization (hmatrix is low-rank)"); // LCOV_EXCL_LINE
99107
}
@@ -185,7 +193,16 @@ void task_based_cholesky_factorization(char UPLO, HMatrix<CoefficientPrecision,
185193
}
186194
}
187195
} else if (hmatrix.is_dense()) {
188-
cholesky_factorization(UPLO, *hmatrix.get_dense_data());
196+
#if defined(_OPENMP) && !defined(HTOOL_WITH_PYTHON_INTERFACE)
197+
# pragma omp task default(none) \
198+
firstprivate(UPLO) \
199+
shared(hmatrix) \
200+
depend(inout : hmatrix)
201+
202+
#endif
203+
{
204+
cholesky_factorization(UPLO, *hmatrix.get_dense_data());
205+
}
189206
} else {
190207
htool::Logger::get_instance().log(LogLevel::ERROR, "Operation is not implemented for task_based_cholesky_factorization (hmatrix is low-rank)"); // LCOV_EXCL_LINE
191208
}

‎tests/functional_tests/hmatrix/hmatrix_factorization/test_task_based_hmatrix_factorization_double.cpp‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ int main(int, char *[]) {
1111

1212
bool is_error = false;
1313

14-
const int n1 = 1100;
1514
const int n2 = 1000;
15+
for (auto n1 : {10, 1100}) { // 10 to deal with trival case
16+
for (auto epsilon : {1e-4, 1e-8}) {
17+
for (auto trans : {'N', 'T'}) {
1618

17-
for (auto epsilon : {1e-4, 1e-8}) {
18-
for (auto trans : {'N', 'T'}) {
19+
std::cout << "task based LU factorization test case: " << "epsilon = " << epsilon << ", n1 = " << n1 << ", n2 = " << n2 << ", trans = " << trans << "\n";
1920

20-
std::cout << "task based LU factorization test case: " << "epsilon = " << epsilon << ", n1 = " << n1 << ", n2 = " << n2 << ", trans = " << trans << "\n";
21+
is_error = is_error || test_task_based_lu_factorization<double, GeneratorTestDoubleSymmetric>(trans, n1, n2, epsilon);
22+
}
2123

22-
is_error = is_error || test_task_based_lu_factorization<double, GeneratorTestDoubleSymmetric>(trans, n1, n2, epsilon);
23-
}
24-
25-
for (auto UPLO : {'L', 'U'}) {
26-
std::cout << "task based Cholesky factorization test case: " << "epsilon = " << epsilon << ", n1 = " << n1 << ", n2 = " << n2 << ", UPLO = " << UPLO << "\n";
24+
for (auto UPLO : {'L', 'U'}) {
25+
std::cout << "task based Cholesky factorization test case: " << "epsilon = " << epsilon << ", n1 = " << n1 << ", n2 = " << n2 << ", UPLO = " << UPLO << "\n";
2726

28-
is_error = is_error || test_task_based_cholesky_factorization<double, GeneratorTestDoubleSymmetric>(UPLO, n1, n2, epsilon);
27+
is_error = is_error || test_task_based_cholesky_factorization<double, GeneratorTestDoubleSymmetric>(UPLO, n1, n2, epsilon);
28+
}
2929
}
3030
}
3131

0 commit comments

Comments
 (0)