CMS 3D CMS Logo

ensureAvailableAccelerators.cc
Go to the documentation of this file.
3 
4 #include <algorithm>
5 #include <vector>
6 
7 namespace edm {
9  auto const& selectedAccelerators =
10  parameterSet.getUntrackedParameter<std::vector<std::string>>("@selected_accelerators");
11  if (selectedAccelerators.empty()) {
13  ex << "The system has no compute accelerators that match the patterns specified in "
14  "process.options.accelerators:\n";
15  ParameterSet const& optionsPset(parameterSet.getUntrackedParameterSet("options"));
16  auto const& patterns = optionsPset.getUntrackedParameter<std::vector<std::string>>("accelerators");
17  for (auto const& pat : patterns) {
18  ex << " " << pat << "\n";
19  }
20  ex << "\nThe following compute accelerators are available:\n";
21  auto const& availableAccelerators =
22  parameterSet.getUntrackedParameter<std::vector<std::string>>("@available_accelerators");
23  for (auto const& acc : availableAccelerators) {
24  ex << " " << acc << "\n";
25  }
26 
27  throw ex;
28  }
29  }
30 } // namespace edm
void ensureAvailableAccelerators(edm::ParameterSet const &parameterSet)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
Definition: HeavyIon.h:7
T getUntrackedParameter(std::string const &, T const &) const
HLT enums.