CondFormats
EcalObjects
src
EcalMultifitParametersGPU.cc
Go to the documentation of this file.
1
#include "
CondFormats/EcalObjects/interface/EcalMultifitParametersGPU.h
"
2
3
#include "
FWCore/Utilities/interface/typelookup.h
"
4
#include "
HeterogeneousCore/CUDAUtilities/interface/copyAsync.h
"
5
6
EcalMultifitParametersGPU::EcalMultifitParametersGPU
(std::vector<double>
const
& amplitudeFitParametersEB,
7
std::vector<double>
const
& amplitudeFitParametersEE,
8
std::vector<double>
const
& timeFitParametersEB,
9
std::vector<double>
const
& timeFitParametersEE) {
10
amplitudeFitParametersEB_
.resize(amplitudeFitParametersEB.size());
11
amplitudeFitParametersEE_
.resize(amplitudeFitParametersEE.size());
12
timeFitParametersEB_
.resize(timeFitParametersEB.size());
13
timeFitParametersEE_
.resize(timeFitParametersEE.size());
14
15
std::copy
(amplitudeFitParametersEB.begin(), amplitudeFitParametersEB.end(),
amplitudeFitParametersEB_
.begin());
16
std::copy
(amplitudeFitParametersEE.begin(), amplitudeFitParametersEE.end(),
amplitudeFitParametersEE_
.begin());
17
std::copy
(timeFitParametersEB.begin(), timeFitParametersEB.end(),
timeFitParametersEB_
.begin());
18
std::copy
(timeFitParametersEE.begin(), timeFitParametersEE.end(),
timeFitParametersEE_
.begin());
19
}
20
21
EcalMultifitParametersGPU::Product
const
&
EcalMultifitParametersGPU::getProduct
(cudaStream_t cudaStream)
const
{
22
auto
const
& product =
product_
.dataForCurrentDeviceAsync(
23
cudaStream, [
this
](
EcalMultifitParametersGPU::Product
& product, cudaStream_t cudaStream) {
24
// allocate
25
product.
amplitudeFitParametersEB
=
26
cms::cuda::make_device_unique<double[]>(
amplitudeFitParametersEB_
.size(), cudaStream);
27
product.
amplitudeFitParametersEE
=
28
cms::cuda::make_device_unique<double[]>(
amplitudeFitParametersEE_
.size(), cudaStream);
29
product.
timeFitParametersEB
= cms::cuda::make_device_unique<double[]>(
timeFitParametersEB_
.size(), cudaStream);
30
product.
timeFitParametersEE
= cms::cuda::make_device_unique<double[]>(
timeFitParametersEE_
.size(), cudaStream);
31
// transfer
32
cms::cuda::copyAsync
(product.
amplitudeFitParametersEB
,
amplitudeFitParametersEB_
, cudaStream);
33
cms::cuda::copyAsync
(product.
amplitudeFitParametersEE
,
amplitudeFitParametersEE_
, cudaStream);
34
cms::cuda::copyAsync
(product.
timeFitParametersEB
,
timeFitParametersEB_
, cudaStream);
35
cms::cuda::copyAsync
(product.
timeFitParametersEE
,
timeFitParametersEE_
, cudaStream);
36
});
37
return
product;
38
}
39
40
TYPELOOKUP_DATA_REG
(
EcalMultifitParametersGPU
);
EcalMultifitParametersGPU::timeFitParametersEE_
std::vector< double, cms::cuda::HostAllocator< double > > timeFitParametersEE_
Definition:
EcalMultifitParametersGPU.h:38
filterCSVwithJSON.copy
copy
Definition:
filterCSVwithJSON.py:36
typelookup.h
EcalMultifitParametersGPU::Product
Definition:
EcalMultifitParametersGPU.h:16
EcalMultifitParametersGPU::amplitudeFitParametersEE_
std::vector< double, cms::cuda::HostAllocator< double > > amplitudeFitParametersEE_
Definition:
EcalMultifitParametersGPU.h:38
EcalMultifitParametersGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition:
EcalMultifitParametersGPU.cc:21
EcalMultifitParametersGPU::amplitudeFitParametersEB_
std::vector< double, cms::cuda::HostAllocator< double > > amplitudeFitParametersEB_
Definition:
EcalMultifitParametersGPU.h:38
EcalMultifitParametersGPU
Definition:
EcalMultifitParametersGPU.h:14
EcalMultifitParametersGPU::Product::timeFitParametersEB
edm::propagate_const_array< cms::cuda::device::unique_ptr< double[]> > timeFitParametersEB
Definition:
EcalMultifitParametersGPU.h:19
EcalMultifitParametersGPU::Product::timeFitParametersEE
edm::propagate_const_array< cms::cuda::device::unique_ptr< double[]> > timeFitParametersEE
Definition:
EcalMultifitParametersGPU.h:20
EcalMultifitParametersGPU::EcalMultifitParametersGPU
EcalMultifitParametersGPU(std::vector< double > const &litudeEB, std::vector< double > const &litudeEE, std::vector< double > const &timeEB, std::vector< double > const &timeEE)
Definition:
EcalMultifitParametersGPU.cc:6
copyAsync.h
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition:
typelookup.h:102
EcalMultifitParametersGPU.h
EcalMultifitParametersGPU::product_
cms::cuda::ESProduct< Product > product_
Definition:
EcalMultifitParametersGPU.h:41
EcalMultifitParametersGPU::Product::amplitudeFitParametersEE
edm::propagate_const_array< cms::cuda::device::unique_ptr< double[]> > amplitudeFitParametersEE
Definition:
EcalMultifitParametersGPU.h:18
EcalMultifitParametersGPU::Product::amplitudeFitParametersEB
edm::propagate_const_array< cms::cuda::device::unique_ptr< double[]> > amplitudeFitParametersEB
Definition:
EcalMultifitParametersGPU.h:17
EcalMultifitParametersGPU::timeFitParametersEB_
std::vector< double, cms::cuda::HostAllocator< double > > timeFitParametersEB_
Definition:
EcalMultifitParametersGPU.h:38
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