RecoLocalCalo
HcalRecAlgos
src
HcalMahiPulseOffsetsGPU.cc
Go to the documentation of this file.
1
#include "
RecoLocalCalo/HcalRecAlgos/interface/HcalMahiPulseOffsetsGPU.h
"
2
3
#include "
FWCore/Utilities/interface/typelookup.h
"
4
#include "
HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h
"
5
6
// FIXME: add proper getters to conditions
7
HcalMahiPulseOffsetsGPU::HcalMahiPulseOffsetsGPU
(
edm::ParameterSet
const
& ps) {
8
auto
const
&
values
= ps.
getParameter
<std::vector<int>>(
"pulseOffsets"
);
9
values_
.resize(
values
.size());
10
std::copy
(
values
.begin(),
values
.end(),
values_
.begin());
11
}
12
13
HcalMahiPulseOffsetsGPU::Product::~Product
() {
14
// deallocation
15
cudaCheck
(cudaFree(
values
));
16
}
17
18
HcalMahiPulseOffsetsGPU::Product
const
&
HcalMahiPulseOffsetsGPU::getProduct
(cudaStream_t cudaStream)
const
{
19
auto
const
& product =
product_
.dataForCurrentDeviceAsync(
20
cudaStream, [
this
](
HcalMahiPulseOffsetsGPU::Product
& product, cudaStream_t cudaStream) {
21
// malloc
22
cudaCheck
(cudaMalloc((
void
**)&product.
values
, this->values_.size() *
sizeof
(
int
)));
23
24
// transfer
25
cudaCheck
(cudaMemcpyAsync(product.
values
,
26
this->values_.data(),
27
this->
values_
.size() *
sizeof
(
int
),
28
cudaMemcpyHostToDevice,
29
cudaStream));
30
});
31
32
return
product;
33
}
34
35
TYPELOOKUP_DATA_REG
(
HcalMahiPulseOffsetsGPU
);
HcalMahiPulseOffsetsGPU.h
filterCSVwithJSON.copy
copy
Definition:
filterCSVwithJSON.py:36
HcalMahiPulseOffsetsGPU::values_
std::vector< int, cms::cuda::HostAllocator< int > > values_
Definition:
HcalMahiPulseOffsetsGPU.h:31
typelookup.h
HcalMahiPulseOffsetsGPU::HcalMahiPulseOffsetsGPU
HcalMahiPulseOffsetsGPU(edm::ParameterSet const &)
Definition:
HcalMahiPulseOffsetsGPU.cc:7
HcalMahiPulseOffsetsGPU::Product::values
int * values
Definition:
HcalMahiPulseOffsetsGPU.h:15
HcalMahiPulseOffsetsGPU::Product::~Product
~Product()
Definition:
HcalMahiPulseOffsetsGPU.cc:13
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
HcalMahiPulseOffsetsGPU::product_
cms::cuda::ESProduct< Product > product_
Definition:
HcalMahiPulseOffsetsGPU.h:33
edm::ParameterSet
Definition:
ParameterSet.h:47
createfilelist.int
int
Definition:
createfilelist.py:10
cudaCheck.h
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition:
typelookup.h:102
HcalMahiPulseOffsetsGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition:
HcalMahiPulseOffsetsGPU.cc:18
HcalMahiPulseOffsetsGPU::Product
Definition:
HcalMahiPulseOffsetsGPU.h:13
cudaCheck
#define cudaCheck(ARG,...)
Definition:
cudaCheck.h:69
HcalMahiPulseOffsetsGPU
Definition:
HcalMahiPulseOffsetsGPU.h:11
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
Generated for CMSSW Reference Manual by
1.8.16