CMS 3D CMS Logo

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

#include <HcalRespCorrsGPU.h>

Classes

struct  Product
 

Public Member Functions

Product const & getProduct (cudaStream_t) const
 
 HcalRespCorrsGPU (HcalRespCorrs const &)
 
 ~HcalRespCorrsGPU ()=default
 

Private Attributes

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

Detailed Description

Definition at line 13 of file HcalRespCorrsGPU.h.

Constructor & Destructor Documentation

◆ HcalRespCorrsGPU()

HcalRespCorrsGPU::HcalRespCorrsGPU ( HcalRespCorrs const &  respcorrs)

Definition at line 7 of file HcalRespCorrsGPU.cc.

References HcalCondObjectContainer< Item >::getAllContainers(), mps_fire::i, hltrates_dqm_sourceclient-live_cfg::offset, and values_.

8  : values_(respcorrs.getAllContainers()[0].second.size() + respcorrs.getAllContainers()[1].second.size()) {
9  auto const containers = respcorrs.getAllContainers();
10 
11  // fill in eb
12  auto const& barrelValues = containers[0].second;
13  for (uint64_t i = 0; i < barrelValues.size(); ++i) {
14  values_[i] = barrelValues[i].getValue();
15  }
16 
17  // fill in ee
18  auto const& endcapValues = containers[1].second;
19  auto const offset = barrelValues.size();
20  for (uint64_t i = 0; i < endcapValues.size(); ++i) {
21  values_[i + offset] = endcapValues[i].getValue();
22  }
23 }
unsigned long long uint64_t
Definition: Time.h:13
std::vector< float, cms::cuda::HostAllocator< float > > values_

◆ ~HcalRespCorrsGPU()

HcalRespCorrsGPU::~HcalRespCorrsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 25 of file HcalRespCorrsGPU.cc.

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

25  {
26  auto const& product =
27  product_.dataForCurrentDeviceAsync(stream, [this](HcalRespCorrsGPU::Product& product, cudaStream_t stream) {
28  // allocate
29  product.values = cms::cuda::make_device_unique<float[]>(values_.size(), stream);
30 
31  // transfer
33  });
34 
35  return product;
36 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > values
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
std::vector< float, cms::cuda::HostAllocator< float > > values_

Member Data Documentation

◆ product_

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

Definition at line 32 of file HcalRespCorrsGPU.h.

Referenced by getProduct().

◆ values_

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

Definition at line 30 of file HcalRespCorrsGPU.h.

Referenced by getProduct(), and HcalRespCorrsGPU().