CMS 3D CMS Logo

ThreadsController.h
Go to the documentation of this file.
1 #ifndef FWCore_Concurrency_ThreadsController_h
2 #define FWCore_Concurrency_ThreadsController_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Concurrency
6 // Class : ThreadsController
7 //
16 //
17 // Original Author: FWCore
18 // Created: Fri, 18 Nov 2016 20:30:42 GMT
19 //
20 
21 // system include files
22 #include "oneapi/tbb/global_control.h"
23 #include "oneapi/tbb/task_arena.h"
24 #include <memory>
25 
26 // user include files
27 
28 // forward declarations
29 
30 namespace edm {
32  public:
33  ThreadsController() = delete;
34  explicit ThreadsController(unsigned int iNThreads)
35  : m_nThreads{oneapi::tbb::global_control::max_allowed_parallelism, iNThreads}, m_stackSize{} {}
36  ThreadsController(unsigned int iNThreads, size_t iStackSize)
37  : m_nThreads{oneapi::tbb::global_control::max_allowed_parallelism, iNThreads},
38  m_stackSize{makeStackSize(iStackSize)} {}
39 
40  // ---------- member functions ---------------------------
41  void setStackSize(size_t iStackSize) { m_stackSize = makeStackSize(iStackSize); }
42 
43  private:
44  static std::unique_ptr<oneapi::tbb::global_control> makeStackSize(size_t iStackSize);
45 
46  // ---------- member data --------------------------------
47  oneapi::tbb::global_control m_nThreads;
48  std::unique_ptr<oneapi::tbb::global_control> m_stackSize;
49  };
50 } // namespace edm
51 
52 #endif
std::unique_ptr< oneapi::tbb::global_control > m_stackSize
ThreadsController(unsigned int iNThreads)
oneapi::tbb::global_control m_nThreads
void setStackSize(size_t iStackSize)
ThreadsController(unsigned int iNThreads, size_t iStackSize)
HLT enums.
static std::unique_ptr< oneapi::tbb::global_control > makeStackSize(size_t iStackSize)