RecoLocalCalo
HGCalRecProducers
plugins
HeterogeneousHGCalEEConditions.h
Go to the documentation of this file.
1
#ifndef HeterogeneousHGCalEEConditions_h
2
#define HeterogeneousHGCalEEConditions_h
3
4
#include <numeric>
//accumulate
5
#include <typeinfo>
6
7
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
8
#include "
FWCore/Utilities/interface/Exception.h
"
9
#include "
HeterogeneousCore/CUDACore/interface/ESProduct.h
"
10
#include "
HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h
"
11
#include "
CUDADataFormats/HGCal/interface/HGCConditions.h
"
12
#include "
Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
"
13
#include "
Geometry/HGCalCommonData/interface/HGCalParameters.h
"
14
#include "
RecoLocalCalo/HGCalRecProducers/plugins/KernelManagerHGCalRecHit.h
"
15
16
namespace
cp
=
hgcal_conditions::parameters
;
17
18
// Declare the wrapper ESProduct. The corresponding ESProducer should
19
// produce objects of this type.
20
class
HeterogeneousHGCalEEConditionsWrapper
{
21
public
:
22
// Constructor takes the standard CPU ESProduct, and transforms the
23
// necessary data to array(s) in pinned host memory
24
HeterogeneousHGCalEEConditionsWrapper
(
const
HGCalParameters
*);
25
26
// Deallocates all pinned host memory
27
~HeterogeneousHGCalEEConditionsWrapper
();
28
29
// Function to return the actual payload on the memory of the current device
30
hgcal_conditions::HeterogeneousEEConditionsESProduct
const
*
getHeterogeneousConditionsESProductAsync
(
31
cudaStream_t
stream
)
const
;
32
33
private
:
34
// Holds the data in pinned CPU memory
35
// Contrary to its non-heterogeneous counterpart (constructor argument) it is *not* a pointer (so to avoid an extra allocation)
36
cp::HeterogeneousHGCalEEParameters
params_
;
37
38
std::vector<size_t>
sizes_
;
39
size_t
chunk_
;
40
41
void
calculate_memory_bytes
(
const
HGCalParameters
*);
42
43
// Helper struct to hold all information that has to be allocated and
44
// deallocated per device
45
struct
GPUData
{
46
// Destructor should free all member pointers
47
~GPUData
();
48
// internal pointers are on device, struct itself is on CPU
49
hgcal_conditions::HeterogeneousEEConditionsESProduct
*
host
=
nullptr
;
50
// internal pounters and struct are on device
51
hgcal_conditions::HeterogeneousEEConditionsESProduct
*
device
=
nullptr
;
52
};
53
54
// Helper that takes care of complexity of transferring the data to
55
// multiple devices
56
cms::cuda::ESProduct<GPUData>
gpuData_
;
57
};
58
59
#endif //HeterogeneousHGCalEEConditions_h
BeamSpotPI::parameters
parameters
Definition:
BeamSpotPayloadInspectorHelper.h:30
MessageLogger.h
HeterogeneousHGCalEEConditionsWrapper::~HeterogeneousHGCalEEConditionsWrapper
~HeterogeneousHGCalEEConditionsWrapper()
Definition:
HeterogeneousHGCalEEConditions.cc:129
cms::cuda::stream
cudaStream_t stream
Definition:
HistoContainer.h:57
HeterogeneousHGCalEEConditionsWrapper::calculate_memory_bytes
void calculate_memory_bytes(const HGCalParameters *)
Definition:
HeterogeneousHGCalEEConditions.cc:106
HeterogeneousHGCalEEConditionsWrapper::GPUData::~GPUData
~GPUData()
Definition:
HeterogeneousHGCalEEConditions.cc:182
hgcal_conditions::parameters
Definition:
HGCConditions.h:86
HeterogeneousHGCalEEConditionsWrapper::chunk_
size_t chunk_
Definition:
HeterogeneousHGCalEEConditions.h:39
HGCConditions.h
HeterogeneousHGCalEEConditionsWrapper::sizes_
std::vector< size_t > sizes_
Definition:
HeterogeneousHGCalEEConditions.h:38
HeterogeneousHGCalEEConditionsWrapper::params_
cp::HeterogeneousHGCalEEParameters params_
Definition:
HeterogeneousHGCalEEConditions.h:36
cms::cuda::ESProduct
Definition:
ESProduct.h:19
KernelManagerHGCalRecHit.h
HeterogeneousHGCalEEConditionsWrapper
Definition:
HeterogeneousHGCalEEConditions.h:20
HeterogeneousHGCalEEConditionsWrapper::GPUData::host
hgcal_conditions::HeterogeneousEEConditionsESProduct * host
Definition:
HeterogeneousHGCalEEConditions.h:49
HeterogeneousHGCalEEConditionsWrapper::GPUData::device
hgcal_conditions::HeterogeneousEEConditionsESProduct * device
Definition:
HeterogeneousHGCalEEConditions.h:51
cudaCheck.h
HGCalParameters
Definition:
HGCalParameters.h:14
hgcal_conditions::HeterogeneousEEConditionsESProduct
Definition:
HGCConditions.h:184
HeterogeneousHGCalEEConditionsWrapper::gpuData_
cms::cuda::ESProduct< GPUData > gpuData_
Definition:
HeterogeneousHGCalEEConditions.h:56
Exception.h
HeterogeneousHGCalEEConditionsWrapper::GPUData
Definition:
HeterogeneousHGCalEEConditions.h:45
HGCalDDDConstants.h
HeterogeneousHGCalEEConditionsWrapper::HeterogeneousHGCalEEConditionsWrapper
HeterogeneousHGCalEEConditionsWrapper(const HGCalParameters *)
Definition:
HeterogeneousHGCalEEConditions.cc:59
HeterogeneousHGCalEEConditionsWrapper::getHeterogeneousConditionsESProductAsync
const hgcal_conditions::HeterogeneousEEConditionsESProduct * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
Definition:
HeterogeneousHGCalEEConditions.cc:137
hgcal_conditions::parameters::HeterogeneousHGCalEEParameters
Definition:
HGCConditions.h:107
HGCalParameters.h
ESProduct.h
Generated for CMSSW Reference Manual by
1.8.16