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 it->second.chosenBranches.push_back(
prod.first);
196 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n" 197 <<
" friendly class name = " <<
prod.second.friendlyClassName() <<
"\n" 198 <<
" module label = " <<
prod.second.moduleLabel() <<
"\n" 199 <<
" product instance name = " <<
prod.second.productInstanceName() <<
"\n" 201 <<
"\n\nbut did not find any. Please contact a framework developer.";
202 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
207 if (switchMap.empty())
210 for (
auto& elem : switchMap) {
211 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
215 std::map<std::string, std::vector<BranchKey>> caseBranches;
216 for (
auto const&
item : preg.productList()) {
220 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
221 found != caseLabels.end()) {
222 caseBranches[*
found].push_back(
item.first);
226 for (
auto const& caseLabel : caseLabels) {
227 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
228 auto& branches = caseBranches[caseLabel];
229 std::sort(branches.begin(), branches.end());
230 for (
auto const&
branch : branches) {
231 ex <<
" " <<
branch.friendlyClassName() <<
" " <<
branch.productInstanceName() <<
"\n";
238 std::vector<bool> foundBranches;
239 for (
auto const& switchItem : switchMap) {
240 auto const& switchLabel = switchItem.first;
241 auto const& chosenBranches = switchItem.second.chosenBranches;
242 auto const& caseLabels = switchItem.second.caseLabels;
243 foundBranches.resize(chosenBranches.size());
244 for (
auto const& caseLabel : caseLabels) {
245 std::fill(foundBranches.begin(), foundBranches.end(),
false);
246 for (
auto& nonConstItem : preg.productListUpdator()) {
247 auto const&
item = nonConstItem;
257 nonConstItem.second.setTransient(
true);
259 auto range = std::equal_range(chosenBranches.begin(),
260 chosenBranches.end(),
261 BranchKey(
item.first.friendlyClassName(),
263 item.first.productInstanceName(),
264 item.first.processName()));
267 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product " 268 <<
item.first <<
" that is not produced by the chosen case " 270 .getUntrackedParameter<std::string>(
"@chosen_case")
271 <<
". If the intention is to produce only a subset of the products listed below, each case with " 272 "more products needs to be replaced with an EDAlias to only the necessary products, and the " 273 "EDProducer itself needs to be moved to a Task.\n\n";
274 addProductsToException(caseLabels, ex);
281 auto const&
bd =
item.second;
282 if (not
bd.branchAliases().empty()) {
284 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch " 285 "aliases for SwitchProducer with label " 286 << switchLabel <<
" for case " << caseLabel <<
":";
287 for (
auto const& branchAlias :
bd.branchAliases()) {
288 ex <<
" " << branchAlias;
295 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
296 if (not foundBranches[
i]) {
298 .getUntrackedParameter<std::string>(
"@chosen_case");
300 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
301 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case " 303 <<
". If the intention is to produce only a subset of the products listed below, each case with more " 304 "products needs to be replaced with an EDAlias to only the necessary products, and the " 305 "EDProducer itself needs to be moved to a Task.\n\n";
306 addProductsToException(caseLabels, ex);
315 vstring const& end_path_name_list,
317 std::set<std::string>
const& usedModuleLabels,
332 std::string const moduleEdmType(
"@module_edm_type");
338 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
342 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
343 std::set<std::string> modulesOnPaths;
345 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
346 for (
auto const& endPath : end_path_name_list) {
347 noEndPaths.erase(endPath);
351 for (
auto const&
path : noEndPaths) {
359 std::vector<std::string> labelsToBeDropped;
360 labelsToBeDropped.reserve(modulesInConfigSet.size());
362 modulesInConfigSet.end(),
363 usedModuleLabels.begin(),
364 usedModuleLabels.end(),
365 std::back_inserter(labelsToBeDropped));
367 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
368 for (
auto const& modLabel : usedModuleLabels) {
372 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
373 if (edmType == outputModule) {
374 outputModuleLabels.push_back(modLabel);
375 labelsToBeDropped.push_back(modLabel);
377 if (edmType == edAnalyzer) {
378 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
379 labelsToBeDropped.push_back(modLabel);
386 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
392 vstring::iterator endAfterRemove =
393 std::remove_if(modulesInConfig.begin(),
394 modulesInConfig.end(),
395 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
396 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
402 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
403 iEndPath != endEndPath;
406 vstring::iterator iSave =
labels.begin();
407 vstring::iterator iBegin =
labels.begin();
409 for (vstring::iterator iLabel =
labels.begin(), iEnd =
labels.end(); iLabel != iEnd; ++iLabel) {
410 if (binary_search_string(labelsToBeDropped, *iLabel)) {
411 if (binary_search_string(outputModuleLabels, *iLabel)) {
412 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
415 if (iSave != iLabel) {
416 iSave->swap(*iLabel);
424 proc_pset.eraseSimpleParameter(*iEndPath);
425 endPathsToBeDropped.push_back(*iEndPath);
433 endAfterRemove = std::remove_if(scheduledPaths.begin(),
434 scheduledPaths.end(),
435 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
436 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
440 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
441 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
442 scheduledEndPaths.end(),
443 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
444 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
448 class RngEDConsumer :
public EDConsumerBase {
450 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
452 if (rng.isAvailable()) {
453 rng->consumes(consumesCollector());
454 for (
auto const& consumesInfo : this->consumesInfo()) {
455 typesConsumed.emplace(consumesInfo.type());
461 template <
typename F>
462 auto doCleanup(
F&& iF) {
467 iTask.doneWaiting(*iPtr);
483 std::shared_ptr<ActivityRegistry> areg,
484 std::shared_ptr<ProcessConfiguration const> processConfiguration,
489 ? std::shared_ptr<TriggerResultInserter>{}
490 : makeInserter(proc_pset, prealloc, preg,
actions, areg, processConfiguration)},
492 all_output_communicators_(),
493 preallocConfig_(prealloc),
494 pathNames_(&tns.getTrigPaths()),
495 endPathNames_(&tns.getEndPaths()),
496 wantSummary_(tns.wantSummary()) {
497 makePathStatusInserters(pathStatusInserters_,
502 processConfiguration,
505 makePathStatusInserters(endPathStatusInserters_,
510 processConfiguration,
513 assert(0 < prealloc.numberOfStreams());
514 streamSchedules_.reserve(prealloc.numberOfStreams());
515 for (
unsigned int i = 0;
i < prealloc.numberOfStreams(); ++
i) {
516 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
517 pathStatusInserters_,
518 endPathStatusInserters_,
526 processConfiguration,
533 const std::string kTriggerResults(
"TriggerResults");
534 std::vector<std::string> modulesToUse;
535 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
536 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
537 if (worker->description()->moduleLabel() != kTriggerResults) {
538 modulesToUse.push_back(worker->description()->moduleLabel());
542 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
543 if (nUnscheduledModules > 0) {
544 std::vector<std::string>
temp;
545 temp.reserve(modulesToUse.size());
546 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
547 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(
temp));
548 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(
temp));
549 temp.swap(modulesToUse);
553 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
554 pathStatusInserters_,
555 endPathStatusInserters_,
563 processConfiguration,
574 std::shared_ptr<ActivityRegistry> areg,
575 std::shared_ptr<ProcessConfiguration> processConfiguration,
576 bool hasSubprocesses,
581 const std::string kTriggerResults(
"TriggerResults");
583 std::set<std::string> usedModuleLabels;
585 if (worker->description()->moduleLabel() != kTriggerResults) {
586 usedModuleLabels.insert(worker->description()->moduleLabel());
589 std::vector<std::string> modulesInConfig(proc_pset.
getParameter<std::vector<std::string>>(
"@all_modules"));
590 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
591 reduceParameterSet(proc_pset, tns.
getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
593 std::vector<std::string> aliases = proc_pset.
getParameter<std::vector<std::string>>(
"@all_aliases");
601 if (not unsched.empty()) {
602 std::set<std::string> unscheduledModules;
605 std::insert_iterator<std::set<std::string>>(unscheduledModules, unscheduledModules.begin()),
606 [](
auto worker) {
return worker->description()->moduleLabel(); });
611 processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
613 processConfiguration->setParameterSetID(proc_pset.
id());
614 processConfiguration->setProcessConfigurationID();
618 size_t all_workers_count =
allWorkers().size();
636 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
644 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
653 std::set<TypeID> productTypesConsumed;
654 std::set<TypeID> elementTypesConsumed;
657 for (
auto const& consumesInfo : worker->consumesInfo()) {
659 productTypesConsumed.emplace(consumesInfo.type());
661 elementTypesConsumed.emplace(consumesInfo.type());
666 if (hasSubprocesses) {
670 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
671 preg.
setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
679 std::vector<const ModuleDescription*> modDesc;
681 modDesc.reserve(
workers.size());
685 std::back_inserter(modDesc),
722 int maxEventSpecs = 0;
723 int maxEventsOut = -1;
730 std::vector<std::string> psetNamesE;
737 if (maxEventSpecs > 1) {
739 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
744 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
750 <<
"\nNo entry in 'maxEvents' for output module label '" <<
moduleLabel <<
"'.\n";
762 if (!
c->limitReached()) {
767 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n" 768 <<
"has reached its configured limit.\n";
792 <<
"---------- Event Summary ------------";
806 <<
"---------- Path Summary ------------";
807 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 808 <<
" " << std::right << std::setw(10) <<
"Executed" 809 <<
" " << std::right << std::setw(10) <<
"Passed" 810 <<
" " << std::right << std::setw(10) <<
"Failed" 811 <<
" " << std::right << std::setw(10) <<
"Error" 816 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
817 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" " 818 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
819 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
820 <<
p.timesExcept <<
" " <<
p.name <<
"";
842 <<
"-------End-Path Summary ------------";
843 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 844 <<
" " << std::right << std::setw(10) <<
"Executed" 845 <<
" " << std::right << std::setw(10) <<
"Passed" 846 <<
" " << std::right << std::setw(10) <<
"Failed" 847 <<
" " << std::right << std::setw(10) <<
"Error" 852 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
853 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" " 854 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
855 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
856 <<
p.timesExcept <<
" " <<
p.name <<
"";
862 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
863 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 864 <<
" " << std::right << std::setw(10) <<
"Visited" 865 <<
" " << std::right << std::setw(10) <<
"Passed" 866 <<
" " << std::right << std::setw(10) <<
"Failed" 867 <<
" " << std::right << std::setw(10) <<
"Error" 872 for (
auto const&
mod :
p.moduleInPathSummaries) {
873 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
874 <<
mod.bitPosition <<
" " << std::right << std::setw(10) <<
mod.timesVisited
875 <<
" " << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
876 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
877 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
884 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
885 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 886 <<
" " << std::right << std::setw(10) <<
"Visited" 887 <<
" " << std::right << std::setw(10) <<
"Passed" 888 <<
" " << std::right << std::setw(10) <<
"Failed" 889 <<
" " << std::right << std::setw(10) <<
"Error" 894 unsigned int bitpos = 0;
895 for (
auto const&
mod :
p.moduleInPathSummaries) {
896 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
897 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" " 898 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
899 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
900 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
907 <<
"---------- Module Summary ------------";
908 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited" 909 <<
" " << std::right << std::setw(10) <<
"Executed" 910 <<
" " << std::right << std::setw(10) <<
"Passed" 911 <<
" " << std::right << std::setw(10) <<
"Failed" 912 <<
" " << std::right << std::setw(10) <<
"Error" 917 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" " 918 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
919 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
920 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
921 <<
" " << worker.moduleLabel <<
"";
932 <<
"---------- Event Summary ---[sec]----";
940 <<
" efficiency CPU/Real/thread = " 944 constexpr
int kColumn1Size = 10;
945 constexpr
int kColumn2Size = 12;
946 constexpr
int kColumn3Size = 12;
949 <<
"---------- Path Summary ---[Real sec]----";
950 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 951 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 954 const int timesRun =
std::max(1,
p.timesRun);
956 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
957 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
959 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 960 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 966 <<
"-------End-Path Summary ---[Real sec]----";
967 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 968 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 972 const int timesRun =
std::max(1,
p.timesRun);
975 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
976 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
978 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 979 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 986 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
987 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 988 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 991 for (
auto const&
mod :
p.moduleInPathSummaries) {
993 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
994 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" " 995 <<
mod.moduleLabel <<
"";
999 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1000 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1007 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
1008 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1009 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1012 for (
auto const&
mod :
p.moduleInPathSummaries) {
1014 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
1015 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" " 1016 <<
mod.moduleLabel <<
"";
1020 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1021 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1027 <<
"---------- Module Summary ---[Real sec]----";
1028 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1029 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1030 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1035 << std::setw(kColumn1Size) << worker.realTime /
totalEvents <<
" " << std::right
1036 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" " 1037 << std::right << std::setw(kColumn3Size)
1038 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1041 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1042 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1043 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1054 using std::placeholders::_1;
1057 worker->respondToCloseOutputFile();
1062 using std::placeholders::_1;
1088 c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1118 c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1147 c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1159 using std::placeholders::_1;
1168 using std::placeholders::_1;
1173 using std::placeholders::_1;
1180 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1194 unsigned int iStreamID,
1207 if (worker->description()->moduleLabel() == iLabel) {
1212 if (
nullptr ==
found) {
1221 s->replaceModule(newMod, iLabel);
1234 found->updateLookup(iIndices);
1236 auto const&
processName = newMod->moduleDescription().processName();
1237 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(
processName);
1238 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(
processName);
1239 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(
processName);
1240 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(
processName);
1241 found->resolvePutIndicies(
InProcess, processBlockModuleToIndicies);
1242 found->resolvePutIndicies(
InRun, runModuleToIndicies);
1243 found->resolvePutIndicies(
InLumi, lumiModuleToIndicies);
1244 found->resolvePutIndicies(
InEvent, eventModuleToIndicies);
1253 stream->deleteModule(iLabel);
1259 std::multimap<std::string, std::string>
const& referencesToBranches,
1260 std::vector<std::string>
const& modulesToSkip,
1263 stream->initializeEarlyDelete(
1264 *
moduleRegistry(), branchesToDeleteEarly, referencesToBranches, modulesToSkip, preg);
1269 std::vector<ModuleDescription const*>
result;
1300 std::vector<ModuleDescription const*>& descriptions,
1301 unsigned int hint)
const {
1302 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1306 std::vector<ModuleDescription const*>& descriptions,
1307 unsigned int hint)
const {
1308 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1312 std::vector<ModuleDescription const*>& allModuleDescriptions,
1313 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1315 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1317 allModuleDescriptions.clear();
1318 moduleIDToIndex.clear();
1319 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1320 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1322 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1326 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1327 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1329 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1331 std::map<std::string, ModuleDescription const*> labelToDesc;
1335 allModuleDescriptions.push_back(
p);
1336 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(
p->id(),
i));
1337 labelToDesc[
p->moduleLabel()] =
p;
1345 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1346 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(
i);
1349 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1350 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(
i);
1352 worker->modulesWhoseProductsAreConsumed(
modules, modulesInPreviousProcesses, preg, labelToDesc);
1354 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1355 worker->description()->moduleLabel());
1363 rep.eventSummary.totalEvents = 0;
1364 rep.eventSummary.totalEventsPassed = 0;
1365 rep.eventSummary.totalEventsFailed = 0;
1367 s->getTriggerReport(
rep);
1373 rep.eventSummary.totalEvents = 0;
1374 rep.eventSummary.cpuTime = 0.;
1375 rep.eventSummary.realTime = 0.;
1380 int returnValue = 0;
1382 returnValue +=
s->totalEvents();
1388 int returnValue = 0;
1390 returnValue +=
s->totalEventsPassed();
1396 int returnValue = 0;
1398 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
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...
void endStream(unsigned int)
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)
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
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProxyIndices const &, ProcessBlockHelperBase const &)
auto runLast(edm::WaitingTaskHolder iTask)
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
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
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 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 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 beginStream(unsigned int)
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)
virtual void closeFile()=0
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)
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
std::vector< std::string > vstring
ServiceToken presentToken() const
void setIsMergeable(BranchDescription &)
int totalEventsFailed() const
void triggerPaths(std::vector< std::string > &oLabelsToFill) const