CMS 3D CMS Logo

EcalGainRatiosGPU.cc
Go to the documentation of this file.
2 
5 
7  : gain12Over6_(values.size()), gain6Over1_(values.size()) {
8  // fill in eb
9  auto const& barrelValues = values.barrelItems();
10  for (unsigned int i = 0; i < barrelValues.size(); i++) {
11  gain12Over6_[i] = barrelValues[i].gain12Over6();
12  gain6Over1_[i] = barrelValues[i].gain6Over1();
13  }
14 
15  // fill in ee
16  auto const& endcapValues = values.endcapItems();
17  auto const offset = barrelValues.size();
18  for (unsigned int i = 0; i < endcapValues.size(); i++) {
19  gain12Over6_[offset + i] = endcapValues[i].gain12Over6();
20  gain6Over1_[offset + i] = endcapValues[i].gain6Over1();
21  }
22 }
23 
24 EcalGainRatiosGPU::Product const& EcalGainRatiosGPU::getProduct(cudaStream_t cudaStream) const {
25  auto const& product = product_.dataForCurrentDeviceAsync(
26  cudaStream, [this](EcalGainRatiosGPU::Product& product, cudaStream_t cudaStream) {
27  // allocate
28  product.gain12Over6 = cms::cuda::make_device_unique<float[]>(gain12Over6_.size(), cudaStream);
29  product.gain6Over1 = cms::cuda::make_device_unique<float[]>(gain6Over1_.size(), cudaStream);
30  // transfer
31  cms::cuda::copyAsync(product.gain12Over6, gain12Over6_, cudaStream);
32  cms::cuda::copyAsync(product.gain6Over1, gain6Over1_, cudaStream);
33  });
34 
35  return product;
36 }
37 
size
Write out results.
std::vector< float, cms::cuda::HostAllocator< float > > gain12Over6_
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
std::vector< float, cms::cuda::HostAllocator< float > > gain6Over1_
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
Product const & getProduct(cudaStream_t) const
EcalGainRatiosGPU(EcalGainRatios const &)
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain6Over1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain12Over6