CMS 3D CMS Logo

validateTopLevelParameterSets.cc
Go to the documentation of this file.
2 
4 
8 
10 
11 #include <sstream>
12 #include <vector>
13 #include <string>
14 
15 namespace edm {
16 
17  // NOTE: The defaults given here are not actually used when running cmsRun
18  // Those come from hard coded values in the Python code in Config.py
19  // The defaults here are used when running the edmPluginHelp utility so
20  // it is important the defaults in both places are consistent.
21 
23  description.addUntracked<unsigned int>("numberOfThreads", s_defaultNumberOfThreads)
24  ->setComment("If zero, let TBB use its default which is normally the number of CPUs on the machine");
25  description.addUntracked<unsigned int>("numberOfStreams", 0)
26  ->setComment(
27  "If zero, then set the number of streams to be the same as the number of "
28  "Threads (except always 1 if there is a looper)");
29  description.addUntracked<unsigned int>("numberOfConcurrentLuminosityBlocks", 0)
30  ->setComment(
31  "If zero, use Framework default (currently 2 when the number of streams >= 2, otherwise 1). "
32  "In all cases, the number of concurrent luminosity blocks will be reset to "
33  "be the same as the number of streams if it is greater than the "
34  "numbers of streams.");
35  description.addUntracked<unsigned int>("numberOfConcurrentRuns", 1);
36 
37  edm::ParameterSetDescription eventSetupDescription;
38  eventSetupDescription.addUntracked<unsigned int>("numberOfConcurrentIOVs", 0)
39  ->setComment(
40  "If zero, use the Framework default which currently means the same as the "
41  "number of concurrent luminosity blocks. Can be overridden by a hard coded "
42  "static in a record C++ definition or by forceNumberOfConcurrentIOVs. "
43  "In all cases, the number of concurrent IOVs will be reset to be the "
44  "same as the number of concurrent luminosity blocks if greater than the "
45  "number of concurrent luminosity blocks.");
46  edm::ParameterSetDescription nestedDescription;
47  nestedDescription.addWildcardUntracked<unsigned int>("*")->setComment(
48  "Parameter names should be record names and the values are the number of concurrent IOVS for each record."
49  " Overrides all other methods of setting number of concurrent IOVs.");
50  eventSetupDescription.addUntracked<edm::ParameterSetDescription>("forceNumberOfConcurrentIOVs", nestedDescription);
51  description.addUntracked<edm::ParameterSetDescription>("eventSetup", eventSetupDescription);
52 
53  description.addUntracked<bool>("wantSummary", false)
54  ->setComment("Set true to print a report on the trigger decisions and timing of modules");
55  description.addUntracked<std::string>("fileMode", "FULLMERGE")
56  ->setComment("Legal values are 'NOMERGE' and 'FULLMERGE'");
57  description.addUntracked<bool>("forceEventSetupCacheClearOnNewRun", false);
58  description.addUntracked<bool>("throwIfIllegalParameter", true)
59  ->setComment("Set false to disable exception throws when configuration validation detects illegal parameters");
60  description.addUntracked<bool>("printDependencies", false)->setComment("Print data dependencies between modules");
61  description.addUntracked<bool>("deleteNonConsumedUnscheduledModules", true)
62  ->setComment(
63  "Delete modules that are unscheduled, i.e. only in Tasks, whose products are not consumed by any other "
64  "otherwise-running module");
65 
66  // No default for this one because the parameter value is
67  // actually used in the main function in cmsRun.cpp before
68  // the parameter set is validated here.
69  description.addOptionalUntracked<unsigned int>("sizeOfStackForThreadsInKB");
70 
71  std::vector<std::string> emptyVector;
72 
73  description.addUntracked<std::vector<std::string>>("Rethrow", emptyVector);
74  description.addUntracked<std::vector<std::string>>("SkipEvent", emptyVector);
75  description.addUntracked<std::vector<std::string>>("FailPath", emptyVector);
76  description.addUntracked<std::vector<std::string>>("IgnoreCompletely", emptyVector);
77 
78  description.addUntracked<std::vector<std::string>>("canDeleteEarly", emptyVector)
79  ->setComment("Branch names of products that the Framework can try to delete before the end of the Event");
80 
81  description.addUntracked<bool>("dumpOptions", false)
82  ->setComment(
83  "Print values of selected Framework parameters. The Framework might modify the values "
84  "in the options parameter set and this prints the values after that modification.");
85 
86  description.addOptionalUntracked<bool>("allowUnscheduled")
87  ->setComment(
88  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
89  description.addOptionalUntracked<std::string>("emptyRunLumiMode")
90  ->setComment(
91  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
92  description.addOptionalUntracked<bool>("makeTriggerResults")
93  ->setComment(
94  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
95  }
96 
98  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
99 
100  ParameterSetDescription nestedDescription;
101  nestedDescription.addWildcardUntracked<int>("*");
102  description.addOptionalNode(ParameterDescription<int>("output", false) xor
103  ParameterDescription<ParameterSetDescription>("output", nestedDescription, false),
104  false);
105  }
106 
108  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
109  }
110 
112  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
113  }
114 
115  void validateTopLevelParameterSets(ParameterSet* processParameterSet) {
116  std::string processName = processParameterSet->getParameter<std::string>("@process_name");
117 
118  std::vector<std::string> psetNames{"options", "maxEvents", "maxLuminosityBlocks", "maxSecondsUntilRampdown"};
119 
120  for (auto const& psetName : psetNames) {
121  bool isTracked{false};
122  ParameterSet* pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
123  if (pset == nullptr) {
124  ParameterSet emptyPset;
125  processParameterSet->addUntrackedParameter<ParameterSet>(psetName, emptyPset);
126  pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
127  }
128  if (isTracked) {
129  throw Exception(errors::Configuration) << "In the configuration the top level parameter set named \'"
130  << psetName << "\' in process \'" << processName << "\' is tracked.\n"
131  << "It must be untracked";
132  }
133 
135  if (psetName == "options") {
137  } else if (psetName == "maxEvents") {
139  } else if (psetName == "maxLuminosityBlocks") {
141  } else if (psetName == "maxSecondsUntilRampdown") {
143  }
144 
145  try {
146  description.validate(*pset);
147  } catch (cms::Exception& ex) {
148  std::ostringstream ost;
149  ost << "Validating top level \'" << psetName << "\' ParameterSet for process \'" << processName << "\'";
150  ex.addContext(ost.str());
151  throw;
152  }
153  }
154  }
155 
156  void dumpOptionsToLogFile(unsigned int nThreads,
157  unsigned int nStreams,
158  unsigned int nConcurrentLumis,
159  unsigned int nConcurrentRuns) {
160  LogAbsolute("Options") << "Number of Threads = " << nThreads << "\nNumber of Streams = " << nStreams
161  << "\nNumber of Concurrent Lumis = " << nConcurrentLumis
162  << "\nNumber of Concurrent Runs = " << nConcurrentRuns;
163  }
164 } // namespace edm
MessageLogger.h
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
edm::validateTopLevelParameterSets
void validateTopLevelParameterSets(ParameterSet *processParameterSet)
Definition: validateTopLevelParameterSets.cc:115
edm::fillMaxEventsDescription
void fillMaxEventsDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:97
edm::s_defaultNumberOfThreads
constexpr unsigned int s_defaultNumberOfThreads
Definition: ThreadsInfo.h:9
edm
HLT enums.
Definition: AlignableModifier.h:19
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::dumpOptionsToLogFile
void dumpOptionsToLogFile(unsigned int nThreads, unsigned int nStreams, unsigned int nConcurrentLumis, unsigned int nConcurrentRuns)
Definition: validateTopLevelParameterSets.cc:156
edm::ParameterDescription< ParameterSetDescription >
Definition: ParameterDescription.h:199
edm::ParameterSet::addUntrackedParameter
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:192
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:372
EDMException.h
edm::fillMaxSecondsUntilRampdownDescription
void fillMaxSecondsUntilRampdownDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:111
edm::fillMaxLuminosityBlocksDescription
void fillMaxLuminosityBlocksDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:107
edm::ParameterSetDescription::addWildcardUntracked
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
Definition: ParameterSetDescription.h:204
runTheMatrix.nThreads
nThreads
Definition: runTheMatrix.py:371
ParameterSetDescription.h
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
edm::LogAbsolute
Log< level::System, true > LogAbsolute
Definition: MessageLogger.h:134
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::fillOptionsDescription
void fillOptionsDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:22
validateTopLevelParameterSets.h
cms::Exception
Definition: Exception.h:70
ParameterSet.h
edm::ParameterSet::getPSetForUpdate
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
Definition: ParameterSet.cc:457
edm::ParameterDescription
Definition: ParameterDescription.h:110
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ThreadsInfo.h