CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HcalQIECodersGPU.cc
Go to the documentation of this file.
4 
6  : totalChannels_{qiedata.getAllContainers()[0].second.size() + qiedata.getAllContainers()[1].second.size()},
7  offsets_(totalChannels_ * numValuesPerChannel),
8  slopes_(totalChannels_ * numValuesPerChannel) {
9  auto const containers = qiedata.getAllContainers();
10 
11  // fill in hb
12  auto const& barrelValues = containers[0].second;
13  for (uint64_t i = 0; i < barrelValues.size(); ++i) {
14  for (uint32_t k = 0; k < 4; k++)
15  for (uint32_t l = 0; l < 4; l++) {
16  auto const linear = k * 4 + l;
17  offsets_[i * numValuesPerChannel + linear] = barrelValues[i].offset(k, l);
18  slopes_[i * numValuesPerChannel + linear] = barrelValues[i].slope(k, l);
19  }
20  }
21 
22  // fill in he
23  auto const& endcapValues = containers[1].second;
24  auto const offset = barrelValues.size();
25  for (uint64_t i = 0; i < endcapValues.size(); ++i) {
26  auto const off = (i + offset) * numValuesPerChannel;
27  for (uint32_t k = 0; k < 4; k++)
28  for (uint32_t l = 0; l < 4; l++) {
29  auto const linear = k * 4u + l;
30  offsets_[off + linear] = endcapValues[i].offset(k, l);
31  slopes_[off + linear] = endcapValues[i].slope(k, l);
32  }
33  }
34 }
35 
37  auto const& product =
38  product_.dataForCurrentDeviceAsync(stream, [this](HcalQIECodersGPU::Product& product, cudaStream_t stream) {
39  // allocate
40  product.offsets = cms::cuda::make_device_unique<float[]>(offsets_.size(), stream);
41  product.slopes = cms::cuda::make_device_unique<float[]>(slopes_.size(), stream);
42 
43  // transfer
46  });
47 
48  return product;
49 }
50 
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > offsets
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< float, cms::cuda::HostAllocator< float > > offsets_
Product const & getProduct(cudaStream_t) const
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > slopes
const tAllContWithNames getAllContainers() const
cms::cuda::ESProduct< Product > product_
unsigned long long uint64_t
Definition: Time.h:13
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
HcalQIECodersGPU(HcalQIEData const &)
std::vector< float, cms::cuda::HostAllocator< float > > slopes_
float linear(float x)