CMS 3D CMS Logo

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

#include <HcalGainWidthsGPU.h>

Classes

struct  Product
 

Public Member Functions

const ProductgetProduct (cudaStream_t) const
 
 HcalGainWidthsGPU (HcalGainWidths const &)
 
 ~HcalGainWidthsGPU ()=default
 

Private Attributes

cms::cuda::ESProduct< Productproduct_
 
uint64_t totalChannels_
 
std::vector< float, cms::cuda::HostAllocator< float > > value0_
 
std::vector< float, cms::cuda::HostAllocator< float > > value1_
 
std::vector< float, cms::cuda::HostAllocator< float > > value2_
 
std::vector< float, cms::cuda::HostAllocator< float > > value3_
 

Detailed Description

Definition at line 13 of file HcalGainWidthsGPU.h.

Constructor & Destructor Documentation

◆ HcalGainWidthsGPU()

HcalGainWidthsGPU::HcalGainWidthsGPU ( HcalGainWidths const &  gains)

Definition at line 7 of file HcalGainWidthsGPU.cc.

8  : totalChannels_{gains.getAllContainers()[0].second.size() + gains.getAllContainers()[1].second.size()},
13  auto const gainContainers = gains.getAllContainers();
14 
15  // fill in eb
16  auto const& barrelValues = gainContainers[0].second;
17  for (uint64_t i = 0; i < barrelValues.size(); ++i) {
18  value0_[i] = barrelValues[i].getValue(0);
19  value1_[i] = barrelValues[i].getValue(1);
20  value2_[i] = barrelValues[i].getValue(2);
21  value3_[i] = barrelValues[i].getValue(3);
22  }
23 
24  // fill in ee
25  auto const& endcapValues = gainContainers[1].second;
26  auto const offset = barrelValues.size();
27  for (uint64_t i = 0; i < endcapValues.size(); ++i) {
28  value0_[i + offset] = endcapValues[i].getValue(0);
29  value1_[i + offset] = endcapValues[i].getValue(1);
30  value2_[i + offset] = endcapValues[i].getValue(2);
31  value3_[i + offset] = endcapValues[i].getValue(3);
32  }
33 }

References HcalCondObjectContainer< Item >::getAllContainers().

◆ ~HcalGainWidthsGPU()

HcalGainWidthsGPU::~HcalGainWidthsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 35 of file HcalGainWidthsGPU.cc.

35  {
36  auto const& product =
37  product_.dataForCurrentDeviceAsync(stream, [this](HcalGainWidthsGPU::Product& product, cudaStream_t stream) {
38  // allocate
39  product.value0 = cms::cuda::make_device_unique<float[]>(value0_.size(), stream);
40  product.value1 = cms::cuda::make_device_unique<float[]>(value1_.size(), stream);
41  product.value2 = cms::cuda::make_device_unique<float[]>(value2_.size(), stream);
42  product.value3 = cms::cuda::make_device_unique<float[]>(value3_.size(), stream);
43 
44  // transfer
49  });
50 
51  return product;
52 }

References cms::cuda::copyAsync(), product_, cms::cuda::stream, HcalGainWidthsGPU::Product::value0, value0_, HcalGainWidthsGPU::Product::value1, value1_, HcalGainWidthsGPU::Product::value2, value2_, HcalGainWidthsGPU::Product::value3, and value3_.

Referenced by HBHERecHitProducerGPU::acquire().

Member Data Documentation

◆ product_

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

Definition at line 36 of file HcalGainWidthsGPU.h.

Referenced by getProduct().

◆ totalChannels_

uint64_t HcalGainWidthsGPU::totalChannels_
private

Definition at line 33 of file HcalGainWidthsGPU.h.

◆ value0_

std::vector<float, cms::cuda::HostAllocator<float> > HcalGainWidthsGPU::value0_
private

Definition at line 34 of file HcalGainWidthsGPU.h.

Referenced by getProduct().

◆ value1_

std::vector<float, cms::cuda::HostAllocator<float> > HcalGainWidthsGPU::value1_
private

Definition at line 34 of file HcalGainWidthsGPU.h.

Referenced by getProduct().

◆ value2_

std::vector<float, cms::cuda::HostAllocator<float> > HcalGainWidthsGPU::value2_
private

Definition at line 34 of file HcalGainWidthsGPU.h.

Referenced by getProduct().

◆ value3_

std::vector<float, cms::cuda::HostAllocator<float> > HcalGainWidthsGPU::value3_
private

Definition at line 34 of file HcalGainWidthsGPU.h.

Referenced by getProduct().

HcalGainWidthsGPU::value2_
std::vector< float, cms::cuda::HostAllocator< float > > value2_
Definition: HcalGainWidthsGPU.h:34
mps_fire.i
i
Definition: mps_fire.py:428
HcalGainWidthsGPU::Product::value0
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > value0
Definition: HcalGainWidthsGPU.h:16
HcalGainWidthsGPU::Product
Definition: HcalGainWidthsGPU.h:15
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
HcalGainWidthsGPU::value1_
std::vector< float, cms::cuda::HostAllocator< float > > value1_
Definition: HcalGainWidthsGPU.h:34
HcalGainWidthsGPU::Product::value1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > value1
Definition: HcalGainWidthsGPU.h:17
HcalGainWidthsGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: HcalGainWidthsGPU.h:36
HcalGainWidthsGPU::value3_
std::vector< float, cms::cuda::HostAllocator< float > > value3_
Definition: HcalGainWidthsGPU.h:34
HcalGainWidthsGPU::Product::value2
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > value2
Definition: HcalGainWidthsGPU.h:18
HcalGainWidthsGPU::Product::value3
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > value3
Definition: HcalGainWidthsGPU.h:19
HcalGainWidthsGPU::totalChannels_
uint64_t totalChannels_
Definition: HcalGainWidthsGPU.h:33
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
HcalGainWidthsGPU::value0_
std::vector< float, cms::cuda::HostAllocator< float > > value0_
Definition: HcalGainWidthsGPU.h:34
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20