58 using std::placeholders::_1;
60 bool binary_search_string(std::vector<std::string>
const&
v,
std::string const&
s) {
61 return std::binary_search(
v.begin(),
v.end(),
s);
67 std::shared_ptr<TriggerResultInserter> makeInserter(
ParameterSet& proc_pset,
68 PreallocationConfiguration
const& iPrealloc,
69 ProductRegistry& preg,
70 ExceptionToActionTable
const&
actions,
71 std::shared_ptr<ActivityRegistry> areg,
72 std::shared_ptr<ProcessConfiguration> processConfiguration) {
73 ParameterSet* trig_pset = proc_pset.getPSetForUpdate(
"@trigger_paths");
74 trig_pset->registerIt();
76 WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration,
actions);
77 ModuleDescription md(trig_pset->id(),
78 "TriggerResultInserter",
80 processConfiguration.get(),
83 areg->preModuleConstructionSignal_(md);
84 bool postCalled =
false;
85 std::shared_ptr<TriggerResultInserter> returnValue;
88 maker::ModuleHolderT<TriggerResultInserter> holder(
89 make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
90 static_cast<Maker const*>(
nullptr));
91 holder.setModuleDescription(md);
92 holder.registerProductsAndCallbacks(&preg);
93 returnValue = holder.module();
96 areg->postModuleConstructionSignal_(md);
99 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
108 template <
typename T>
110 std::vector<std::string>
const& pathNames,
111 PreallocationConfiguration
const& iPrealloc,
112 ProductRegistry& preg,
113 std::shared_ptr<ActivityRegistry> areg,
114 std::shared_ptr<ProcessConfiguration> processConfiguration,
121 pathStatusInserters.reserve(pathNames.size());
123 for (
auto const&
pathName : pathNames) {
124 ModuleDescription md(
127 areg->preModuleConstructionSignal_(md);
128 bool postCalled =
false;
131 maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
132 static_cast<Maker const*>(
nullptr));
133 holder.setModuleDescription(md);
134 holder.registerProductsAndCallbacks(&preg);
135 pathStatusInserters.emplace_back(holder.module());
138 areg->postModuleConstructionSignal_(md);
141 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
150 typedef std::vector<std::string>
vstring;
154 struct BranchesCases {
155 BranchesCases(std::vector<std::string> cases) : caseLabels{
std::move(cases)} {}
156 std::vector<BranchKey> chosenBranches;
157 std::vector<std::string> caseLabels;
159 std::map<std::string, BranchesCases> switchMap;
160 for (
auto&
prod : preg.productListUpdator()) {
161 if (
prod.second.isSwitchAlias()) {
162 auto it = switchMap.find(
prod.second.moduleLabel());
163 if (it == switchMap.end()) {
165 auto inserted = switchMap.emplace(
prod.second.moduleLabel(),
166 switchPSet.getParameter<std::vector<std::string>>(
"@all_cases"));
172 for (
auto const& productIter : preg.productList()) {
173 BranchKey
const& branchKey = productIter.first;
182 BranchDescription
const&
desc = productIter.second;
183 if (
desc.branchType() ==
prod.second.branchType() and
184 desc.unwrappedTypeID().typeInfo() ==
prod.second.unwrappedTypeID().typeInfo() and
185 branchKey.moduleLabel() ==
prod.second.switchAliasModuleLabel() and
186 branchKey.productInstanceName() ==
prod.second.productInstanceName()) {
187 prod.second.setSwitchAliasForBranch(
desc);
188 it->second.chosenBranches.push_back(
prod.first);
194 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n" 195 <<
" friendly class name = " <<
prod.second.friendlyClassName() <<
"\n" 196 <<
" module label = " <<
prod.second.moduleLabel() <<
"\n" 197 <<
" product instance name = " <<
prod.second.productInstanceName() <<
"\n" 199 <<
"\n\nbut did not find any. Please contact a framework developer.";
200 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
205 if (switchMap.empty())
208 for (
auto& elem : switchMap) {
209 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
213 std::map<std::string, std::vector<BranchKey>> caseBranches;
214 for (
auto const&
item : preg.productList()) {
218 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
219 found != caseLabels.end()) {
220 caseBranches[*
found].push_back(
item.first);
224 for (
auto const& caseLabel : caseLabels) {
225 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
226 auto& branches = caseBranches[caseLabel];
227 std::sort(branches.begin(), branches.end());
228 for (
auto const&
branch : branches) {
229 ex <<
" " <<
branch.friendlyClassName() <<
" " <<
branch.productInstanceName() <<
"\n";
236 std::vector<bool> foundBranches;
237 for (
auto const& switchItem : switchMap) {
238 auto const& switchLabel = switchItem.first;
239 auto const& chosenBranches = switchItem.second.chosenBranches;
240 auto const& caseLabels = switchItem.second.caseLabels;
241 foundBranches.resize(chosenBranches.size());
242 for (
auto const& caseLabel : caseLabels) {
243 std::fill(foundBranches.begin(), foundBranches.end(),
false);
244 for (
auto& nonConstItem : preg.productListUpdator()) {
245 auto const&
item = nonConstItem;
255 nonConstItem.second.setTransient(
true);
257 auto range = std::equal_range(chosenBranches.begin(),
258 chosenBranches.end(),
259 BranchKey(
item.first.friendlyClassName(),
261 item.first.productInstanceName(),
262 item.first.processName()));
265 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product " 266 <<
item.first <<
" that is not produced by the chosen case " 268 .getUntrackedParameter<std::string>(
"@chosen_case")
269 <<
". If the intention is to produce only a subset of the products listed below, each case with " 270 "more products needs to be replaced with an EDAlias to only the necessary products, and the " 271 "EDProducer itself needs to be moved to a Task.\n\n";
272 addProductsToException(caseLabels, ex);
279 auto const&
bd =
item.second;
280 if (not
bd.branchAliases().empty()) {
282 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch " 283 "aliases for SwitchProducer with label " 284 << switchLabel <<
" for case " << caseLabel <<
":";
285 for (
auto const& branchAlias :
bd.branchAliases()) {
286 ex <<
" " << branchAlias;
293 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
294 if (not foundBranches[
i]) {
296 .getUntrackedParameter<std::string>(
"@chosen_case");
298 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
299 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case " 301 <<
". If the intention is to produce only a subset of the products listed below, each case with more " 302 "products needs to be replaced with an EDAlias to only the necessary products, and the " 303 "EDProducer itself needs to be moved to a Task.\n\n";
304 addProductsToException(caseLabels, ex);
313 vstring const& end_path_name_list,
315 std::set<std::string>
const& usedModuleLabels,
330 std::string const moduleEdmType(
"@module_edm_type");
336 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
340 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
341 std::set<std::string> modulesOnPaths;
343 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
344 for (
auto const& endPath : end_path_name_list) {
345 noEndPaths.erase(endPath);
349 for (
auto const&
path : noEndPaths) {
357 std::vector<std::string> labelsToBeDropped;
358 labelsToBeDropped.reserve(modulesInConfigSet.size());
360 modulesInConfigSet.end(),
361 usedModuleLabels.begin(),
362 usedModuleLabels.end(),
363 std::back_inserter(labelsToBeDropped));
365 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
366 for (
auto const& modLabel : usedModuleLabels) {
370 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
371 if (edmType == outputModule) {
372 outputModuleLabels.push_back(modLabel);
373 labelsToBeDropped.push_back(modLabel);
375 if (edmType == edAnalyzer) {
376 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
377 labelsToBeDropped.push_back(modLabel);
384 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
390 vstring::iterator endAfterRemove =
391 std::remove_if(modulesInConfig.begin(),
392 modulesInConfig.end(),
393 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
394 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
400 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
401 iEndPath != endEndPath;
404 vstring::iterator iSave =
labels.begin();
405 vstring::iterator iBegin =
labels.begin();
407 for (vstring::iterator iLabel =
labels.begin(), iEnd =
labels.end(); iLabel != iEnd; ++iLabel) {
408 if (binary_search_string(labelsToBeDropped, *iLabel)) {
409 if (binary_search_string(outputModuleLabels, *iLabel)) {
410 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
413 if (iSave != iLabel) {
414 iSave->swap(*iLabel);
422 proc_pset.eraseSimpleParameter(*iEndPath);
423 endPathsToBeDropped.push_back(*iEndPath);
431 endAfterRemove = std::remove_if(scheduledPaths.begin(),
432 scheduledPaths.end(),
433 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
434 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
438 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
439 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
440 scheduledEndPaths.end(),
441 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
442 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
446 class RngEDConsumer :
public EDConsumerBase {
448 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
450 if (rng.isAvailable()) {
451 rng->consumes(consumesCollector());
452 for (
auto const& consumesInfo : this->consumesInfo()) {
453 typesConsumed.emplace(consumesInfo.type());
459 template <
typename F>
460 auto doCleanup(
F&& iF) {
465 iTask.doneWaiting(*iPtr);
485 std::shared_ptr<ActivityRegistry> areg,
486 std::shared_ptr<ProcessConfiguration> processConfiguration,
487 bool hasSubprocesses,
492 ? std::shared_ptr<TriggerResultInserter>{}
493 : makeInserter(proc_pset, prealloc, preg,
actions, areg, processConfiguration)},
495 all_output_communicators_(),
496 preallocConfig_(prealloc),
497 pathNames_(&tns.getTrigPaths()),
498 endPathNames_(&tns.getEndPaths()),
499 wantSummary_(tns.wantSummary()) {
500 makePathStatusInserters(pathStatusInserters_,
505 processConfiguration,
508 makePathStatusInserters(endPathStatusInserters_,
513 processConfiguration,
516 assert(0 < prealloc.numberOfStreams());
517 streamSchedules_.reserve(prealloc.numberOfStreams());
518 for (
unsigned int i = 0;
i < prealloc.numberOfStreams(); ++
i) {
519 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
520 pathStatusInserters_,
521 endPathStatusInserters_,
530 processConfiguration,
537 const std::string kTriggerResults(
"TriggerResults");
538 std::vector<std::string> modulesToUse;
539 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
540 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
541 if (worker->description()->moduleLabel() != kTriggerResults) {
542 modulesToUse.push_back(worker->description()->moduleLabel());
546 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
547 if (nUnscheduledModules > 0) {
548 std::vector<std::string>
temp;
549 temp.reserve(modulesToUse.size());
550 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
551 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(
temp));
552 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(
temp));
553 temp.swap(modulesToUse);
557 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
558 pathStatusInserters_,
559 endPathStatusInserters_,
567 processConfiguration,
572 std::set<std::string> usedModuleLabels;
573 for (
auto const& worker : allWorkers()) {
574 if (worker->description()->moduleLabel() != kTriggerResults) {
575 usedModuleLabels.insert(worker->description()->moduleLabel());
578 std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>(
"@all_modules"));
579 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
580 reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
582 std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string>>(
"@all_aliases");
588 if (nUnscheduledModules > 0) {
589 std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
590 preg.setUnscheduledProducts(unscheduledModules);
593 processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
594 proc_pset.registerIt();
595 processConfiguration->setParameterSetID(proc_pset.id());
596 processConfiguration->setProcessConfigurationID();
600 size_t all_workers_count = allWorkers().size();
602 moduleRegistry_->forAllModuleHolders([
this](maker::ModuleHolder* iHolder) {
603 auto comm = iHolder->createOutputModuleCommunicator();
605 all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
609 limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
613 assert(all_workers_count == allWorkers().
size());
615 branchIDListHelper.updateFromRegistry(preg);
617 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
618 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
621 processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
625 for (
auto&
c : all_output_communicators_) {
626 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
629 for (
auto& product : preg.productListUpdator()) {
635 std::set<TypeID> productTypesConsumed;
636 std::set<TypeID> elementTypesConsumed;
638 for (
auto const& worker : allWorkers()) {
639 for (
auto const& consumesInfo : worker->consumesInfo()) {
641 productTypesConsumed.emplace(consumesInfo.type());
643 elementTypesConsumed.emplace(consumesInfo.type());
648 if (hasSubprocesses) {
652 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
653 preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
656 for (
auto&
c : all_output_communicators_) {
657 c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
661 std::vector<const ModuleDescription*> modDesc;
662 const auto&
workers = allWorkers();
663 modDesc.reserve(
workers.size());
667 std::back_inserter(modDesc),
668 [](
const Worker* iWorker) ->
const ModuleDescription* {
return iWorker->description(); });
671 summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
672 auto timeKeeperPtr = summaryTimeKeeper_.get();
704 int maxEventSpecs = 0;
705 int maxEventsOut = -1;
712 std::vector<std::string> psetNamesE;
719 if (maxEventSpecs > 1) {
721 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
726 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
732 <<
"\nNo entry in 'maxEvents' for output module label '" <<
moduleLabel <<
"'.\n";
744 if (!
c->limitReached()) {
749 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n" 750 <<
"has reached its configured limit.\n";
774 <<
"---------- Event Summary ------------";
788 <<
"---------- Path Summary ------------";
789 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 790 <<
" " << std::right << std::setw(10) <<
"Executed" 791 <<
" " << std::right << std::setw(10) <<
"Passed" 792 <<
" " << std::right << std::setw(10) <<
"Failed" 793 <<
" " << std::right << std::setw(10) <<
"Error" 798 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
799 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" " 800 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
801 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
802 <<
p.timesExcept <<
" " <<
p.name <<
"";
824 <<
"-------End-Path Summary ------------";
825 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 826 <<
" " << std::right << std::setw(10) <<
"Executed" 827 <<
" " << std::right << std::setw(10) <<
"Passed" 828 <<
" " << std::right << std::setw(10) <<
"Failed" 829 <<
" " << std::right << std::setw(10) <<
"Error" 834 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
835 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" " 836 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
837 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
838 <<
p.timesExcept <<
" " <<
p.name <<
"";
844 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
845 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 846 <<
" " << std::right << std::setw(10) <<
"Visited" 847 <<
" " << std::right << std::setw(10) <<
"Passed" 848 <<
" " << std::right << std::setw(10) <<
"Failed" 849 <<
" " << std::right << std::setw(10) <<
"Error" 854 for (
auto const&
mod :
p.moduleInPathSummaries) {
855 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
856 <<
mod.bitPosition <<
" " << std::right << std::setw(10) <<
mod.timesVisited
857 <<
" " << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
858 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
859 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
866 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
867 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#" 868 <<
" " << std::right << std::setw(10) <<
"Visited" 869 <<
" " << std::right << std::setw(10) <<
"Passed" 870 <<
" " << std::right << std::setw(10) <<
"Failed" 871 <<
" " << std::right << std::setw(10) <<
"Error" 876 unsigned int bitpos = 0;
877 for (
auto const&
mod :
p.moduleInPathSummaries) {
878 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
879 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" " 880 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
881 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
882 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
889 <<
"---------- Module Summary ------------";
890 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited" 891 <<
" " << std::right << std::setw(10) <<
"Executed" 892 <<
" " << std::right << std::setw(10) <<
"Passed" 893 <<
" " << std::right << std::setw(10) <<
"Failed" 894 <<
" " << std::right << std::setw(10) <<
"Error" 899 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" " 900 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
901 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
902 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
903 <<
" " << worker.moduleLabel <<
"";
914 <<
"---------- Event Summary ---[sec]----";
922 <<
" efficiency CPU/Real/thread = " 926 constexpr
int kColumn1Size = 10;
927 constexpr
int kColumn2Size = 12;
928 constexpr
int kColumn3Size = 12;
931 <<
"---------- Path Summary ---[Real sec]----";
932 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 933 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 936 const int timesRun =
std::max(1,
p.timesRun);
938 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
939 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
941 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 942 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 948 <<
"-------End-Path Summary ---[Real sec]----";
949 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 950 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 954 const int timesRun =
std::max(1,
p.timesRun);
957 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
958 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
960 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 961 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 968 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
969 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 970 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 973 for (
auto const&
mod :
p.moduleInPathSummaries) {
975 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
976 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" " 977 <<
mod.moduleLabel <<
"";
981 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 982 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 989 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
990 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 991 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 994 for (
auto const&
mod :
p.moduleInPathSummaries) {
996 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
997 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" " 998 <<
mod.moduleLabel <<
"";
1002 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1003 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit" 1009 <<
"---------- Module Summary ---[Real sec]----";
1010 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1011 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1012 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1017 << std::setw(kColumn1Size) << worker.realTime /
totalEvents <<
" " << std::right
1018 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" " 1019 << std::right << std::setw(kColumn3Size)
1020 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1023 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event" 1024 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec" 1025 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit" 1036 using std::placeholders::_1;
1039 worker->respondToCloseOutputFile();
1044 using std::placeholders::_1;
1070 c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1100 c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1129 c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1141 using std::placeholders::_1;
1150 using std::placeholders::_1;
1155 using std::placeholders::_1;
1162 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1176 unsigned int iStreamID,
1189 if (worker->description()->moduleLabel() == iLabel) {
1194 if (
nullptr ==
found) {
1203 s->replaceModule(newMod, iLabel);
1216 found->updateLookup(iIndices);
1218 auto const&
processName = newMod->moduleDescription().processName();
1219 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(
processName);
1220 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(
processName);
1221 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(
processName);
1222 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(
processName);
1223 found->resolvePutIndicies(
InProcess, processBlockModuleToIndicies);
1224 found->resolvePutIndicies(
InRun, runModuleToIndicies);
1225 found->resolvePutIndicies(
InLumi, lumiModuleToIndicies);
1226 found->resolvePutIndicies(
InEvent, eventModuleToIndicies);
1235 stream->deleteModule(iLabel);
1248 std::vector<ModuleDescription const*>
result;
1279 std::vector<ModuleDescription const*>& descriptions,
1280 unsigned int hint)
const {
1281 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1285 std::vector<ModuleDescription const*>& descriptions,
1286 unsigned int hint)
const {
1287 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1291 std::vector<ModuleDescription const*>& allModuleDescriptions,
1292 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1294 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1296 allModuleDescriptions.clear();
1297 moduleIDToIndex.clear();
1298 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1299 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1301 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1305 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1306 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1308 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1310 std::map<std::string, ModuleDescription const*> labelToDesc;
1314 allModuleDescriptions.push_back(
p);
1315 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(
p->id(),
i));
1316 labelToDesc[
p->moduleLabel()] =
p;
1324 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1325 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(
i);
1328 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1329 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(
i);
1331 worker->modulesWhoseProductsAreConsumed(
modules, modulesInPreviousProcesses, preg, labelToDesc);
1333 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1334 worker->description()->moduleLabel());
1342 rep.eventSummary.totalEvents = 0;
1343 rep.eventSummary.totalEventsPassed = 0;
1344 rep.eventSummary.totalEventsFailed = 0;
1346 s->getTriggerReport(
rep);
1352 rep.eventSummary.totalEvents = 0;
1353 rep.eventSummary.cpuTime = 0.;
1354 rep.eventSummary.realTime = 0.;
1359 int returnValue = 0;
1361 returnValue +=
s->totalEvents();
1367 int returnValue = 0;
1369 returnValue +=
s->totalEventsPassed();
1375 int returnValue = 0;
1377 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_
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)
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...
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
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.
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
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 clearCounters()
Clear all the counters in the trigger report.
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
PostGlobalWriteRun postGlobalWriteRunSignal_
static ServiceRegistry & instance()
std::vector< PathTimingSummary > trigPathSummaries
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
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_
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
void addContext(std::string const &context)
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const *> &descriptions, unsigned int hint) const
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 initializeEarlyDelete(std::vector< std::string > const &branchesToDeleteEarly, edm::ProductRegistry const &preg)
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 endJob(ExceptionCollector &collector)
Schedule(ParameterSet &proc_pset, service::TriggerNamesService const &tns, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ProcessBlockHelperBase &, ThinnedAssociationsHelper &thinnedAssociationsHelper, SubProcessParentageHelper const *subProcessParentageHelper, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, bool hasSubprocesses, PreallocationConfiguration const &config, ProcessContext const *processContext)
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