CMS 3D CMS Logo

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

#include <EcalLaserAPDPNRatiosGPU.h>

Classes

struct  Product
 

Public Member Functions

 EcalLaserAPDPNRatiosGPU (EcalLaserAPDPNRatios const &)
 
Product const & getProduct (cudaStream_t) const
 
 ~EcalLaserAPDPNRatiosGPU ()=default
 

Static Public Member Functions

static std::string name ()
 

Private Attributes

std::vector< float, cms::cuda::HostAllocator< float > > p1_
 
std::vector< float, cms::cuda::HostAllocator< float > > p2_
 
std::vector< float, cms::cuda::HostAllocator< float > > p3_
 
cms::cuda::ESProduct< Productproduct_
 
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t1_
 
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t2_
 
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t3_
 

Detailed Description

Definition at line 13 of file EcalLaserAPDPNRatiosGPU.h.

Constructor & Destructor Documentation

◆ EcalLaserAPDPNRatiosGPU()

EcalLaserAPDPNRatiosGPU::EcalLaserAPDPNRatiosGPU ( EcalLaserAPDPNRatios const &  values)

Definition at line 6 of file EcalLaserAPDPNRatiosGPU.cc.

References mps_fire::i, p1_, p2_, p3_, t1_, t2_, t3_, and contentValuesCheck::values.

7  : p1_(values.getLaserMap().size()),
8  p2_(values.getLaserMap().size()),
9  p3_(values.getLaserMap().size()),
10  t1_(values.getTimeMap().size()),
11  t2_(values.getTimeMap().size()),
12  t3_(values.getTimeMap().size()) {
13  // fill in eb
14  // auto const& barrelValues = values.barrelItems();
15  for (unsigned int i = 0; i < values.getLaserMap().barrelItems().size(); i++) {
16  p1_[i] = values.getLaserMap().barrelItems()[i].p1;
17  p2_[i] = values.getLaserMap().barrelItems()[i].p2;
18  p3_[i] = values.getLaserMap().barrelItems()[i].p3;
19  }
20 
21  // fill in ee
22  // auto const& endcapValues = values.endcapItems();
23  auto const offset_laser = values.getLaserMap().barrelItems().size();
24  for (unsigned int i = 0; i < values.getLaserMap().endcapItems().size(); i++) {
25  p1_[offset_laser + i] = values.getLaserMap().endcapItems()[i].p1;
26  p2_[offset_laser + i] = values.getLaserMap().endcapItems()[i].p2;
27  p3_[offset_laser + i] = values.getLaserMap().endcapItems()[i].p3;
28  }
29 
30  // Time is a simple std::vector
31  // typedef std::vector<EcalLaserTimeStamp> EcalLaserTimeStampMap;
32  for (unsigned int i = 0; i < values.getTimeMap().size(); i++) {
33  t1_[i] = values.getTimeMap()[i].t1.value();
34  t2_[i] = values.getTimeMap()[i].t2.value();
35  t3_[i] = values.getTimeMap()[i].t3.value();
36  }
37 }
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t1_
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t2_
std::vector< float, cms::cuda::HostAllocator< float > > p2_
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t3_
std::vector< float, cms::cuda::HostAllocator< float > > p1_
std::vector< float, cms::cuda::HostAllocator< float > > p3_

◆ ~EcalLaserAPDPNRatiosGPU()

EcalLaserAPDPNRatiosGPU::~EcalLaserAPDPNRatiosGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 39 of file EcalLaserAPDPNRatiosGPU.cc.

References cms::cuda::copyAsync(), EcalLaserAPDPNRatiosGPU::Product::p1, p1_, EcalLaserAPDPNRatiosGPU::Product::p2, p2_, EcalLaserAPDPNRatiosGPU::Product::p3, p3_, product_, EcalLaserAPDPNRatiosGPU::Product::t1, t1_, EcalLaserAPDPNRatiosGPU::Product::t2, t2_, EcalLaserAPDPNRatiosGPU::Product::t3, and t3_.

39  {
40  auto const& product = product_.dataForCurrentDeviceAsync(
41  cudaStream, [this](EcalLaserAPDPNRatiosGPU::Product& product, cudaStream_t cudaStream) {
42  // allocate
43  product.p1 = cms::cuda::make_device_unique<float[]>(p1_.size(), cudaStream);
44  product.p2 = cms::cuda::make_device_unique<float[]>(p2_.size(), cudaStream);
45  product.p3 = cms::cuda::make_device_unique<float[]>(p3_.size(), cudaStream);
46  product.t1 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t1_.size(), cudaStream);
47  product.t2 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t2_.size(), cudaStream);
48  product.t3 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t3_.size(), cudaStream);
49  // transfer
50  cms::cuda::copyAsync(product.p1, p1_, cudaStream);
51  cms::cuda::copyAsync(product.p2, p2_, cudaStream);
52  cms::cuda::copyAsync(product.p3, p3_, cudaStream);
53  cms::cuda::copyAsync(product.t1, t1_, cudaStream);
54  cms::cuda::copyAsync(product.t2, t2_, cudaStream);
55  cms::cuda::copyAsync(product.t3, t3_, cudaStream);
56  });
57 
58  return product;
59 }
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t1_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p1
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t2_
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t1
std::vector< float, cms::cuda::HostAllocator< float > > p2_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p3
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t3_
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
cms::cuda::ESProduct< Product > product_
std::vector< float, cms::cuda::HostAllocator< float > > p1_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p2
std::vector< float, cms::cuda::HostAllocator< float > > p3_
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t2
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t3

◆ name()

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

Member Data Documentation

◆ p1_

std::vector<float, cms::cuda::HostAllocator<float> > EcalLaserAPDPNRatiosGPU::p1_
private

Definition at line 41 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().

◆ p2_

std::vector<float, cms::cuda::HostAllocator<float> > EcalLaserAPDPNRatiosGPU::p2_
private

Definition at line 42 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().

◆ p3_

std::vector<float, cms::cuda::HostAllocator<float> > EcalLaserAPDPNRatiosGPU::p3_
private

Definition at line 43 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().

◆ product_

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

Definition at line 49 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by getProduct().

◆ t1_

std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t> > EcalLaserAPDPNRatiosGPU::t1_
private

Definition at line 45 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().

◆ t2_

std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t> > EcalLaserAPDPNRatiosGPU::t2_
private

Definition at line 46 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().

◆ t3_

std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t> > EcalLaserAPDPNRatiosGPU::t3_
private

Definition at line 47 of file EcalLaserAPDPNRatiosGPU.h.

Referenced by EcalLaserAPDPNRatiosGPU(), and getProduct().