CMS 3D CMS Logo

module_backend_config.cc
Go to the documentation of this file.
4 
5 namespace {
6  const std::string kPSetName("alpaka");
7  const char* const kComment =
8  "PSet allows to override the Alpaka backend per module instance. Has an effect only when the module class name "
9  "has '@alpaka' suffix, i.e. has no effect when the Alpaka backend namespace is used explicitly.";
10 } // namespace
11 
12 namespace cms::alpakatools {
14  // the code below leads to 'alpaka = untracked.PSet(backend = untracked.string)' to be added to the generated cfi files
15  // TODO: I don't know if this is a desired behavior for HLT
17  descAlpaka.addUntracked<std::string>("backend", "")
18  ->setComment(
19  "Alpaka backend for this module. Can be empty string (for the global default), 'serial_sync', or "
20  " - depending on the architecture and available hardware - 'cuda_async', 'rocm_async'");
21 
22  if (iDesc.defaultDescription()) {
23  if (iDesc.defaultDescription()->isLabelUnused(kPSetName)) {
24  iDesc.defaultDescription()
25  ->addUntracked<edm::ParameterSetDescription>(kPSetName, descAlpaka)
26  ->setComment(kComment);
27  }
28  }
29  for (auto& v : iDesc) {
30  if (v.second.isLabelUnused(kPSetName)) {
31  v.second.addUntracked<edm::ParameterSetDescription>(kPSetName, descAlpaka)->setComment(kComment);
32  }
33  }
34  }
35 } // namespace cms::alpakatools
bool isLabelUnused(std::string const &label) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void module_backend_config(edm::ConfigurationDescriptions &iDesc)
ParameterSetDescription * defaultDescription()
Returns 0 if no default has been assigned.
static const char *const kComment