CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Classes | Public Member Functions | Static Public Attributes | Private Attributes
HcalQIECodersGPU Class Reference

#include <HcalQIECodersGPU.h>

Classes

struct  Product
 

Public Member Functions

Product const & getProduct (cudaStream_t) const
 
 HcalQIECodersGPU (HcalQIEData const &)
 
 ~HcalQIECodersGPU ()=default
 

Static Public Attributes

static constexpr uint32_t numValuesPerChannel = 16
 

Private Attributes

std::vector< float, cms::cuda::HostAllocator< float > > offsets_
 
cms::cuda::ESProduct< Productproduct_
 
std::vector< float, cms::cuda::HostAllocator< float > > slopes_
 
uint64_t totalChannels_
 

Detailed Description

Definition at line 13 of file HcalQIECodersGPU.h.

Constructor & Destructor Documentation

◆ HcalQIECodersGPU()

HcalQIECodersGPU::HcalQIECodersGPU ( HcalQIEData const &  qiedata)

Definition at line 5 of file HcalQIECodersGPU.cc.

References HcalCondObjectContainer< Item >::getAllContainers().

6  : totalChannels_{qiedata.getAllContainers()[0].second.size() + qiedata.getAllContainers()[1].second.size()},
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 }
static constexpr uint32_t numValuesPerChannel
std::vector< float, cms::cuda::HostAllocator< float > > offsets_
unsigned long long uint64_t
Definition: Time.h:13
std::vector< float, cms::cuda::HostAllocator< float > > slopes_
float linear(float x)

◆ ~HcalQIECodersGPU()

HcalQIECodersGPU::~HcalQIECodersGPU ( )
default

Member Function Documentation

◆ getProduct()

HcalQIECodersGPU::Product const & HcalQIECodersGPU::getProduct ( cudaStream_t  stream) const

Definition at line 36 of file HcalQIECodersGPU.cc.

References cms::cuda::copyAsync(), HcalQIECodersGPU::Product::offsets, offsets_, product_, HcalQIECodersGPU::Product::slopes, slopes_, and cms::cuda::stream.

36  {
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 }
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_
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
cms::cuda::ESProduct< Product > product_
std::vector< float, cms::cuda::HostAllocator< float > > slopes_

Member Data Documentation

◆ numValuesPerChannel

constexpr uint32_t HcalQIECodersGPU::numValuesPerChannel = 16
static

Definition at line 15 of file HcalQIECodersGPU.h.

◆ offsets_

std::vector<float, cms::cuda::HostAllocator<float> > HcalQIECodersGPU::offsets_
private

Definition at line 34 of file HcalQIECodersGPU.h.

Referenced by getProduct().

◆ product_

cms::cuda::ESProduct<Product> HcalQIECodersGPU::product_
private

Definition at line 37 of file HcalQIECodersGPU.h.

Referenced by getProduct().

◆ slopes_

std::vector<float, cms::cuda::HostAllocator<float> > HcalQIECodersGPU::slopes_
private

Definition at line 35 of file HcalQIECodersGPU.h.

Referenced by getProduct().

◆ totalChannels_

uint64_t HcalQIECodersGPU::totalChannels_
private

Definition at line 33 of file HcalQIECodersGPU.h.