Skip to content

Commit

Permalink
Merge pull request #21063 from Dr15Jones/avoidedUneededRunLumiCalls
Browse files Browse the repository at this point in the history
Avoided uneeded run and luminosity block  calls
  • Loading branch information
cmsbuild committed Oct 29, 2017
2 parents d434fc9 + 332e7ad commit e099e08
Show file tree
Hide file tree
Showing 43 changed files with 338 additions and 2,334 deletions.
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/EDAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ namespace edm {

// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

static bool wantsGlobalRuns() {return true;}
static bool wantsGlobalLuminosityBlocks() {return true;}
static bool wantsStreamRuns() {return false;}
static bool wantsStreamLuminosityBlocks() {return false;};

void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);

Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/EDFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

static bool wantsGlobalRuns() {return true;}
static bool wantsGlobalLuminosityBlocks() {return true;}
static bool wantsStreamRuns() {return false;}
static bool wantsStreamLuminosityBlocks() {return false;};

private:
bool doEvent(EventPrincipal const& ep, EventSetup const& c,
ActivityRegistry* act,
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/EDProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ namespace edm {

// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

static bool wantsGlobalRuns() {return true;}
static bool wantsGlobalLuminosityBlocks() {return true;}
static bool wantsStreamRuns() {return false;}
static bool wantsStreamLuminosityBlocks() {return false;};

private:
bool doEvent(EventPrincipal const& ep, EventSetup const& c,
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/OutputModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ namespace edm {
static const std::string& baseType();
static void prevalidate(ConfigurationDescriptions& );

static bool wantsGlobalRuns() {return true;}
static bool wantsGlobalLuminosityBlocks() {return true;}
static bool wantsStreamRuns() {return false;}
static bool wantsStreamLuminosityBlocks() {return false;};

bool wantAllEvents() const {return wantAllEvents_;}

BranchIDLists const* branchIDLists();
Expand Down
15 changes: 14 additions & 1 deletion FWCore/Framework/interface/global/EDAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ namespace edm {
virtual ~EDAnalyzer() {}
#endif
// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}

bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/global/EDAnalyzerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

private:
bool doEvent(EventPrincipal const& ep, EventSetup const& c,
ActivityRegistry*,
Expand Down
15 changes: 14 additions & 1 deletion FWCore/Framework/interface/global/EDFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ namespace edm {
virtual ~EDFilter() = default;
#endif
// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}

bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/global/EDFilterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

private:
bool doEvent(EventPrincipal const& ep, EventSetup const& c,
ActivityRegistry*,
Expand Down
15 changes: 14 additions & 1 deletion FWCore/Framework/interface/global/EDProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,20 @@ namespace edm {
EDProducer() = default;

// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}

bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/global/EDProducerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

private:
bool doEvent(EventPrincipal const& ep, EventSetup const& c,
ActivityRegistry*,
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Framework/interface/global/OutputModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ namespace edm {
#endif

// ---------- const member functions ---------------------
bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

Expand Down
10 changes: 9 additions & 1 deletion FWCore/Framework/interface/global/OutputModuleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ namespace edm {
static void prevalidate(ConfigurationDescriptions& );

bool wantAllEvents() const {return wantAllEvents_;}

BranchIDLists const* branchIDLists();

ThinnedAssociationsHelper const* thinnedAssociationsHelper() const;

const ModuleDescription& moduleDescription() const {
return moduleDescription_;
}

//Output modules always need writeRun and writeLumi to be called
bool wantsGlobalRuns() const {return true;}
bool wantsGlobalLuminosityBlocks() const {return true;}

virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

protected:

ModuleDescription const& description() const;
Expand Down
14 changes: 13 additions & 1 deletion FWCore/Framework/interface/limited/EDAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ namespace edm {
virtual ~EDAnalyzer() {}
#endif
// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}
bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/limited/EDAnalyzerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }

LimitedTaskQueue& queue() {
Expand Down
14 changes: 13 additions & 1 deletion FWCore/Framework/interface/limited/EDFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ namespace edm {
virtual ~EDFilter() = default;
#endif
// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}
bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/limited/EDFilterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }

LimitedTaskQueue& queue() {
Expand Down
14 changes: 13 additions & 1 deletion FWCore/Framework/interface/limited/EDProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ namespace edm {
T>::Type(iPSet)... {}

// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}
bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/limited/EDProducerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }

LimitedTaskQueue& queue() {
Expand Down
8 changes: 7 additions & 1 deletion FWCore/Framework/interface/limited/OutputModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ namespace edm {
#endif

// ---------- const member functions ---------------------

bool wantsStreamRuns() const final {
return WantsStreamRunTransitions<T...>::value;
}
bool wantsStreamLuminosityBlocks() const final {
return WantsStreamLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Framework/interface/limited/OutputModuleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ namespace edm {
return moduleDescription_;
}

//Output modules always need writeRun and writeLumi to be called
bool wantsGlobalRuns() const {return true;}
bool wantsGlobalLuminosityBlocks() const {return true;}
virtual bool wantsStreamRuns() const =0;
virtual bool wantsStreamLuminosityBlocks() const =0;

unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }

LimitedTaskQueue& queue() {
Expand Down
28 changes: 28 additions & 0 deletions FWCore/Framework/interface/moduleAbilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,34 @@ namespace edm {
typedef edm::module::Empty Type;
};

template<typename... VArgs>
struct WantsGlobalRunTransitions {
static constexpr bool value = CheckAbility<module::Abilities::kRunCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kRunSummaryCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kBeginRunProducer,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kEndRunProducer, VArgs...>::kHasIt;
};

template<typename... VArgs>
struct WantsGlobalLuminosityBlockTransitions {
static constexpr bool value = CheckAbility<module::Abilities::kLuminosityBlockCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kLuminosityBlockSummaryCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kBeginLuminosityBlockProducer,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kEndLuminosityBlockProducer, VArgs...>::kHasIt;
};

template<typename... VArgs>
struct WantsStreamRunTransitions {
static constexpr bool value = CheckAbility<module::Abilities::kStreamCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kRunSummaryCache,VArgs...>::kHasIt ;
};

template<typename... VArgs>
struct WantsStreamLuminosityBlockTransitions {
static constexpr bool value = CheckAbility<module::Abilities::kStreamCache,VArgs...>::kHasIt or
CheckAbility<module::Abilities::kLuminosityBlockSummaryCache,VArgs...>::kHasIt;
};

}

#endif
8 changes: 7 additions & 1 deletion FWCore/Framework/interface/one/EDAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ namespace edm {
#endif

// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/one/EDAnalyzerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace edm {
// Warning: the returned moduleDescription will be invalid during construction
ModuleDescription const& moduleDescription() const { return moduleDescription_; }

virtual bool wantsGlobalRuns() const =0;
virtual bool wantsGlobalLuminosityBlocks() const =0;
bool wantsStreamRuns() const {return false;}
bool wantsStreamLuminosityBlocks() const {return false;};

void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);

private:
Expand Down
8 changes: 7 additions & 1 deletion FWCore/Framework/interface/one/EDFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ namespace edm {
//virtual ~EDFilter();

// ---------- const member functions ---------------------

bool wantsGlobalRuns() const final {
return WantsGlobalRunTransitions<T...>::value;
}
bool wantsGlobalLuminosityBlocks() const final {
return WantsGlobalLuminosityBlockTransitions<T...>::value;
}

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
Expand Down
Loading

0 comments on commit e099e08

Please sign in to comment.