CMS 3D CMS Logo

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

#include <HcalGainsGPU.h>

Classes

struct  Product
 

Public Member Functions

Product const & getProduct (cudaStream_t) const
 
 HcalGainsGPU (HcalGains const &)
 
 ~HcalGainsGPU ()=default
 

Private Attributes

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

Detailed Description

Definition at line 13 of file HcalGainsGPU.h.

Constructor & Destructor Documentation

◆ HcalGainsGPU()

HcalGainsGPU::HcalGainsGPU ( HcalGains const &  gains)

Definition at line 7 of file HcalGainsGPU.cc.

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

References HcalCondObjectContainer< Item >::getAllContainers().

◆ ~HcalGainsGPU()

HcalGainsGPU::~HcalGainsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 33 of file HcalGainsGPU.cc.

33  {
34  auto const& product =
35  product_.dataForCurrentDeviceAsync(stream, [this](HcalGainsGPU::Product& product, cudaStream_t stream) {
36  // allocate
37  product.values = cms::cuda::make_device_unique<float[]>(values_.size(), stream);
38 
39  // transfer
41  });
42 
43  return product;
44 }

References cms::cuda::copyAsync(), product_, cms::cuda::stream, HcalGainsGPU::Product::values, and values_.

Referenced by HBHERecHitProducerGPU::acquire().

Member Data Documentation

◆ product_

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

Definition at line 33 of file HcalGainsGPU.h.

Referenced by getProduct().

◆ totalChannels_

uint64_t HcalGainsGPU::totalChannels_
private

Definition at line 30 of file HcalGainsGPU.h.

◆ values_

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

Definition at line 31 of file HcalGainsGPU.h.

Referenced by getProduct().

mps_fire.i
i
Definition: mps_fire.py:428
HcalGainsGPU::values_
std::vector< float, cms::cuda::HostAllocator< float > > values_
Definition: HcalGainsGPU.h:31
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
HcalGainsGPU::Product::values
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > values
Definition: HcalGainsGPU.h:16
HcalGainsGPU::Product
Definition: HcalGainsGPU.h:15
HcalGainsGPU::totalChannels_
uint64_t totalChannels_
Definition: HcalGainsGPU.h:30
HcalGainsGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: HcalGainsGPU.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
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20