CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TestAlpakaESProducerAMulti.cc
Go to the documentation of this file.
12 
21  public:
23  auto cc = setWhatProduced(this);
24  token_ = cc.consumes();
25  }
26 
27  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
29  descriptions.addWithDefaultLabel(desc);
30  }
31 
32  std::optional<AlpakaESTestDataACMultiHost> produce(AlpakaESTestRecordA const& iRecord) {
33  auto const& input = iRecord.get(token_);
34 
35  int const sizeA = 10;
36  int const sizeC = 100;
37  // TODO: pinned allocation?
38  // TODO: cached allocation?
39  AlpakaESTestDataACMultiHost product({{sizeA, sizeC}}, cms::alpakatools::host());
40  auto viewA = product.view<
41  cms::alpakatest::AlpakaESTestSoAA>(); // this template is not really needed as this is fhe first layout
42  auto viewC = product.view<cms::alpakatest::AlpakaESTestSoAC>();
43 
44  for (int i = 0; i < sizeA; ++i) {
45  viewA[i].z() = input.value() - i;
46  }
47 
48  for (int i = 0; i < sizeC; ++i) {
49  viewC[i].x() = input.value() + i;
50  }
51 
52  return product;
53  }
54 
55  private:
57  };
58 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
59 
60 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(TestAlpakaESProducerAMulti);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static std::string const input
Definition: EdmProvDump.cc:50
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
alpaka::DevCpu const & host()
Definition: host.h:14
edm::ESGetToken< cms::alpakatest::ESTestDataA, AlpakaESTestRecordA > token_
std::optional< AlpakaESTestDataACMultiHost > produce(AlpakaESTestRecordA const &iRecord)
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17