CondFormats
EcalObjects
src
EcalGainRatiosGPU.cc
Go to the documentation of this file.
1
#include "
CondFormats/EcalObjects/interface/EcalGainRatiosGPU.h
"
2
3
#include "
FWCore/Utilities/interface/typelookup.h
"
4
#include "
HeterogeneousCore/CUDAUtilities/interface/copyAsync.h
"
5
6
EcalGainRatiosGPU::EcalGainRatiosGPU
(
EcalGainRatios
const
&
values
)
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
}
23
24
EcalGainRatiosGPU::Product
const
&
EcalGainRatiosGPU::getProduct
(cudaStream_t cudaStream)
const
{
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
}
37
38
TYPELOOKUP_DATA_REG
(
EcalGainRatiosGPU
);
EcalGainRatiosGPU::EcalGainRatiosGPU
EcalGainRatiosGPU(EcalGainRatios const &)
Definition:
EcalGainRatiosGPU.cc:6
EcalGainRatiosGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition:
EcalGainRatiosGPU.cc:24
mps_fire.i
i
Definition:
mps_fire.py:428
EcalGainRatiosGPU::Product::gain6Over1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain6Over1
Definition:
EcalGainRatiosGPU.h:17
EcalGainRatiosGPU::Product
Definition:
EcalGainRatiosGPU.h:15
EcalGainRatiosGPU::Product::gain12Over6
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > gain12Over6
Definition:
EcalGainRatiosGPU.h:16
EcalGainRatiosGPU::product_
cms::cuda::ESProduct< Product > product_
Definition:
EcalGainRatiosGPU.h:40
typelookup.h
EcalCondObjectContainer
Definition:
EcalCondObjectContainer.h:13
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
copyAsync.h
EcalGainRatiosGPU::gain12Over6_
std::vector< float, cms::cuda::HostAllocator< float > > gain12Over6_
Definition:
EcalGainRatiosGPU.h:37
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition:
typelookup.h:102
EcalGainRatiosGPU::gain6Over1_
std::vector< float, cms::cuda::HostAllocator< float > > gain6Over1_
Definition:
EcalGainRatiosGPU.h:38
EcalGainRatiosGPU.h
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:82
EcalGainRatiosGPU
Definition:
EcalGainRatiosGPU.h:13
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition:
copyAsync.h:20
Generated for CMSSW Reference Manual by
1.8.16