CMS 3D CMS Logo

ThreadsInfo.cc
Go to the documentation of this file.
1 //
2 // ThreadsInfo.cc
3 // CMSSW
4 //
5 // Created by Chris Jones on 7/24/20.
6 //
9 
10 namespace edm {
12  // default values
13  ThreadsInfo threadsInfo;
14 
15  // Note: it is important to not check the type or trackedness in
16  // exists() call to ensure that the getUntrackedParameter() calls
17  // will fail if the parameters have an incorrect type
18  if (pset.exists("options")) {
19  auto const& ops = pset.getUntrackedParameterSet("options");
20  if (ops.exists("numberOfThreads")) {
21  threadsInfo.nThreads_ = ops.getUntrackedParameter<unsigned int>("numberOfThreads");
22  }
23  if (ops.exists("sizeOfStackForThreadsInKB")) {
24  threadsInfo.stackSize_ = ops.getUntrackedParameter<unsigned int>("sizeOfStackForThreadsInKB");
25  }
26  }
27  return threadsInfo;
28  }
29 
30  void setThreadOptions(ThreadsInfo const& threadsInfo, edm::ParameterSet& pset) {
31  edm::ParameterSet newOp;
32  if (pset.exists("options")) {
33  newOp = pset.getUntrackedParameterSet("options");
34  }
35  newOp.addUntrackedParameter<unsigned int>("numberOfThreads", threadsInfo.nThreads_);
36  newOp.addUntrackedParameter<unsigned int>("sizeOfStackForThreadsInKB", threadsInfo.stackSize_);
37  pset.insertParameterSet(true, "options", edm::ParameterSetEntry(newOp, false));
38  }
39 } // namespace edm
void setThreadOptions(ThreadsInfo const &threadsInfo, edm::ParameterSet &pset)
Definition: ThreadsInfo.cc:30
unsigned int stackSize_
Definition: ThreadsInfo.h:14
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:193
ThreadsInfo threadOptions(edm::ParameterSet const &pset)
Definition: ThreadsInfo.cc:11
HLT enums.
unsigned int nThreads_
Definition: ThreadsInfo.h:13