CMS 3D CMS Logo

HeterogeneousHGCalHEBConditions.h
Go to the documentation of this file.
1 #ifndef HeterogeneousHGCalHEBConditions_h
2 #define HeterogeneousHGCalHEBConditions_h
3 
4 #include <numeric> //accumulate
5 #include <typeinfo>
6 
14 
16 
17 // Declare the wrapper ESProduct. The corresponding ESProducer should
18 // produce objects of this type.
20 public:
21  // Constructor takes the standard CPU ESProduct, and transforms the
22  // necessary data to array(s) in pinned host memory
24 
25  // Deallocates all pinned host memory
27 
28  // Function to return the actual payload on the memory of the current device
30  cudaStream_t stream) const;
31 
32 private:
33  // Holds the data in pinned CPU memory
34  // Contrary to its non-heterogeneous counterpart (constructor argument) it is *not* a pointer (so to avoid an extra allocation)
36 
37  std::vector<size_t> sizes_;
38  size_t chunk_;
39 
41  double *&select_pointer_d(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const;
42  std::vector<double> select_pointer_d(const HGCalParameters *, const unsigned int &) const;
43  int32_t *&select_pointer_i(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const;
44  std::vector<int32_t> select_pointer_i(const HGCalParameters *, const unsigned int &) const;
45 
46  // Helper struct to hold all information that has to be allocated and
47  // deallocated per device
48  struct GPUData {
49  // Destructor should free all member pointers
50  ~GPUData();
51  // internal pointers are on device, struct itself is on CPU
53  // internal pounters and struct are on device
55  };
56 
57  // Helper that takes care of complexity of transferring the data to
58  // multiple devices
60 };
61 
62 #endif //HeterogeneousHGCalHEBConditions_h
HeterogeneousHGCalHEBConditionsWrapper::sizes_
std::vector< size_t > sizes_
Definition: HeterogeneousHGCalHEBConditions.h:37
HeterogeneousHGCalHEBConditionsWrapper::select_pointer_i
int32_t *& select_pointer_i(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const
Definition: HeterogeneousHGCalHEBConditions.cc:102
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
MessageLogger.h
HeterogeneousHGCalHEBConditionsWrapper::~HeterogeneousHGCalHEBConditionsWrapper
~HeterogeneousHGCalHEBConditionsWrapper()
Definition: HeterogeneousHGCalHEBConditions.cc:74
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
HeterogeneousHGCalHEBConditionsWrapper::gpuData_
cms::cuda::ESProduct< GPUData > gpuData_
Definition: HeterogeneousHGCalHEBConditions.h:59
HeterogeneousHGCalHEBConditionsWrapper::getHeterogeneousConditionsESProductAsync
const hgcal_conditions::HeterogeneousHEBConditionsESProduct * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
Definition: HeterogeneousHGCalHEBConditions.cc:125
HeterogeneousHGCalHEBConditionsWrapper::select_pointer_d
double *& select_pointer_d(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const
Definition: HeterogeneousHGCalHEBConditions.cc:80
HeterogeneousHGCalHEBConditionsWrapper::calculate_memory_bytes
void calculate_memory_bytes(const HGCalParameters *)
Definition: HeterogeneousHGCalHEBConditions.cc:51
HeterogeneousHGCalHEBConditionsWrapper::GPUData
Definition: HeterogeneousHGCalHEBConditions.h:48
HeterogeneousHGCalHEBConditionsWrapper::params_
cp::HeterogeneousHGCalHEBParameters params_
Definition: HeterogeneousHGCalHEBConditions.h:35
hgcal_conditions::parameters
Definition: HGCConditions.h:86
HGCConditions.h
hgcal_conditions::parameters::HeterogeneousHGCalHEBParameters
Definition: HGCConditions.h:127
cms::cuda::ESProduct
Definition: ESProduct.h:19
KernelManagerHGCalRecHit.h
HeterogeneousHGCalHEBConditionsWrapper::HeterogeneousHGCalHEBConditionsWrapper
HeterogeneousHGCalHEBConditionsWrapper(const HGCalParameters *)
Definition: HeterogeneousHGCalHEBConditions.cc:3
hgcal_conditions::HeterogeneousHEBConditionsESProduct
Definition: HGCConditions.h:192
HeterogeneousHGCalHEBConditionsWrapper::GPUData::device
hgcal_conditions::HeterogeneousHEBConditionsESProduct * device
Definition: HeterogeneousHGCalHEBConditions.h:54
cudaCheck.h
HGCalParameters
Definition: HGCalParameters.h:14
HeterogeneousHGCalHEBConditionsWrapper::chunk_
size_t chunk_
Definition: HeterogeneousHGCalHEBConditions.h:38
HeterogeneousHGCalHEBConditionsWrapper::GPUData::~GPUData
~GPUData()
Definition: HeterogeneousHGCalHEBConditions.cc:169
HeterogeneousHGCalHEBConditionsWrapper::GPUData::host
hgcal_conditions::HeterogeneousHEBConditionsESProduct * host
Definition: HeterogeneousHGCalHEBConditions.h:52
HGCalDDDConstants.h
HGCalParameters.h
ESProduct.h
HeterogeneousHGCalHEBConditionsWrapper
Definition: HeterogeneousHGCalHEBConditions.h:19