perf(solvers): scope default one-equation calls to one thread
This commit is contained in:
@@ -8,6 +8,24 @@
|
||||
|
||||
namespace fesa::dense_blas_internal {
|
||||
|
||||
ScopedSingleEquationThreads::ScopedSingleEquationThreads(
|
||||
const std::size_t equation_count) noexcept {
|
||||
// The measured 1x1 PARDISO case has backend/thread overhead and an
|
||||
// intermittently failing default-thread lifecycle. Broader sizes are not
|
||||
// inferred from this auxiliary evidence.
|
||||
if (equation_count != 1U) return;
|
||||
const int previous = mkl_set_num_threads_local(1);
|
||||
if (previous == 0) {
|
||||
restore_default_ = true;
|
||||
} else {
|
||||
static_cast<void>(mkl_set_num_threads_local(previous));
|
||||
}
|
||||
}
|
||||
|
||||
ScopedSingleEquationThreads::~ScopedSingleEquationThreads() {
|
||||
if (restore_default_) static_cast<void>(mkl_set_num_threads_local(0));
|
||||
}
|
||||
|
||||
bool CholeskyLowerAndInverse(const Matrix& matrix, Matrix& lower,
|
||||
Matrix& inverse_lower) {
|
||||
if (matrix.Rows() != matrix.Columns())
|
||||
|
||||
Reference in New Issue
Block a user