28 unsigned int hint = 0;
52 unsigned int dummy = 0;
53 auto target = std::make_pair(moduleID, dummy);
54 std::vector<std::pair<unsigned int, unsigned int> >::const_iterator iter =
58 <<
"PathsAndConsumesOfModules::moduleDescription: Unknown moduleID\n";
63 std::vector<ModuleDescription const*>
const&
68 std::vector<ModuleDescription const*>
const&
73 std::vector<ModuleDescription const*>
const&
78 std::vector<ConsumesInfo>
86 unsigned int dummy = 0;
87 auto target = std::make_pair(moduleID, dummy);
88 std::vector<std::pair<unsigned int, unsigned int> >::const_iterator iter =
92 <<
"PathsAndConsumesOfModules::moduleIndex: Unknown moduleID\n";
140 bool iPrintDependencies) {
143 std::unordered_map<unsigned int, std::string> moduleIndexToNames;
146 const std::string kTriggerResults(
"TriggerResults");
148 unsigned int largestIndex = 0;
149 unsigned int kPathToTriggerResultsDependencyLastIndex =
kInvalidIndex;
151 moduleIndexToNames.insert(std::make_pair(
description->id(),
153 if(kTriggerResults ==
description->moduleLabel()) {
160 kPathToTriggerResultsDependencyLastIndex = largestIndex ;
209 std::unordered_map<unsigned int, std::vector<unsigned int>> moduleIndexToPathIndex;
212 std::vector<std::string> pathNames = iPnC.
paths();
213 const unsigned int kFirstEndPathIndex = pathNames.size();
219 const std::string kFinishedProcessing(
"@FinishedProcessing");
220 const unsigned int kFinishedProcessingIndex{0};
221 moduleIndexToNames.insert(std::make_pair(kFinishedProcessingIndex,
222 kFinishedProcessing));
225 pathNames.insert(pathNames.end(), iPnC.
endPaths().begin(), iPnC.
endPaths().end());
226 std::vector<std::vector<unsigned int>> pathIndexToModuleIndexOrder(pathNames.size());
229 for(
unsigned int pathIndex = 0; pathIndex != pathNames.size(); ++pathIndex) {
230 std::set<unsigned int> alreadySeenIndex;
232 std::vector<ModuleDescription const*>
const* moduleDescriptions;
233 if(pathIndex < kFirstEndPathIndex) {
239 auto& pathOrder =pathIndexToModuleIndexOrder[pathIndex];
240 pathOrder.reserve(moduleDescriptions->size() + 1);
241 for(
auto const&
description: *moduleDescriptions) {
246 pathOrder.push_back(moduleIndex);
248 paths.push_back(pathIndex);
250 edgeToPathMap[std::make_pair(moduleIndex,lastModuleIndex)].push_back(pathIndex);
257 if( pathIndex < kFirstEndPathIndex) {
259 ++kPathToTriggerResultsDependencyLastIndex;
260 edgeToPathMap[std::make_pair(kPathToTriggerResultsDependencyLastIndex,lastModuleIndex)].push_back(pathIndex);
261 moduleIndexToNames.insert(std::make_pair(kPathToTriggerResultsDependencyLastIndex,
264 edgeToPathMap[std::make_pair(kTriggerResultsIndex, kPathToTriggerResultsDependencyLastIndex)].push_back(
kDataDependencyIndex);
267 edgeToPathMap[std::make_pair(kFinishedProcessingIndex, kPathToTriggerResultsDependencyLastIndex)].push_back(
kDataDependencyIndex);
268 pathOrder.push_back(kPathToTriggerResultsDependencyLastIndex);
271 if( (not moduleDescriptions->empty()) ) {
273 ++kPathToTriggerResultsDependencyLastIndex;
274 edgeToPathMap[std::make_pair(moduleDescriptions->front()->id(),kPathToTriggerResultsDependencyLastIndex)].push_back(pathIndex);
275 moduleIndexToNames.insert(std::make_pair(kPathToTriggerResultsDependencyLastIndex,
277 edgeToPathMap[std::make_pair(kPathToTriggerResultsDependencyLastIndex,kTriggerResultsIndex)].push_back(
kDataDependencyIndex);
278 pathOrder.insert(pathOrder.begin(),kPathToTriggerResultsDependencyLastIndex);
281 ++kPathToTriggerResultsDependencyLastIndex;
282 edgeToPathMap[std::make_pair(kPathToTriggerResultsDependencyLastIndex,lastModuleIndex)].push_back(pathIndex);
283 moduleIndexToNames.insert(std::make_pair(kPathToTriggerResultsDependencyLastIndex,
285 edgeToPathMap[std::make_pair(kFinishedProcessingIndex, kPathToTriggerResultsDependencyLastIndex)].push_back(
kDataDependencyIndex);
286 pathOrder.push_back(kPathToTriggerResultsDependencyLastIndex);
297 for(
auto const& depDescription: dependentModules) {
298 if(iPrintDependencies) {
300 "' depends on data products from module '" << depDescription->moduleLabel()<<
"'";
305 auto depID =depDescription->id();
306 auto itPathsFound = moduleIndexToPathIndex.find(moduleIndex);
307 bool keepDataDependency =
true;
308 auto itDepsPathsFound =moduleIndexToPathIndex.find(depID);
309 if(itPathsFound != moduleIndexToPathIndex.end() and itDepsPathsFound != moduleIndexToPathIndex.end()) {
310 keepDataDependency =
false;
311 for(
auto const pathIndex: itPathsFound->second) {
312 for(
auto idToCheck: pathIndexToModuleIndexOrder[pathIndex]) {
313 if(idToCheck == depID) {
317 if(idToCheck == moduleIndex) {
320 keepDataDependency =
true;
324 if(keepDataDependency) {
329 if(keepDataDependency) {
virtual std::vector< ConsumesInfo > consumesInfo() const =0
constexpr auto kInvalidIndex
void fillModuleAndConsumesInfo(std::vector< ModuleDescription const * > &allModuleDescriptions, std::vector< std::pair< unsigned int, unsigned int > > &moduleIDToIndex, std::vector< std::vector< ModuleDescription const * > > &modulesWhoseProductsAreConsumedBy, ProductRegistry const &preg) const
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
std::vector< std::vector< ModuleDescription const * > > modulesWhoseProductsAreConsumedBy_
void throwIfImproperDependencies(EdgeToPathMap const &, std::vector< std::vector< unsigned int >> const &iPathIndexToModuleIndexOrder, std::vector< std::string > const &iPathNames, std::unordered_map< unsigned int, std::string > const &iModuleIndexToNames)
std::map< SimpleEdge, std::vector< unsigned int >> EdgeToPathMap
virtual std::vector< ModuleDescription const * > const & doModulesOnPath(unsigned int pathIndex) const override
constexpr auto kDataDependencyIndex
std::vector< ModuleDescription const * > const & modulesOnEndPath(unsigned int endPathIndex) const
std::vector< ModuleDescription const * > const & modulesOnPath(unsigned int pathIndex) const
unsigned int moduleIndex(unsigned int moduleID) const
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
virtual std::vector< ModuleDescription const * > const & doModulesWhoseProductsAreConsumedBy(unsigned int moduleID) const override
std::vector< ModuleDescription const * > allModuleDescriptions_
std::vector< std::string > paths_
std::vector< ModuleDescription const * > const & allModules() const
std::vector< std::string > const & endPaths() const
virtual std::vector< ModuleDescription const * > const & doModulesOnEndPath(unsigned int endPathIndex) const override
void initialize(Schedule const *, std::shared_ptr< ProductRegistry const >)
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
std::vector< std::string > endPaths_
virtual std::vector< ConsumesInfo > doConsumesInfo(unsigned int moduleID) const override
void checkForModuleDependencyCorrectness(edm::PathsAndConsumesOfModulesBase const &iPnC, bool iPrintDependencies)
std::shared_ptr< ProductRegistry const > preg_
std::vector< ModuleDescription const * > const & modulesWhoseProductsAreConsumedBy(unsigned int moduleID) const
Schedule const * schedule_
std::vector< std::string > const & paths() const
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_
virtual ModuleDescription const * doModuleDescription(unsigned int moduleID) const override
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
virtual ~PathsAndConsumesOfModules()