CMS 3D CMS Logo

NumberOfConcurrentIOVs.cc
Go to the documentation of this file.
1 
3 
9 
10 #include <algorithm>
11 #include <cassert>
12 #include <string>
13 
14 namespace edm {
15  namespace eventsetup {
16 
17  NumberOfConcurrentIOVs::NumberOfConcurrentIOVs() : numberConcurrentIOVs_(1) {}
18 
20  if (eventSetupPset) { // this condition is false for SubProcesses
21  numberConcurrentIOVs_ = eventSetupPset->getUntrackedParameter<unsigned int>("numberOfConcurrentIOVs");
22  if (numberConcurrentIOVs_ == 0) {
24  }
25 
26  ParameterSet const& pset(eventSetupPset->getUntrackedParameterSet("forceNumberOfConcurrentIOVs"));
27  std::vector<std::string> recordNames = pset.getParameterNames();
28  forceNumberOfConcurrentIOVs_.reserve(recordNames.size());
29  for (auto const& recordName : recordNames) {
31  forceNumberOfConcurrentIOVs_.emplace_back(recordKey, pset.getUntrackedParameter<unsigned int>(recordName));
32  }
33  std::sort(forceNumberOfConcurrentIOVs_.begin(),
35  [](auto const& left, auto const& right) { return left.first < right.first; });
36  }
37  }
38 
39  void NumberOfConcurrentIOVs::setMaxConcurrentIOVs(unsigned int nStreams, unsigned int nConcurrentLumis) {
40  maxConcurrentIOVs_ = std::min(nStreams, nConcurrentLumis);
41  }
42 
45  }
46 
48  bool printInfoMsg) const {
52  std::make_pair(eventSetupKey, 0u),
53  [](auto const& left, auto const& right) { return left.first < right.first; });
54  if (iter != forceNumberOfConcurrentIOVs_.end() && iter->first == eventSetupKey) {
55  if (printInfoMsg && iter->second > maxConcurrentIOVs_) {
56  LogInfo("Configuration") << "For record " << eventSetupKey.name() << " you have configured " << iter->second
57  << " concurrent IOVs.\n"
58  << "But you cannot have more concurrent IOVs than lumis or streams.\n"
59  << "There will not be more than " << maxConcurrentIOVs_ << " concurrent IOVs.\n";
60  }
61  return std::min(iter->second, maxConcurrentIOVs_);
62  }
64  return 1;
65  }
66  if (printInfoMsg && numberConcurrentIOVs_ > maxConcurrentIOVs_) {
67  LogInfo("Configuration") << "For record " << eventSetupKey.name() << " you have configured "
68  << numberConcurrentIOVs_ << " concurrent IOVs.\n"
69  << "But you cannot have more concurrent IOVs than lumis or streams.\n"
70  << "There will not be more than " << maxConcurrentIOVs_ << " concurrent IOVs.\n";
71  }
73  }
74 
76  // Mark this as invalid
78 
79  // Free up memory
81  std::vector<std::pair<EventSetupRecordKey, unsigned int>>().swap(forceNumberOfConcurrentIOVs_);
82  }
83  } // namespace eventsetup
84 } // namespace edm
edm::eventsetup::heterocontainer::HCTypeTag::findType
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121
MessageLogger.h
EventSetupProvider.h
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2129
min
T min(T a, T b)
Definition: MathUtil.h:58
edm
HLT enums.
Definition: AlignableModifier.h:19
align_cfg.recordName
recordName
Definition: align_cfg.py:66
edm::LogInfo
Definition: MessageLogger.h:254
cms::cuda::assert
assert(be >=bs)
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:49
edm::eventsetup::EventSetupRecordKey::name
const char * name() const
Definition: EventSetupRecordKey.h:46
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
edm::ParameterSet
Definition: ParameterSet.h:36
edm::eventsetup::EventSetupProvider::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
Definition: EventSetupProvider.cc:651
edm::eventsetup::NumberOfConcurrentIOVs::readConfigurationParameters
void readConfigurationParameters(ParameterSet const *eventSetupPset)
Definition: NumberOfConcurrentIOVs.cc:19
edm::eventsetup::NumberOfConcurrentIOVs::recordsNotAllowingConcurrentIOVs_
std::set< EventSetupRecordKey > recordsNotAllowingConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:68
edm::eventsetup::NumberOfConcurrentIOVs::numberOfConcurrentIOVs
unsigned int numberOfConcurrentIOVs(EventSetupRecordKey const &, bool printInfoMsg=false) const
Definition: NumberOfConcurrentIOVs.cc:47
edm::eventsetup::NumberOfConcurrentIOVs::clear
void clear()
Definition: NumberOfConcurrentIOVs.cc:75
edm::eventsetup::NumberOfConcurrentIOVs::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(EventSetupProvider const &)
Definition: NumberOfConcurrentIOVs.cc:43
edm::eventsetup::swap
void swap(DataKey &a, DataKey &b)
Definition: DataKey.h:85
edm::eventsetup::NumberOfConcurrentIOVs::NumberOfConcurrentIOVs
NumberOfConcurrentIOVs()
Definition: NumberOfConcurrentIOVs.cc:17
Exception.h
edm::eventsetup::NumberOfConcurrentIOVs::setMaxConcurrentIOVs
void setMaxConcurrentIOVs(unsigned int nStreams, unsigned int nConcurrentLumis)
Definition: NumberOfConcurrentIOVs.cc:39
ParameterSet.h
edm::eventsetup::NumberOfConcurrentIOVs::maxConcurrentIOVs_
unsigned int maxConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:79
NumberOfConcurrentIOVs.h
edm::eventsetup::NumberOfConcurrentIOVs::numberConcurrentIOVs_
unsigned int numberConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:57
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::eventsetup::NumberOfConcurrentIOVs::forceNumberOfConcurrentIOVs_
std::vector< std::pair< EventSetupRecordKey, unsigned int > > forceNumberOfConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:77
HCTypeTag.h