CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
EcalGainRatiosGPU Class Reference

#include <EcalGainRatiosGPU.h>

Classes

struct  Product
 

Public Member Functions

 EcalGainRatiosGPU (EcalGainRatios const &)
 
Product const & getProduct (cudaStream_t) const
 
 ~EcalGainRatiosGPU ()=default
 

Static Public Member Functions

static std::string name ()
 

Private Attributes

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

Detailed Description

Definition at line 13 of file EcalGainRatiosGPU.h.

Constructor & Destructor Documentation

EcalGainRatiosGPU::EcalGainRatiosGPU ( EcalGainRatios const &  values)

Definition at line 6 of file EcalGainRatiosGPU.cc.

References EcalCondObjectContainer< T >::barrelItems(), EcalCondObjectContainer< T >::endcapItems(), gain12Over6_, gain6Over1_, mps_fire::i, and hltrates_dqm_sourceclient-live_cfg::offset.

7  : gain12Over6_(values.size()), gain6Over1_(values.size()) {
8  // fill in eb
9  auto const& barrelValues = values.barrelItems();
10  for (unsigned int i = 0; i < barrelValues.size(); i++) {
11  gain12Over6_[i] = barrelValues[i].gain12Over6();
12  gain6Over1_[i] = barrelValues[i].gain6Over1();
13  }
14 
15  // fill in ee
16  auto const& endcapValues = values.endcapItems();
17  auto const offset = barrelValues.size();
18  for (unsigned int i = 0; i < endcapValues.size(); i++) {
19  gain12Over6_[offset + i] = endcapValues[i].gain12Over6();
20  gain6Over1_[offset + i] = endcapValues[i].gain6Over1();
21  }
22 }
std::vector< float, cms::cuda::HostAllocator< float > > gain12Over6_
std::vector< float, cms::cuda::HostAllocator< float > > gain6Over1_
EcalGainRatiosGPU::~EcalGainRatiosGPU ( )
default

Member Function Documentation

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

Definition at line 24 of file EcalGainRatiosGPU.cc.

References cms::cuda::copyAsync(), EcalGainRatiosGPU::Product::gain12Over6, gain12Over6_, EcalGainRatiosGPU::Product::gain6Over1, gain6Over1_, and product_.

24  {
25  auto const& product = product_.dataForCurrentDeviceAsync(
26  cudaStream, [this](EcalGainRatiosGPU::Product& product, cudaStream_t cudaStream) {
27  // allocate
28  product.gain12Over6 = cms::cuda::make_device_unique<float[]>(gain12Over6_.size(), cudaStream);
29  product.gain6Over1 = cms::cuda::make_device_unique<float[]>(gain6Over1_.size(), cudaStream);
30  // transfer
31  cms::cuda::copyAsync(product.gain12Over6, gain12Over6_, cudaStream);
32  cms::cuda::copyAsync(product.gain6Over1, gain6Over1_, cudaStream);
33  });
34 
35  return product;
36 }
std::vector< float, cms::cuda::HostAllocator< float > > gain12Over6_
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 > > gain6Over1_
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain6Over1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain12Over6
static std::string EcalGainRatiosGPU::name ( )
inlinestatic

Member Data Documentation

std::vector<float, cms::cuda::HostAllocator<float> > EcalGainRatiosGPU::gain12Over6_
private

Definition at line 37 of file EcalGainRatiosGPU.h.

Referenced by EcalGainRatiosGPU(), and getProduct().

std::vector<float, cms::cuda::HostAllocator<float> > EcalGainRatiosGPU::gain6Over1_
private

Definition at line 38 of file EcalGainRatiosGPU.h.

Referenced by EcalGainRatiosGPU(), and getProduct().

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

Definition at line 40 of file EcalGainRatiosGPU.h.

Referenced by getProduct().