CondFormats
EcalObjects
src
EcalPulseCovariancesGPU.cc
Go to the documentation of this file.
1
#include "
CondFormats/EcalObjects/interface/EcalPulseCovariancesGPU.h
"
2
3
#include "
FWCore/Utilities/interface/typelookup.h
"
4
#include "
HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h
"
5
6
EcalPulseCovariancesGPU::EcalPulseCovariancesGPU
(
EcalPulseCovariances
const
&
values
)
7
: valuesEB_{
values
.barrelItems()}, valuesEE_{
values
.endcapItems()} {}
8
9
EcalPulseCovariancesGPU::Product::~Product
() {
10
// deallocation
11
cudaCheck
(cudaFree(
values
));
12
}
13
14
EcalPulseCovariancesGPU::Product
const
&
EcalPulseCovariancesGPU::getProduct
(cudaStream_t cudaStream)
const
{
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
}
41
42
TYPELOOKUP_DATA_REG
(
EcalPulseCovariancesGPU
);
typelookup.h
EcalPulseCovariancesGPU::Product::~Product
~Product()
Definition:
EcalPulseCovariancesGPU.cc:9
EcalCondObjectContainer
Definition:
EcalCondObjectContainer.h:13
EcalPulseCovariancesGPU::EcalPulseCovariancesGPU
EcalPulseCovariancesGPU(EcalPulseCovariances const &)
Definition:
EcalPulseCovariancesGPU.cc:6
EcalPulseCovariancesGPU::Product::values
EcalPulseCovariance * values
Definition:
EcalPulseCovariancesGPU.h:15
EcalPulseCovariancesGPU::Product
Definition:
EcalPulseCovariancesGPU.h:13
EcalPulseCovariancesGPU.h
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
cudaCheck.h
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition:
typelookup.h:102
EcalPulseCovariancesGPU::valuesEE_
std::vector< EcalPulseCovariance > const & valuesEE_
Definition:
EcalPulseCovariancesGPU.h:34
cudaCheck
#define cudaCheck(ARG,...)
Definition:
cudaCheck.h:69
EcalPulseCovariancesGPU::product_
cms::cuda::ESProduct< Product > product_
Definition:
EcalPulseCovariancesGPU.h:36
EcalPulseCovariance
Definition:
EcalPulseCovariances.h:9
EcalPulseCovariancesGPU
Definition:
EcalPulseCovariancesGPU.h:11
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:82
EcalPulseCovariancesGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition:
EcalPulseCovariancesGPU.cc:14
EcalPulseCovariancesGPU::valuesEB_
std::vector< EcalPulseCovariance > const & valuesEB_
Definition:
EcalPulseCovariancesGPU.h:33
Generated for CMSSW Reference Manual by
1.8.16