CMS 3D CMS Logo

EcalPulseShapesGPU.cc
Go to the documentation of this file.
2 
5 
7  : valuesEB_{values.barrelItems()}, valuesEE_{values.endcapItems()} {}
8 
10  // deallocation
11  cudaCheck(cudaFree(values));
12 }
13 
14 EcalPulseShapesGPU::Product const& EcalPulseShapesGPU::getProduct(cudaStream_t cudaStream) const {
15  auto const& product = product_.dataForCurrentDeviceAsync(
16  cudaStream, [this](EcalPulseShapesGPU::Product& product, cudaStream_t cudaStream) {
17  // malloc
18  cudaCheck(cudaMalloc((void**)&product.values,
19  (this->valuesEE_.size() + this->valuesEB_.size()) * sizeof(EcalPulseShape)));
20 
21  // offset in terms of sizeof(EcalPulseShape) - plain c array
22  uint32_t offset = this->valuesEB_.size();
23 
24  // transfer eb
25  cudaCheck(cudaMemcpyAsync(product.values,
26  this->valuesEB_.data(),
27  this->valuesEB_.size() * sizeof(EcalPulseShape),
28  cudaMemcpyHostToDevice,
29  cudaStream));
30 
31  // transfer ee starting at values + offset
32  cudaCheck(cudaMemcpyAsync(product.values + offset,
33  this->valuesEE_.data(),
34  this->valuesEE_.size() * sizeof(EcalPulseShape),
35  cudaMemcpyHostToDevice,
36  cudaStream));
37  });
38 
39  return product;
40 }
41 
EcalPulseShape
Definition: EcalPulseShapes.h:8
EcalPulseShapesGPU::Product::~Product
~Product()
Definition: EcalPulseShapesGPU.cc:9
EcalPulseShapesGPU::valuesEE_
std::vector< EcalPulseShape > const & valuesEE_
Definition: EcalPulseShapesGPU.h:34
EcalPulseShapesGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: EcalPulseShapesGPU.h:36
typelookup.h
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalPulseShapesGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalPulseShapesGPU.cc:14
EcalPulseShapesGPU::EcalPulseShapesGPU
EcalPulseShapesGPU(EcalPulseShapes const &)
Definition: EcalPulseShapesGPU.cc:6
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
EcalPulseShapesGPU
Definition: EcalPulseShapesGPU.h:11
EcalPulseShapesGPU::valuesEB_
std::vector< EcalPulseShape > const & valuesEB_
Definition: EcalPulseShapesGPU.h:33
EcalPulseShapesGPU::Product
Definition: EcalPulseShapesGPU.h:13
cudaCheck.h
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:62
EcalPulseShapesGPU::Product::values
EcalPulseShape * values
Definition: EcalPulseShapesGPU.h:15
EcalPulseShapesGPU.h
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82