CMS 3D CMS Logo

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

#include <EcalPulseCovariancesGPU.h>

Classes

struct  Product
 

Public Member Functions

 EcalPulseCovariancesGPU (EcalPulseCovariances const &)
 
Product const & getProduct (cudaStream_t) const
 
 ~EcalPulseCovariancesGPU ()=default
 

Static Public Member Functions

static std::string name ()
 

Private Attributes

cms::cuda::ESProduct< Productproduct_
 
std::vector< EcalPulseCovariance > const & valuesEB_
 
std::vector< EcalPulseCovariance > const & valuesEE_
 

Detailed Description

Definition at line 11 of file EcalPulseCovariancesGPU.h.

Constructor & Destructor Documentation

◆ EcalPulseCovariancesGPU()

EcalPulseCovariancesGPU::EcalPulseCovariancesGPU ( EcalPulseCovariances const &  values)

Definition at line 6 of file EcalPulseCovariancesGPU.cc.

References contentValuesCheck::values.

7  : valuesEB_{values.barrelItems()}, valuesEE_{values.endcapItems()} {}
std::vector< EcalPulseCovariance > const & valuesEB_
std::vector< EcalPulseCovariance > const & valuesEE_

◆ ~EcalPulseCovariancesGPU()

EcalPulseCovariancesGPU::~EcalPulseCovariancesGPU ( )
default

Member Function Documentation

◆ getProduct()

EcalPulseCovariancesGPU::Product const & EcalPulseCovariancesGPU::getProduct ( cudaStream_t  cudaStream) const

Definition at line 14 of file EcalPulseCovariancesGPU.cc.

References cudaCheck, HLT_IsoTrack_cff::offset, product_, EcalPulseCovariancesGPU::Product::values, valuesEB_, and valuesEE_.

14  {
15  auto const& product = product_.dataForCurrentDeviceAsync(
16  cudaStream, [this](EcalPulseCovariancesGPU::Product& product, cudaStream_t cudaStream) {
17  // malloc
18  cudaCheck(cudaMalloc((void**)&product.values,
19  (this->valuesEE_.size() + this->valuesEB_.size()) * sizeof(EcalPulseCovariance)));
20 
21  // offset in terms of sizeof(EcalPulseCovariance)
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(EcalPulseCovariance),
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(EcalPulseCovariance),
35  cudaMemcpyHostToDevice,
36  cudaStream));
37  });
38 
39  return product;
40 }
std::vector< EcalPulseCovariance > const & valuesEB_
cms::cuda::ESProduct< Product > product_
std::vector< EcalPulseCovariance > const & valuesEE_
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69

◆ name()

static std::string EcalPulseCovariancesGPU::name ( )
inlinestatic

Member Data Documentation

◆ product_

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

Definition at line 36 of file EcalPulseCovariancesGPU.h.

Referenced by getProduct().

◆ valuesEB_

std::vector<EcalPulseCovariance> const& EcalPulseCovariancesGPU::valuesEB_
private

Definition at line 33 of file EcalPulseCovariancesGPU.h.

Referenced by getProduct().

◆ valuesEE_

std::vector<EcalPulseCovariance> const& EcalPulseCovariancesGPU::valuesEE_
private

Definition at line 34 of file EcalPulseCovariancesGPU.h.

Referenced by getProduct().