CMS 3D CMS Logo

EcalPedestalsGPU.cc
Go to the documentation of this file.
2 
5 
7  : mean_x12_(pedestals.size()),
8  rms_x12_(pedestals.size()),
9  mean_x6_(pedestals.size()),
10  rms_x6_(pedestals.size()),
11  mean_x1_(pedestals.size()),
12  rms_x1_(pedestals.size()) {
13  // fill in eb
14  auto const& barrelValues = pedestals.barrelItems();
15  for (unsigned int i = 0; i < barrelValues.size(); i++) {
16  mean_x12_[i] = barrelValues[i].mean_x12;
17  rms_x12_[i] = barrelValues[i].rms_x12;
18  mean_x6_[i] = barrelValues[i].mean_x6;
19  rms_x6_[i] = barrelValues[i].rms_x6;
20  mean_x1_[i] = barrelValues[i].mean_x1;
21  rms_x1_[i] = barrelValues[i].rms_x1;
22  }
23 
24  // fill in ee
25  auto const& endcapValues = pedestals.endcapItems();
26  auto const offset = barrelValues.size();
27  for (unsigned int i = 0; i < endcapValues.size(); i++) {
28  mean_x12_[offset + i] = endcapValues[i].mean_x12;
29  rms_x12_[offset + i] = endcapValues[i].rms_x12;
30  mean_x6_[offset + i] = endcapValues[i].mean_x6;
31  rms_x6_[offset + i] = endcapValues[i].rms_x6;
32  mean_x1_[offset + i] = endcapValues[i].mean_x1;
33  rms_x1_[offset + i] = endcapValues[i].rms_x1;
34  }
35 }
36 
37 EcalPedestalsGPU::Product const& EcalPedestalsGPU::getProduct(cudaStream_t cudaStream) const {
38  auto const& product = product_.dataForCurrentDeviceAsync(
39  cudaStream, [this](EcalPedestalsGPU::Product& product, cudaStream_t cudaStream) {
40  // allocate
41  product.mean_x12 = cms::cuda::make_device_unique<float[]>(mean_x12_.size(), cudaStream);
42  product.mean_x6 = cms::cuda::make_device_unique<float[]>(mean_x6_.size(), cudaStream);
43  product.mean_x1 = cms::cuda::make_device_unique<float[]>(mean_x1_.size(), cudaStream);
44  product.rms_x12 = cms::cuda::make_device_unique<float[]>(rms_x12_.size(), cudaStream);
45  product.rms_x6 = cms::cuda::make_device_unique<float[]>(rms_x6_.size(), cudaStream);
46  product.rms_x1 = cms::cuda::make_device_unique<float[]>(rms_x1_.size(), cudaStream);
47  // transfer
48  cms::cuda::copyAsync(product.mean_x12, mean_x12_, cudaStream);
49  cms::cuda::copyAsync(product.mean_x6, mean_x6_, cudaStream);
50  cms::cuda::copyAsync(product.mean_x1, mean_x1_, cudaStream);
51  cms::cuda::copyAsync(product.rms_x12, rms_x12_, cudaStream);
52  cms::cuda::copyAsync(product.rms_x6, rms_x6_, cudaStream);
53  cms::cuda::copyAsync(product.rms_x1, rms_x1_, cudaStream);
54  });
55 
56  return product;
57 }
58 
size
Write out results.
Product const & getProduct(cudaStream_t) const
std::vector< float, cms::cuda::HostAllocator< float > > mean_x1_
const Items & endcapItems() const
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x1
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 > > rms_x12_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x12_
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x6
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x12
std::vector< float, cms::cuda::HostAllocator< float > > rms_x1_
const Items & barrelItems() const
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x12
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x6
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
EcalPedestalsGPU(EcalPedestals const &)
std::vector< float, cms::cuda::HostAllocator< float > > rms_x6_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x6_