CMS 3D CMS Logo

HeterogeneousHGCalHEFConditions.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HGCRecProducers_HeterogeneousHGCalHEFConditions_h
2 #define RecoLocalCalo_HGCRecProducers_HeterogeneousHGCalHEFConditions_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_params_;
38  size_t chunk_params_;
39 
40  std::vector<size_t> calculate_memory_bytes_params_(const HGCalParameters *);
41  size_t allocate_memory_params_(const std::vector<size_t> &);
42  void transfer_data_to_heterogeneous_pointers_params_(const std::vector<size_t> &, const HGCalParameters *);
43 
44  /*methods for managing SoA's pointers*/
45  //double
46  double *&select_pointer_d_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const;
47  std::vector<double> select_pointer_d_(const HGCalParameters *, const unsigned int &) const;
48  //int32_t
49  int32_t *&select_pointer_i_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const;
50  std::vector<int32_t> select_pointer_i_(const HGCalParameters *, const unsigned int &) const;
51 
52  // Helper struct to hold all information that has to be allocated and
53  // deallocated per device
54  struct GPUData {
55  // Destructor should free all member pointers
56  ~GPUData();
57  // internal pointers are on device, struct itself is on CPU
59  // internal pounters and struct are on device
61  };
62 
63  // Helper that takes care of complexity of transferring the data to
64  // multiple devices
66 };
67 
68 #endif //RecoLocalCalo_HGCRecProducers_HeterogeneousHGCalHEFConditions_h
HeterogeneousHGCalHEFConditionsWrapper::transfer_data_to_heterogeneous_pointers_params_
void transfer_data_to_heterogeneous_pointers_params_(const std::vector< size_t > &, const HGCalParameters *)
Definition: HeterogeneousHGCalHEFConditions.cc:17
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
HeterogeneousHGCalHEFConditionsWrapper::allocate_memory_params_
size_t allocate_memory_params_(const std::vector< size_t > &)
Definition: HeterogeneousHGCalHEFConditions.cc:11
MessageLogger.h
HeterogeneousHGCalHEFConditionsWrapper::sizes_params_
std::vector< size_t > sizes_params_
Definition: HeterogeneousHGCalHEFConditions.h:37
HeterogeneousHGCalHEFConditionsWrapper::select_pointer_d_
double *& select_pointer_d_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const
Definition: HeterogeneousHGCalHEFConditions.cc:93
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
HeterogeneousHGCalHEFConditionsWrapper
Definition: HeterogeneousHGCalHEFConditions.h:19
HeterogeneousHGCalHEFConditionsWrapper::gpuData_
cms::cuda::ESProduct< GPUData > gpuData_
Definition: HeterogeneousHGCalHEFConditions.h:65
hgcal_conditions::parameters
Definition: HGCConditions.h:86
HGCConditions.h
HeterogeneousHGCalHEFConditionsWrapper::GPUData
Definition: HeterogeneousHGCalHEFConditions.h:54
HeterogeneousHGCalHEFConditionsWrapper::chunk_params_
size_t chunk_params_
Definition: HeterogeneousHGCalHEFConditions.h:38
hgcal_conditions::parameters::HeterogeneousHGCalHEFParameters
Definition: HGCConditions.h:117
HeterogeneousHGCalHEFConditionsWrapper::GPUData::~GPUData
~GPUData()
Definition: HeterogeneousHGCalHEFConditions.cc:200
cms::cuda::ESProduct
Definition: ESProduct.h:19
HeterogeneousHGCalHEFConditionsWrapper::GPUData::host
hgcal_conditions::HeterogeneousHEFConditionsESProduct * host
Definition: HeterogeneousHGCalHEFConditions.h:58
KernelManagerHGCalRecHit.h
HeterogeneousHGCalHEFConditionsWrapper::~HeterogeneousHGCalHEFConditionsWrapper
~HeterogeneousHGCalHEFConditionsWrapper()
Definition: HeterogeneousHGCalHEFConditions.cc:87
cudaCheck.h
HeterogeneousHGCalHEFConditionsWrapper::GPUData::device
hgcal_conditions::HeterogeneousHEFConditionsESProduct * device
Definition: HeterogeneousHGCalHEFConditions.h:60
HGCalParameters
Definition: HGCalParameters.h:14
hgcal_conditions::HeterogeneousHEFConditionsESProduct
Definition: HGCConditions.h:187
HeterogeneousHGCalHEFConditionsWrapper::HeterogeneousHGCalHEFConditionsWrapper
HeterogeneousHGCalHEFConditionsWrapper(const HGCalParameters *)
Definition: HeterogeneousHGCalHEFConditions.cc:3
HeterogeneousHGCalHEFConditionsWrapper::calculate_memory_bytes_params_
std::vector< size_t > calculate_memory_bytes_params_(const HGCalParameters *)
Definition: HeterogeneousHGCalHEFConditions.cc:61
HeterogeneousHGCalHEFConditionsWrapper::params_
cpar::HeterogeneousHGCalHEFParameters params_
Definition: HeterogeneousHGCalHEFConditions.h:35
HGCalDDDConstants.h
HeterogeneousHGCalHEFConditionsWrapper::getHeterogeneousConditionsESProductAsync
const hgcal_conditions::HeterogeneousHEFConditionsESProduct * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
Definition: HeterogeneousHGCalHEFConditions.cc:150
HGCalParameters.h
ESProduct.h
HeterogeneousHGCalHEFConditionsWrapper::select_pointer_i_
int32_t *& select_pointer_i_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const
Definition: HeterogeneousHGCalHEFConditions.cc:127