59 using std::placeholders::_1;
61 bool binary_search_string(std::vector<std::string>
const&
v,
std::string const&
s) {
62 return std::binary_search(
v.begin(),
v.end(),
s);
68 std::shared_ptr<TriggerResultInserter> makeInserter(
70 PreallocationConfiguration
const& iPrealloc,
71 ProductRegistry& preg,
72 ExceptionToActionTable
const&
actions,
73 std::shared_ptr<ActivityRegistry> areg,
74 std::shared_ptr<ProcessConfiguration const> processConfiguration) {
75 ParameterSet* trig_pset = proc_pset.getPSetForUpdate(
"@trigger_paths");
76 trig_pset->registerIt();
78 WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration,
actions);
79 ModuleDescription md(trig_pset->id(),
80 "TriggerResultInserter",
82 processConfiguration.get(),
85 areg->preModuleConstructionSignal_(md);
86 bool postCalled =
false;
87 std::shared_ptr<TriggerResultInserter> returnValue;
90 maker::ModuleHolderT<TriggerResultInserter> holder(
91 make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
92 static_cast<Maker const*>(
nullptr));
93 holder.setModuleDescription(md);
94 holder.registerProductsAndCallbacks(&preg);
95 returnValue = holder.module();
98 areg->postModuleConstructionSignal_(md);
101 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
110 template <
typename T>
112 std::vector<std::string>
const& pathNames,
113 PreallocationConfiguration
const& iPrealloc,
114 ProductRegistry& preg,
115 std::shared_ptr<ActivityRegistry> areg,
116 std::shared_ptr<ProcessConfiguration const> processConfiguration,
123 pathStatusInserters.reserve(pathNames.size());
125 for (
auto const&
pathName : pathNames) {
126 ModuleDescription md(
129 areg->preModuleConstructionSignal_(md);
130 bool postCalled =
false;
133 maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
134 static_cast<Maker const*>(
nullptr));
135 holder.setModuleDescription(md);
136 holder.registerProductsAndCallbacks(&preg);
137 pathStatusInserters.emplace_back(holder.module());
140 areg->postModuleConstructionSignal_(md);
143 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
152 typedef std::vector<std::string>
vstring;
156 struct BranchesCases {
157 BranchesCases(std::vector<std::string> cases) : caseLabels{
std::move(cases)} {}
158 std::vector<BranchKey> chosenBranches;
159 std::vector<std::string> caseLabels;
161 std::map<std::string, BranchesCases> switchMap;
162 for (
auto&
prod : preg.productListUpdator()) {
163 if (
prod.second.isSwitchAlias()) {
164 auto it = switchMap.find(
prod.second.moduleLabel());
165 if (
it == switchMap.end()) {
167 auto inserted = switchMap.emplace(
prod.second.moduleLabel(),
168 switchPSet.getParameter<std::vector<std::string>>(
"@all_cases"));
174 for (
auto const& productIter : preg.productList()) {
175 BranchKey
const& branchKey = productIter.first;
184 BranchDescription
const&
desc = productIter.second;
185 if (
desc.branchType() ==
prod.second.branchType() and
186 desc.unwrappedTypeID().typeInfo() ==
prod.second.unwrappedTypeID().typeInfo() and
187 branchKey.moduleLabel() ==
prod.second.switchAliasModuleLabel() and
188 branchKey.productInstanceName() ==
prod.second.productInstanceName()) {
189 prod.second.setSwitchAliasForBranch(
desc);
190 if (!
prod.second.transient()) {
191 it->second.chosenBranches.push_back(
prod.first);
198 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n" 199 <<
" friendly class name = " <<
prod.second.friendlyClassName() <<
"\n" 200 <<
" module label = " <<
prod.second.moduleLabel() <<
"\n" 201 <<
" product instance name = " <<
prod.second.productInstanceName() <<
"\n" 203 <<
"\n\nbut did not find any. Please contact a framework developer.";
204 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
209 if (switchMap.empty())
212 for (
auto& elem : switchMap) {
213 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
217 std::map<std::string, std::vector<BranchKey>> caseBranches;
218 for (
auto const&
item : preg.productList()) {
222 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
223 found != caseLabels.end()) {
224 caseBranches[*
found].push_back(
item.first);
228 for (
auto const& caseLabel : caseLabels) {
229 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
230 auto& branches = caseBranches[caseLabel];
231 std::sort(branches.begin(), branches.end());
232 for (
auto const&
branch : branches) {
233 ex <<
" " <<
branch.friendlyClassName() <<
" " <<
branch.productInstanceName() <<
"\n";
240 std::vector<bool> foundBranches;
241 for (
auto const& switchItem : switchMap) {
242 auto const& switchLabel = switchItem.first;
243 auto const& chosenBranches = switchItem.second.chosenBranches;
244 auto const& caseLabels = switchItem.second.caseLabels;
245 foundBranches.resize(chosenBranches.size());
246 for (
auto const& caseLabel : caseLabels) {
247 std::fill(foundBranches.begin(), foundBranches.end(),
false);
248 for (
auto& nonConstItem : preg.productListUpdator()) {
249 auto const&
item = nonConstItem;
253 if (!
item.second.transient()) {
254 auto range = std::equal_range(chosenBranches.begin(),
255 chosenBranches.end(),
256 BranchKey(
item.first.friendlyClassName(),
258 item.first.productInstanceName(),
259 item.first.processName()));
262 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product " 263 <<
item.first <<
" that is not produced by the chosen case " 265 .getUntrackedParameter<std::string>(
"@chosen_case")
266 <<
" and that product is not transient. " 267 <<
"If the intention is to produce only a subset of the non-transient products listed below, each " 268 "case with more non-transient products needs to be replaced with an EDAlias to only the " 269 "necessary products, and the EDProducer itself needs to be moved to a Task.\n\n";
270 addProductsToException(caseLabels, ex);
285 nonConstItem.second.setTransient(
true);
288 auto const& bd =
item.second;
289 if (not bd.branchAliases().empty()) {
291 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch " 292 "aliases for SwitchProducer with label " 293 << switchLabel <<
" for case " << caseLabel <<
":";
294 for (
auto const& branchAlias : bd.branchAliases()) {
295 ex <<
" " << branchAlias;
302 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
303 if (not foundBranches[
i]) {
305 .getUntrackedParameter<std::string>(
"@chosen_case");
307 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
308 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case " 309 << chosenLabel <<
" and that product is not transient. " 310 <<
"If the intention is to produce only a subset of the non-transient products listed below, each " 311 "case with more non-transient products needs to be replaced with an EDAlias to only the " 312 "necessary products, and the EDProducer itself needs to be moved to a Task.\n\n";
313 addProductsToException(caseLabels, ex);
322 vstring const& end_path_name_list,
324 std::set<std::string>
const& usedModuleLabels,
339 std::string const moduleEdmType(
"@module_edm_type");
345 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
349 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
350 std::set<std::string> modulesOnPaths;
352 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
353 for (
auto const& endPath : end_path_name_list) {
354 noEndPaths.erase(endPath);
358 for (
auto const&
path : noEndPaths) {
366 std::vector<std::string> labelsToBeDropped;
367 labelsToBeDropped.reserve(modulesInConfigSet.size());
369 modulesInConfigSet.end(),
370 usedModuleLabels.begin(),
371 usedModuleLabels.end(),
372 std::back_inserter(labelsToBeDropped));
374 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
375 for (
auto const& modLabel : usedModuleLabels) {
379 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
380 if (edmType == outputModule) {
381 outputModuleLabels.push_back(modLabel);
382 labelsToBeDropped.push_back(modLabel);
384 if (edmType == edAnalyzer) {
385 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
386 labelsToBeDropped.push_back(modLabel);
393 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
399 vstring::iterator endAfterRemove =
400 std::remove_if(modulesInConfig.begin(),
401 modulesInConfig.end(),
402 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
403 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
409 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
410 iEndPath != endEndPath;
413 vstring::iterator iSave =
labels.begin();
414 vstring::iterator iBegin =
labels.begin();
416 for (vstring::iterator iLabel =
labels.begin(), iEnd =
labels.end(); iLabel != iEnd; ++iLabel) {
417 if (binary_search_string(labelsToBeDropped, *iLabel)) {
418 if (binary_search_string(outputModuleLabels, *iLabel)) {
419 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
422 if (iSave != iLabel) {
423 iSave->swap(*iLabel);
431 proc_pset.eraseSimpleParameter(*iEndPath);
432 endPathsToBeDropped.push_back(*iEndPath);
440 endAfterRemove = std::remove_if(scheduledPaths.begin(),
441 scheduledPaths.end(),
442 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
443 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
447 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
448 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
449 scheduledEndPaths.end(),
450 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
451 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
455 class RngEDConsumer :
public EDConsumerBase {
457 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
459 if (rng.isAvailable()) {
460 rng->consumes(consumesCollector());
461 for (
auto const& consumesInfo : this->consumesInfo()) {
462 typesConsumed.emplace(consumesInfo.type());
468 template <
typename F>
469 auto doCleanup(
F&& iF) {
474 iTask.doneWaiting(*iPtr);
490 std::shared_ptr<ActivityRegistry> areg,
491 std::shared_ptr<ProcessConfiguration const> processConfiguration,
497 ? std::shared_ptr<TriggerResultInserter>{}
498 : makeInserter(proc_pset, prealloc, preg,
actions, areg, processConfiguration)},
499 moduleRegistry_(std::make_shared<ModuleRegistry>(resolverMaker)),
500 all_output_communicators_(),
501 preallocConfig_(prealloc),
502 pathNames_(&tns.getTrigPaths()),
503 endPathNames_(&tns.getEndPaths()),
504 wantSummary_(tns.wantSummary()) {
505 makePathStatusInserters(pathStatusInserters_,
510 processConfiguration,
513 if (endPathNames_->size() > 1) {
515 makePathStatusInserters(endPathStatusInserters_,
520 processConfiguration,
524 assert(0 < prealloc.numberOfStreams());
525 streamSchedules_.reserve(prealloc.numberOfStreams());
526 for (
unsigned int i = 0;
i < prealloc.numberOfStreams(); ++
i) {
527 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
528 pathStatusInserters_,
529 endPathStatusInserters_,
537 processConfiguration,
544 const std::string kTriggerResults(
"TriggerResults");
545 std::vector<std::string> modulesToUse;
546 modulesToUse.reserve(streamSchedules_[0]->allWorkersLumisAndEvents().
size());
547 for (
auto const& worker : streamSchedules_[0]->allWorkersLumisAndEvents()) {
548 if (worker->description()->moduleLabel() != kTriggerResults) {
549 modulesToUse.push_back(worker->description()->moduleLabel());
553 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
554 if (nUnscheduledModules > 0) {
555 std::vector<std::string>
temp;
556 temp.reserve(modulesToUse.size());
557 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
558 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(
temp));
559 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(
temp));
560 temp.swap(modulesToUse);
564 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
565 pathStatusInserters_,
566 endPathStatusInserters_,
574 processConfiguration,
585 std::shared_ptr<ActivityRegistry> areg,
586 std::shared_ptr<ProcessConfiguration> processConfiguration,
587 bool hasSubprocesses,
592 const std::string kTriggerResults(
"TriggerResults");
594 std::set<std::string> usedModuleLabels;
596 if (worker->description()->moduleLabel() != kTriggerResults) {
597 usedModuleLabels.insert(worker->description()->moduleLabel());
600 std::vector<std::string> modulesInConfig(proc_pset.
getParameter<std::vector<std::string>>(
"@all_modules"));
601 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
602 reduceParameterSet(proc_pset, tns.
getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
604 std::vector<std::string> aliases = proc_pset.
getParameter<std::vector<std::string>>(
"@all_aliases");
611 auto const& unsched =
streamSchedules_[0]->unscheduledWorkersLumisAndEvents();
612 if (not unsched.empty()) {
613 std::set<std::string> unscheduledModules;
616 std::insert_iterator<std::set<std::string>>(unscheduledModules, unscheduledModules.begin()),
617 [](
auto worker) {
return worker->description()->moduleLabel(); });
622 processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
624 processConfiguration->setParameterSetID(proc_pset.
id());
625 processConfiguration->setProcessConfigurationID();
629 size_t all_workers_count =
allWorkers().size();
646 for (
auto const& worker :
streamSchedules_[0]->allWorkersLumisAndEvents()) {
647 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
655 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
664 std::set<TypeID> productTypesConsumed;
665 std::set<TypeID> elementTypesConsumed;
668 for (
auto const& consumesInfo : worker->consumesInfo()) {
670 productTypesConsumed.emplace(consumesInfo.type());
672 elementTypesConsumed.emplace(consumesInfo.type());
677 if (hasSubprocesses) {
681 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
682 preg.
setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
690 std::vector<const ModuleDescription*> modDesc;
692 modDesc.reserve(
workers.size());
696 std::back_inserter(modDesc),
733 int maxEventSpecs = 0;
734 int maxEventsOut = -1;
741 std::vector<std::string> psetNamesE;
748 if (maxEventSpecs > 1) {
750 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
755 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
761 <<
"\nNo entry in 'maxEvents' for output module label '" <<
moduleLabel <<
"'.\n";
773 if (!
c->limitReached()) {
778 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n" 779 <<
"has reached its configured limit.\n";
801 auto logForEach = [](
auto const& iContainer,
auto iMessage) {
804 for (
auto const& element : iContainer) {
805 iMessage(
logger, element);
827 <<
"---------- Event Summary ------------";
841 <<
"---------- Path Summary ------------";
842 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 843 <<
" " << std::right << std::setw(10) <<
"Executed" 844 <<
" " << std::right << std::setw(10) <<
"Passed" 845 <<
" " << std::right << std::setw(10) <<
"Failed" 846 <<
" " << std::right << std::setw(10) <<
"Error" 851 logger <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5) << p.bitPosition <<
" " 852 << std::right << std::setw(10) << p.timesRun <<
" " << std::right << std::setw(10) << p.timesPassed
853 <<
" " << std::right << std::setw(10) << p.timesFailed <<
" " << std::right << std::setw(10)
854 << p.timesExcept <<
" " << p.name;
876 <<
"-------End-Path Summary ------------\n" 877 <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 878 <<
" " << std::right << std::setw(10) <<
"Executed" 879 <<
" " << std::right << std::setw(10) <<
"Passed" 880 <<
" " << std::right << std::setw(10) <<
"Failed" 881 <<
" " << std::right << std::setw(10) <<
"Error" 885 logger <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5) << p.bitPosition <<
" " 886 << std::right << std::setw(10) << p.timesRun <<
" " << std::right << std::setw(10) << p.timesPassed
887 <<
" " << std::right << std::setw(10) << p.timesFailed <<
" " << std::right << std::setw(10)
888 << p.timesExcept <<
" " << p.name;
894 <<
"---------- Modules in Path: " <<
p.name <<
" ------------\n" 895 <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 896 <<
" " << std::right << std::setw(10) <<
"Visited" 897 <<
" " << std::right << std::setw(10) <<
"Passed" 898 <<
" " << std::right << std::setw(10) <<
"Failed" 899 <<
" " << std::right << std::setw(10) <<
"Error" 903 logForEach(
p.moduleInPathSummaries, [](
auto&
logger,
auto const&
mod) {
904 logger <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5) << mod.bitPosition
905 <<
" " << std::right << std::setw(10) << mod.timesVisited <<
" " << std::right << std::setw(10)
906 << mod.timesPassed <<
" " << std::right << std::setw(10) << mod.timesFailed <<
" " << std::right
907 << std::setw(10) << mod.timesExcept <<
" " << mod.moduleLabel;
914 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------\n" 915 <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 916 <<
" " << std::right << std::setw(10) <<
"Visited" 917 <<
" " << std::right << std::setw(10) <<
"Passed" 918 <<
" " << std::right << std::setw(10) <<
"Failed" 919 <<
" " << std::right << std::setw(10) <<
"Error" 923 unsigned int bitpos = 0;
924 logForEach(
p.moduleInPathSummaries, [&bitpos](
auto&
logger,
auto const&
mod) {
925 logger <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5) << bitpos <<
" " 926 << std::right << std::setw(10) << mod.timesVisited <<
" " << std::right << std::setw(10)
927 << mod.timesPassed <<
" " << std::right << std::setw(10) << mod.timesFailed <<
" " << std::right
928 << std::setw(10) << mod.timesExcept <<
" " << mod.moduleLabel;
935 <<
"---------- Module Summary ------------\n" 936 <<
"TrigReport " << std::right << std::setw(10) <<
"Visited" 937 <<
" " << std::right << std::setw(10) <<
"Executed" 938 <<
" " << std::right << std::setw(10) <<
"Passed" 939 <<
" " << std::right << std::setw(10) <<
"Failed" 940 <<
" " << std::right << std::setw(10) <<
"Error" 945 logger <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" " << std::right
946 << std::setw(10) << worker.timesRun <<
" " << std::right << std::setw(10) << worker.timesPassed <<
" " 947 << std::right << std::setw(10) << worker.timesFailed <<
" " << std::right << std::setw(10)
948 << worker.timesExcept <<
" " << worker.moduleLabel;
959 <<
"---------- Event Summary ---[sec]----";
967 <<
" efficiency CPU/Real/thread = " 976 <<
"---------- Path Summary ---[Real sec]----";
977 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 978 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 981 const int timesRun = std::max(1, p.timesRun);
982 logger <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right << std::setw(kColumn1Size)
983 << p.realTime / totalEvents <<
" " << std::right << std::setw(kColumn2Size) << p.realTime / timesRun
986 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 987 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 992 <<
"-------End-Path Summary ---[Real sec]----\n" 993 <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 994 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 997 const int timesRun = std::max(1, p.timesRun);
999 logger <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right << std::setw(kColumn1Size)
1000 << p.realTime / totalEvents <<
" " << std::right << std::setw(kColumn2Size) << p.realTime / timesRun
1003 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1004 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1010 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----\n" 1011 <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1012 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1014 logForEach(
p.moduleInPathSummaries, [&](
auto&
logger,
auto const&
mod) {
1015 logger <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right << std::setw(kColumn1Size)
1016 << mod.realTime / totalEvents <<
" " << std::right << std::setw(kColumn2Size)
1017 << mod.realTime / std::max(1, mod.timesVisited) <<
" " << mod.moduleLabel;
1021 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1022 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1028 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----\n" 1029 <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1030 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1032 logForEach(
p.moduleInPathSummaries, [&](
auto&
logger,
auto const&
mod) {
1033 logger <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right << std::setw(kColumn1Size)
1034 << mod.realTime / totalEvents <<
" " << std::right << std::setw(kColumn2Size)
1035 << mod.realTime / std::max(1, mod.timesVisited) <<
" " << mod.moduleLabel;
1039 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1040 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1045 <<
"---------- Module Summary ---[Real sec]----\n" 1046 <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1047 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1048 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1051 logger <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right << std::setw(kColumn1Size)
1052 << worker.realTime / totalEvents <<
" " << std::right << std::setw(kColumn2Size)
1053 << worker.realTime / std::max(1, worker.timesRun) <<
" " << std::right << std::setw(kColumn3Size)
1054 << worker.realTime / std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel;
1056 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1057 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1058 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1065 using std::placeholders::_1;
1068 worker->respondToCloseOutputFile();
1073 using std::placeholders::_1;
1099 c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1129 c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1158 c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1170 using std::placeholders::_1;
1179 using std::placeholders::_1;
1184 using std::placeholders::_1;
1193 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase, pathsAndConsumesOfModules, processContext);
1207 unsigned int iStreamID,
1220 if (worker->description()->moduleLabel() == iLabel) {
1225 if (
nullptr ==
found) {
1234 s->replaceModule(newMod, iLabel);
1247 found->updateLookup(iIndices);
1249 auto const&
processName = newMod->moduleDescription().processName();
1250 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(
processName);
1251 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(
processName);
1252 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(
processName);
1253 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(
processName);
1254 found->resolvePutIndicies(
InProcess, processBlockModuleToIndicies);
1255 found->resolvePutIndicies(
InRun, runModuleToIndicies);
1256 found->resolvePutIndicies(
InLumi, lumiModuleToIndicies);
1257 found->resolvePutIndicies(
InEvent, eventModuleToIndicies);
1266 stream->deleteModule(iLabel);
1272 std::multimap<std::string, std::string>
const& referencesToBranches,
1273 std::vector<std::string>
const& modulesToSkip,
1276 stream->initializeEarlyDelete(
1277 *
moduleRegistry(), branchesToDeleteEarly, referencesToBranches, modulesToSkip, preg);
1282 std::vector<ModuleDescription const*>
result;
1313 std::vector<ModuleDescription const*>& descriptions,
1314 unsigned int hint)
const {
1315 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1319 std::vector<ModuleDescription const*>& descriptions,
1320 unsigned int hint)
const {
1321 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1325 std::vector<ModuleDescription const*>& allModuleDescriptions,
1326 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1328 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1330 allModuleDescriptions.clear();
1331 moduleIDToIndex.clear();
1332 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1333 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1335 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1337 allModuleDescriptions.reserve(
allWorkers().size());
1338 moduleIDToIndex.reserve(
allWorkers().size());
1339 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1340 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().size());
1342 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().size());
1344 std::map<std::string, ModuleDescription const*> labelToDesc;
1348 allModuleDescriptions.push_back(
p);
1349 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(
p->id(),
i));
1350 labelToDesc[
p->moduleLabel()] =
p;
1358 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1359 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(
i);
1362 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1363 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(
i);
1365 worker->modulesWhoseProductsAreConsumed(
modules, modulesInPreviousProcesses, preg, labelToDesc);
1367 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1368 worker->description()->moduleLabel());
1376 rep.eventSummary.totalEvents = 0;
1377 rep.eventSummary.totalEventsPassed = 0;
1378 rep.eventSummary.totalEventsFailed = 0;
1380 s->getTriggerReport(
rep);
1386 rep.eventSummary.totalEvents = 0;
1387 rep.eventSummary.cpuTime = 0.;
1388 rep.eventSummary.realTime = 0.;
1393 int returnValue = 0;
1395 returnValue +=
s->totalEvents();
1401 int returnValue = 0;
1403 returnValue +=
s->totalEventsPassed();
1409 int returnValue = 0;
1411 returnValue +=
s->totalEventsFailed();
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
LuminosityBlockID id() const
std::vector< PathSummary > endPathSummaries
std::vector< PathTimingSummary > endPathSummaries
void addException(cms::Exception const &exception)
PostModuleDestruction postModuleDestructionSignal_
T getParameter(std::string const &) const
bool terminate() const
Return whether each output module has reached its maximum count.
Timestamp const & endTime() const
void stopEvent(StreamContext const &)
void startProcessingLoop()
std::vector< BranchIDList > BranchIDLists
virtual void openFile(FileBlock const &fb)=0
void getTriggerTimingReport(TriggerTimingReport &rep) const
roAction_t actions[nactions]
void writeProcessBlockAsync(WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *)
static Timestamp invalidTimestamp()
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
void respondToCloseInputFile(FileBlock const &fb)
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::vector< Worker * > AllWorkers
RunPrincipal const & runPrincipal() const
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const *> &descriptions, unsigned int hint) const
void removeModuleIfExists(ModuleDescription const &module)
std::vector< std::string > const * pathNames_
void getTriggerReport(TriggerReport &rep) const
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name...
BranchIDLists const & branchIDLists() const
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
PostGlobalEndLumi postGlobalWriteLumiSignal_
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< WorkerSummary > workerSummaries
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
PreModuleDestruction preModuleDestructionSignal_
constexpr auto then(O &&iO)
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventTransitionInfo &, ServiceToken const &token)
void stopProcessingLoop()
void startEvent(StreamID)
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription's constructor's modI...
void updateFromRegistry(ProductRegistry const ®)
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
void eraseOrSetUntrackedParameterSet(std::string const &name)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
bool anyProductProduced() const
T getUntrackedParameter(std::string const &, T const &) const
static RunIndex invalidRunIndex()
unsigned int numberOfThreads() const
void processEDAliases(std::vector< std::string > const &aliasNamesToProcess, std::unordered_set< std::string > const &aliasModulesToProcess, ParameterSet const &proc_pset, std::string const &processName, ProductRegistry &preg)
void deleteModule(std::string const &iLabel, ActivityRegistry *areg)
Deletes module with label iLabel.
ParameterSetID id() const
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
void updateForNewProcess(ProductRegistry const &, std::string const &processName)
ParameterSet const & registerIt()
std::vector< PathSummary > trigPathSummaries
EventSummary eventSummary
auto runLast(edm::WaitingTaskHolder iTask)
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProductResolverIndices const &)
void fillModuleAndConsumesInfo(std::vector< ModuleDescription const *> &allModuleDescriptions, std::vector< std::pair< unsigned int, unsigned int >> &moduleIDToIndex, std::array< std::vector< std::vector< ModuleDescription const *>>, NumBranchTypes > &modulesWhoseProductsAreConsumedBy, std::vector< std::vector< ModuleProcessName >> &modulesInPreviousProcessesWhoseProductsAreConsumedBy, ProductRegistry const &preg) const
EventTimingSummary eventSummary
Strings const & getTrigPaths() const
Schedule(ParameterSet &proc_pset, service::TriggerNamesService const &tns, ProductRegistry &pregistry, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration const > processConfiguration, PreallocationConfiguration const &config, ProcessContext const *processContext, ModuleTypeResolverMaker const *resolverMaker)
void setUnscheduledProducts(std::set< std::string > const &unscheduledLabels)
void clearCounters()
Clear all the counters in the trigger report.
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
PostGlobalWriteRun postGlobalWriteRunSignal_
unsigned int numberOfStreams() const
static ServiceRegistry & instance()
std::vector< PathTimingSummary > trigPathSummaries
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
void setFrozen(bool initializeLookupInfo=true)
void respondToOpenInputFile(FileBlock const &fb)
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Timestamp const & beginTime() const
void beginStream(unsigned int streamID)
void writeRunAsync(WaitingTaskHolder iTask, RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *)
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
int totalEventsPassed() const
std::shared_ptr< ModuleRegistry const > moduleRegistry() const
static LuminosityBlockIndex invalidLuminosityBlockIndex()
PreGlobalWriteRun preGlobalWriteRunSignal_
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
virtual bool shouldWeCloseFile() const =0
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Log< level::Info, false > LogInfo
PreallocationConfiguration preallocConfig_
Log< level::FwkInfo, true > LogFwkVerbatim
PreWriteProcessBlock preWriteProcessBlockSignal_
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Strings const & getEndPaths() const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
void endStream(unsigned int streamID, ExceptionCollector &collector, std::mutex &collectorMutex) noexcept
void respondToOpenInputFile(FileBlock const &fb)
void startPath(StreamContext const &, PathContext const &)
bool search_all(ForwardSequence const &s, Datum const &d)
PostWriteProcessBlock postWriteProcessBlockSignal_
bool shouldWeCloseOutput() const
ProductList & productListUpdator()
void addContext(std::string const &context)
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const *> &descriptions, unsigned int hint) const
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
AllOutputModuleCommunicators all_output_communicators_
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
PreGlobalEndLumi preGlobalWriteLumiSignal_
void respondToCloseInputFile(FileBlock const &fb)
std::vector< std::string > const * endPathNames_
void modulesInPath(std::string const &iPathLabel, std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill in execution order the labels of all modules in path iPathLabel ...
LuminosityBlockIndex index() const
void finishSetup(ParameterSet &proc_pset, service::TriggerNamesService const &tns, ProductRegistry &preg, BranchIDListHelper &branchIDListHelper, ProcessBlockHelperBase &processBlockHelper, ThinnedAssociationsHelper &thinnedAssociationsHelper, SubProcessParentageHelper const *subProcessParentageHelper, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, bool hasSubprocesses, PreallocationConfiguration const &prealloc, ProcessContext const *processContext)
void sendFwkSummaryToMessageLogger() const
virtual void closeFile()=0
auto wrap(F iFunc) -> decltype(iFunc())
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void openOutputFiles(FileBlock &fb)
void writeLumiAsync(WaitingTaskHolder iTask, LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *)
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
void initializeEarlyDelete(std::vector< std::string > const &branchesToDeleteEarly, std::multimap< std::string, std::string > const &referencesToBranches, std::vector< std::string > const &modulesToSkip, edm::ProductRegistry const &preg)
void endJob(ExceptionCollector &collector)
std::vector< std::string > vstring
ServiceToken presentToken() const
void setIsMergeable(BranchDescription &)
int totalEventsFailed() const
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProductResolverIndices const &, ProcessBlockHelperBase const &, PathsAndConsumesOfModulesBase const &, ProcessContext const &)
void triggerPaths(std::vector< std::string > &oLabelsToFill) const