perf(solvers): scope default one-equation calls to one thread

This commit is contained in:
KOKO\Mimi
2026-10-14 15:56:03 +09:00
parent 4c4d943941
commit 770fa2a0d1
7 changed files with 144 additions and 0 deletions
+15
View File
@@ -11,6 +11,21 @@
namespace fesa::dense_blas_internal {
/// @brief Limits only default-policy one-equation backend calls to one thread.
/// @note Existing caller TLS overrides are retained. Destruction restores the
/// default request; process-wide MKL/OpenMP settings are never changed.
class ScopedSingleEquationThreads {
public:
explicit ScopedSingleEquationThreads(std::size_t equation_count) noexcept;
ScopedSingleEquationThreads(const ScopedSingleEquationThreads&) = delete;
ScopedSingleEquationThreads& operator=(const ScopedSingleEquationThreads&) =
delete;
~ScopedSingleEquationThreads();
private:
bool restore_default_{false};
};
/// @brief Converts a dense storage length to the private MKL integer type.
/// @return The converted length or an uncategorized overflow failure.
Result<MKL_INT> ToMklSize(std::size_t size);