CMS 3D CMS Logo

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

#include <EcalLinearCorrectionsGPU.h>

Classes

struct  Product
 

Public Member Functions

 EcalLinearCorrectionsGPU (EcalLinearCorrections const &)
 
const ProductgetProduct (cudaStream_t) const
 
 ~EcalLinearCorrectionsGPU ()=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 EcalLinearCorrectionsGPU.h.

Constructor & Destructor Documentation

◆ EcalLinearCorrectionsGPU()

EcalLinearCorrectionsGPU::EcalLinearCorrectionsGPU ( EcalLinearCorrections const &  values)

Definition at line 6 of file EcalLinearCorrectionsGPU.cc.

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

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

◆ ~EcalLinearCorrectionsGPU()

EcalLinearCorrectionsGPU::~EcalLinearCorrectionsGPU ( )
default

Member Function Documentation

◆ getProduct()

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

Definition at line 37 of file EcalLinearCorrectionsGPU.cc.

37  {
38  auto const& product = product_.dataForCurrentDeviceAsync(
39  cudaStream, [this](EcalLinearCorrectionsGPU::Product& product, cudaStream_t cudaStream) {
40  // allocate
41  product.p1 = cms::cuda::make_device_unique<float[]>(p1_.size(), cudaStream);
42  product.p2 = cms::cuda::make_device_unique<float[]>(p2_.size(), cudaStream);
43  product.p3 = cms::cuda::make_device_unique<float[]>(p3_.size(), cudaStream);
44  product.t1 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t1_.size(), cudaStream);
45  product.t2 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t2_.size(), cudaStream);
46  product.t3 = cms::cuda::make_device_unique<edm::TimeValue_t[]>(t3_.size(), cudaStream);
47  // transfer
48  cms::cuda::copyAsync(product.p1, p1_, cudaStream);
49  cms::cuda::copyAsync(product.p2, p2_, cudaStream);
50  cms::cuda::copyAsync(product.p3, p3_, cudaStream);
51  cms::cuda::copyAsync(product.t1, t1_, cudaStream);
52  cms::cuda::copyAsync(product.t2, t2_, cudaStream);
53  cms::cuda::copyAsync(product.t3, t3_, cudaStream);
54  });
55 
56  return product;
57 }

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

Referenced by EcalRecHitProducerGPU::acquire().

◆ name()

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

Member Data Documentation

◆ p1_

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

Definition at line 41 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

◆ p2_

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

Definition at line 42 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

◆ p3_

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

Definition at line 43 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

◆ product_

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

Definition at line 49 of file EcalLinearCorrectionsGPU.h.

Referenced by getProduct().

◆ t1_

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

Definition at line 45 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

◆ t2_

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

Definition at line 46 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

◆ t3_

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

Definition at line 47 of file EcalLinearCorrectionsGPU.h.

Referenced by EcalLinearCorrectionsGPU(), and getProduct().

mps_fire.i
i
Definition: mps_fire.py:428
EcalLinearCorrectionsGPU::Product::t3
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t3
Definition: EcalLinearCorrectionsGPU.h:21
EcalLinearCorrectionsGPU::t1_
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t1_
Definition: EcalLinearCorrectionsGPU.h:45
EcalLinearCorrectionsGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: EcalLinearCorrectionsGPU.h:49
EcalLinearCorrectionsGPU::p2_
std::vector< float, cms::cuda::HostAllocator< float > > p2_
Definition: EcalLinearCorrectionsGPU.h:42
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalLinearCorrectionsGPU::t2_
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t2_
Definition: EcalLinearCorrectionsGPU.h:46
EcalLinearCorrectionsGPU::Product
Definition: EcalLinearCorrectionsGPU.h:15
EcalLinearCorrectionsGPU::Product::t1
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t1
Definition: EcalLinearCorrectionsGPU.h:19
EcalLinearCorrectionsGPU::Product::t2
edm::propagate_const_array< cms::cuda::device::unique_ptr< edm::TimeValue_t[]> > t2
Definition: EcalLinearCorrectionsGPU.h:20
EcalLinearCorrectionsGPU::Product::p1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p1
Definition: EcalLinearCorrectionsGPU.h:16
EcalLinearCorrectionsGPU::Product::p2
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p2
Definition: EcalLinearCorrectionsGPU.h:17
EcalLinearCorrectionsGPU::Product::p3
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > p3
Definition: EcalLinearCorrectionsGPU.h:18
EcalLinearCorrectionsGPU::p1_
std::vector< float, cms::cuda::HostAllocator< float > > p1_
Definition: EcalLinearCorrectionsGPU.h:41
EcalLinearCorrectionsGPU::p3_
std::vector< float, cms::cuda::HostAllocator< float > > p3_
Definition: EcalLinearCorrectionsGPU.h:43
EcalLinearCorrectionsGPU::t3_
std::vector< edm::TimeValue_t, cms::cuda::HostAllocator< edm::TimeValue_t > > t3_
Definition: EcalLinearCorrectionsGPU.h:47
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20