CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
HcalPedestalsGPU Class Reference

#include <HcalPedestalsGPU.h>

Classes

struct  Product
 

Public Member Functions

const ProductgetProduct (cudaStream_t) const
 
 HcalPedestalsGPU (HcalPedestals const &)
 
uint32_t offsetForHashes () const
 
bool unitIsADC () const
 
 ~HcalPedestalsGPU ()=default
 

Private Attributes

uint32_t offsetForHashes_
 
cms::cuda::ESProduct< Productproduct_
 
uint64_t totalChannels_
 
bool unitIsADC_
 
std::vector< float, cms::cuda::HostAllocator< float > > values_
 
std::vector< float, cms::cuda::HostAllocator< float > > widths_
 

Detailed Description

Definition at line 13 of file HcalPedestalsGPU.h.

Constructor & Destructor Documentation

◆ HcalPedestalsGPU()

HcalPedestalsGPU::HcalPedestalsGPU ( HcalPedestals const &  pedestals)

Definition at line 7 of file HcalPedestalsGPU.cc.

8  : unitIsADC_{pedestals.isADC()},
9  totalChannels_{pedestals.getAllContainers()[0].second.size() + pedestals.getAllContainers()[1].second.size()},
10  offsetForHashes_{static_cast<uint32_t>(pedestals.getAllContainers()[0].second.size())},
12  widths_(totalChannels_ * 4) {
13 #ifdef HCAL_MAHI_CPUDEBUG
14  std::cout << "unitIsADC = " << unitIsADC_ << std::endl;
15 #endif
16 
17  auto const containers = pedestals.getAllContainers();
18 
19  // fill in eb
20  auto const& barrelValues = containers[0].second;
21  for (uint64_t i = 0; i < barrelValues.size(); ++i) {
22  values_[i * 4] = barrelValues[i].getValue(0);
23  values_[i * 4 + 1] = barrelValues[i].getValue(1);
24  values_[i * 4 + 2] = barrelValues[i].getValue(2);
25  values_[i * 4 + 3] = barrelValues[i].getValue(3);
26 
27  widths_[i * 4] = barrelValues[i].getWidth(0);
28  widths_[i * 4 + 1] = barrelValues[i].getWidth(1);
29  widths_[i * 4 + 2] = barrelValues[i].getWidth(2);
30  widths_[i * 4 + 3] = barrelValues[i].getWidth(3);
31  }
32 
33  // fill in ee
34  auto const& endcapValues = containers[1].second;
35  auto const offset = barrelValues.size();
36  for (uint64_t i = 0; i < endcapValues.size(); ++i) {
37  auto const off = offset + i;
38  values_[off * 4] = endcapValues[i].getValue(0);
39  values_[off * 4 + 1] = endcapValues[i].getValue(1);
40  values_[off * 4 + 2] = endcapValues[i].getValue(2);
41  values_[off * 4 + 3] = endcapValues[i].getValue(3);
42 
43  widths_[off * 4] = endcapValues[i].getWidth(0);
44  widths_[off * 4 + 1] = endcapValues[i].getWidth(1);
45  widths_[off * 4 + 2] = endcapValues[i].getWidth(2);
46  widths_[off * 4 + 3] = endcapValues[i].getWidth(3);
47  }
48 }

References HcalPedestals::isADC().

◆ ~HcalPedestalsGPU()

HcalPedestalsGPU::~HcalPedestalsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 50 of file HcalPedestalsGPU.cc.

50  {
51  auto const& product =
52  product_.dataForCurrentDeviceAsync(stream, [this](HcalPedestalsGPU::Product& product, cudaStream_t stream) {
53  // allocate
54  product.values = cms::cuda::make_device_unique<float[]>(values_.size(), stream);
55  product.widths = cms::cuda::make_device_unique<float[]>(widths_.size(), stream);
56 
57  // transfer
60  });
61 
62  return product;
63 }

References cms::cuda::copyAsync(), product_, cms::cuda::stream, HcalPedestalsGPU::Product::values, values_, HcalPedestalsGPU::Product::widths, and widths_.

◆ offsetForHashes()

uint32_t HcalPedestalsGPU::offsetForHashes ( ) const
inline

Definition at line 33 of file HcalPedestalsGPU.h.

33 { return offsetForHashes_; }

References offsetForHashes_.

◆ unitIsADC()

bool HcalPedestalsGPU::unitIsADC ( ) const
inline

Definition at line 31 of file HcalPedestalsGPU.h.

31 { return unitIsADC_; }

References unitIsADC_.

Member Data Documentation

◆ offsetForHashes_

uint32_t HcalPedestalsGPU::offsetForHashes_
private

Definition at line 38 of file HcalPedestalsGPU.h.

Referenced by offsetForHashes().

◆ product_

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

Definition at line 42 of file HcalPedestalsGPU.h.

Referenced by getProduct().

◆ totalChannels_

uint64_t HcalPedestalsGPU::totalChannels_
private

Definition at line 37 of file HcalPedestalsGPU.h.

◆ unitIsADC_

bool HcalPedestalsGPU::unitIsADC_
private

Definition at line 36 of file HcalPedestalsGPU.h.

Referenced by unitIsADC().

◆ values_

std::vector<float, cms::cuda::HostAllocator<float> > HcalPedestalsGPU::values_
private

Definition at line 39 of file HcalPedestalsGPU.h.

Referenced by getProduct().

◆ widths_

std::vector<float, cms::cuda::HostAllocator<float> > HcalPedestalsGPU::widths_
private

Definition at line 40 of file HcalPedestalsGPU.h.

Referenced by getProduct().

mps_fire.i
i
Definition: mps_fire.py:428
HcalPedestalsGPU::values_
std::vector< float, cms::cuda::HostAllocator< float > > values_
Definition: HcalPedestalsGPU.h:39
HcalPedestalsGPU::widths_
std::vector< float, cms::cuda::HostAllocator< float > > widths_
Definition: HcalPedestalsGPU.h:40
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
HcalPedestalsGPU::Product::widths
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > widths
Definition: HcalPedestalsGPU.h:17
HcalPedestalsGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: HcalPedestalsGPU.h:42
HcalPedestalsGPU::unitIsADC_
bool unitIsADC_
Definition: HcalPedestalsGPU.h:36
HcalPedestalsGPU::Product::values
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > values
Definition: HcalPedestalsGPU.h:16
HcalPedestalsGPU::Product
Definition: HcalPedestalsGPU.h:15
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
HcalPedestalsGPU::totalChannels_
uint64_t totalChannels_
Definition: HcalPedestalsGPU.h:37
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
HcalPedestalsGPU::offsetForHashes_
uint32_t offsetForHashes_
Definition: HcalPedestalsGPU.h:38
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20