CMS 3D CMS Logo

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

#include <EcalPedestalsGPU.h>

Classes

struct  Product
 

Public Member Functions

 EcalPedestalsGPU (EcalPedestals const &)
 
Product const & getProduct (cudaStream_t) const
 
 ~EcalPedestalsGPU ()=default
 

Static Public Member Functions

static std::string name ()
 

Private Attributes

std::vector< float, cms::cuda::HostAllocator< float > > mean_x12_
 
std::vector< float, cms::cuda::HostAllocator< float > > mean_x1_
 
std::vector< float, cms::cuda::HostAllocator< float > > mean_x6_
 
cms::cuda::ESProduct< Productproduct_
 
std::vector< float, cms::cuda::HostAllocator< float > > rms_x12_
 
std::vector< float, cms::cuda::HostAllocator< float > > rms_x1_
 
std::vector< float, cms::cuda::HostAllocator< float > > rms_x6_
 

Detailed Description

Definition at line 13 of file EcalPedestalsGPU.h.

Constructor & Destructor Documentation

◆ EcalPedestalsGPU()

EcalPedestalsGPU::EcalPedestalsGPU ( EcalPedestals const &  pedestals)

Definition at line 6 of file EcalPedestalsGPU.cc.

References EcalCondObjectContainer< T >::barrelItems(), EcalCondObjectContainer< T >::endcapItems(), mps_fire::i, mean_x12_, mean_x1_, mean_x6_, HLT_IsoTrack_cff::offset, rms_x12_, rms_x1_, and rms_x6_.

7  : mean_x12_(pedestals.size()),
8  rms_x12_(pedestals.size()),
9  mean_x6_(pedestals.size()),
10  rms_x6_(pedestals.size()),
11  mean_x1_(pedestals.size()),
12  rms_x1_(pedestals.size()) {
13  // fill in eb
14  auto const& barrelValues = pedestals.barrelItems();
15  for (unsigned int i = 0; i < barrelValues.size(); i++) {
16  mean_x12_[i] = barrelValues[i].mean_x12;
17  rms_x12_[i] = barrelValues[i].rms_x12;
18  mean_x6_[i] = barrelValues[i].mean_x6;
19  rms_x6_[i] = barrelValues[i].rms_x6;
20  mean_x1_[i] = barrelValues[i].mean_x1;
21  rms_x1_[i] = barrelValues[i].rms_x1;
22  }
23 
24  // fill in ee
25  auto const& endcapValues = pedestals.endcapItems();
26  auto const offset = barrelValues.size();
27  for (unsigned int i = 0; i < endcapValues.size(); i++) {
28  mean_x12_[offset + i] = endcapValues[i].mean_x12;
29  rms_x12_[offset + i] = endcapValues[i].rms_x12;
30  mean_x6_[offset + i] = endcapValues[i].mean_x6;
31  rms_x6_[offset + i] = endcapValues[i].rms_x6;
32  mean_x1_[offset + i] = endcapValues[i].mean_x1;
33  rms_x1_[offset + i] = endcapValues[i].rms_x1;
34  }
35 }
std::vector< float, cms::cuda::HostAllocator< float > > mean_x1_
std::vector< float, cms::cuda::HostAllocator< float > > rms_x12_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x12_
std::vector< float, cms::cuda::HostAllocator< float > > rms_x1_
std::vector< float, cms::cuda::HostAllocator< float > > rms_x6_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x6_

◆ ~EcalPedestalsGPU()

EcalPedestalsGPU::~EcalPedestalsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 37 of file EcalPedestalsGPU.cc.

References cms::cuda::copyAsync(), EcalPedestalsGPU::Product::mean_x1, EcalPedestalsGPU::Product::mean_x12, mean_x12_, mean_x1_, EcalPedestalsGPU::Product::mean_x6, mean_x6_, product_, EcalPedestalsGPU::Product::rms_x1, EcalPedestalsGPU::Product::rms_x12, rms_x12_, rms_x1_, EcalPedestalsGPU::Product::rms_x6, and rms_x6_.

37  {
38  auto const& product = product_.dataForCurrentDeviceAsync(
39  cudaStream, [this](EcalPedestalsGPU::Product& product, cudaStream_t cudaStream) {
40  // allocate
41  product.mean_x12 = cms::cuda::make_device_unique<float[]>(mean_x12_.size(), cudaStream);
42  product.mean_x6 = cms::cuda::make_device_unique<float[]>(mean_x6_.size(), cudaStream);
43  product.mean_x1 = cms::cuda::make_device_unique<float[]>(mean_x1_.size(), cudaStream);
44  product.rms_x12 = cms::cuda::make_device_unique<float[]>(rms_x12_.size(), cudaStream);
45  product.rms_x6 = cms::cuda::make_device_unique<float[]>(rms_x6_.size(), cudaStream);
46  product.rms_x1 = cms::cuda::make_device_unique<float[]>(rms_x1_.size(), cudaStream);
47  // transfer
48  cms::cuda::copyAsync(product.mean_x12, mean_x12_, cudaStream);
49  cms::cuda::copyAsync(product.mean_x6, mean_x6_, cudaStream);
50  cms::cuda::copyAsync(product.mean_x1, mean_x1_, cudaStream);
51  cms::cuda::copyAsync(product.rms_x12, rms_x12_, cudaStream);
52  cms::cuda::copyAsync(product.rms_x6, rms_x6_, cudaStream);
53  cms::cuda::copyAsync(product.rms_x1, rms_x1_, cudaStream);
54  });
55 
56  return product;
57 }
std::vector< float, cms::cuda::HostAllocator< float > > mean_x1_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x1
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 > > rms_x12_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x12_
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x6
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x12
std::vector< float, cms::cuda::HostAllocator< float > > rms_x1_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > mean_x12
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > rms_x6
std::vector< float, cms::cuda::HostAllocator< float > > rms_x6_
std::vector< float, cms::cuda::HostAllocator< float > > mean_x6_

◆ name()

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

Member Data Documentation

◆ mean_x12_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::mean_x12_
private

Definition at line 41 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().

◆ mean_x1_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::mean_x1_
private

Definition at line 45 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().

◆ mean_x6_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::mean_x6_
private

Definition at line 43 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().

◆ product_

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

Definition at line 48 of file EcalPedestalsGPU.h.

Referenced by getProduct().

◆ rms_x12_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::rms_x12_
private

Definition at line 42 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().

◆ rms_x1_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::rms_x1_
private

Definition at line 46 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().

◆ rms_x6_

std::vector<float, cms::cuda::HostAllocator<float> > EcalPedestalsGPU::rms_x6_
private

Definition at line 44 of file EcalPedestalsGPU.h.

Referenced by EcalPedestalsGPU(), and getProduct().