RESPOND 2.5.1
Researching Effective Strategies to Prevent Opioid Death
Loading...
Searching...
No Matches
eigen_config.hpp
1
2// File: eigen_config.hpp //
3// Project: respond //
4// Created Date: 2026-09-24 //
5// Author: Matthew Carroll //
6// ----- //
7// Last Modified: 2026-09-24 //
8// Modified By: Matthew Carroll //
9// ----- //
10// Copyright (c) 2026 Syndemics Lab at Boston Medical Center //
12
13#ifndef RESPOND_EIGEN_CONFIG_HPP_
14#define RESPOND_EIGEN_CONFIG_HPP_
15
16#include <mutex>
17
18#include <Eigen/Core>
19
20namespace respond {
21namespace detail {
22
24inline std::mutex &GetEigenExecutionMutex() {
25 static std::mutex mutex;
26 return mutex;
27}
28
30inline void SetEigenThreads(unsigned int thread_count) {
31 std::lock_guard<std::mutex> lock(GetEigenExecutionMutex());
32 Eigen::setNbThreads(thread_count);
33}
34
35} // namespace detail
36} // namespace respond
37
38#endif // RESPOND_EIGEN_CONFIG_HPP_