CMS 3D CMS Logo

TestAlpakaESProducerE.cc
Go to the documentation of this file.
11 
12 #include <cmath>
13 
22  public:
23  TestAlpakaESProducerE(edm::ParameterSet const& iConfig) : ESProducer(iConfig) {
24  auto cc = setWhatProduced(this);
25  token_ = cc.consumes();
26  }
27 
28  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
30  descriptions.addWithDefaultLabel(desc);
31  }
32 
33  std::optional<AlpakaESTestDataEHost> produce(AlpakaESTestRecordC const& iRecord) {
34  auto const& input = iRecord.get(token_);
35 
36  int const edatasize = 2;
38  for (int i = 0; i < edatasize; ++i) {
39  data.view()[i].val2() = i * 10 + 1;
40  }
41 
42  int const esize = 5;
43  // TODO: pinned allocation?
44  // TODO: cached allocation?
46  for (int i = 0; i < esize; ++i) {
47  e.view()[i].val() = std::abs(input.value()) + i * 2;
48  e.view()[i].ind() = i % edatasize;
49  }
51  }
52 
53  private:
55  };
56 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
57 
58 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(TestAlpakaESProducerE);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
edm::ESGetToken< cms::alpakatest::ESTestDataC, AlpakaESTestRecordC > token_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
PortableCollection< AlpakaESTestSoAE, TDev > ECollection
static std::string const input
Definition: EdmProvDump.cc:50
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PortableCollection< AlpakaESTestSoAEData, TDev > EDataCollection
alpaka::DevCpu const & host()
Definition: host.h:14
std::optional< AlpakaESTestDataEHost > produce(AlpakaESTestRecordC const &iRecord)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17
cms::alpakatest::AlpakaESTestDataEHost AlpakaESTestDataEHost
def move(src, dest)
Definition: eostools.py:511
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)