CMS 3D CMS Logo

setNThreads.cc
Go to the documentation of this file.
1 //
2 // setNThreads.cc
3 // CMSSW
4 //
5 // Created by Chris Jones on 7/24/20.
6 //
7 #include "oneapi/tbb/task_arena.h"
9 
10 namespace edm {
11  unsigned int setNThreads(unsigned int iNThreads, unsigned int iStackSize, std::unique_ptr<ThreadsController>& oPtr) {
12  //stack size is given in KB but passed in as bytes
13  iStackSize *= 1024;
14 
15  oPtr.reset();
16  if (0 == iNThreads) {
17  //Allow TBB to decide how many threads. This is normally the number of CPUs in the machine.
18  iNThreads = oneapi::tbb::this_task_arena::max_concurrency();
19  }
20  oPtr = std::make_unique<ThreadsController>(static_cast<int>(iNThreads), iStackSize);
21 
22  return iNThreads;
23  }
24 } // namespace edm
unsigned int setNThreads(unsigned int iNThreads, unsigned int iStackSize, std::unique_ptr< ThreadsController > &oPtr)
Definition: setNThreads.cc:11
HLT enums.