CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
15 namespace cpar = hgcal_conditions::parameters;
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
hgcal_conditions::HeterogeneousHEFConditionsESProduct * host
size_t allocate_memory_params_(const std::vector< size_t > &)
double *& select_pointer_d_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
hgcal_conditions::HeterogeneousHEFConditionsESProduct * device
int32_t *& select_pointer_i_(cpar::HeterogeneousHGCalHEFParameters *, const unsigned int &) const
void transfer_data_to_heterogeneous_pointers_params_(const std::vector< size_t > &, const HGCalParameters *)
hgcal_conditions::HeterogeneousHEFConditionsESProduct const * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
std::vector< size_t > calculate_memory_bytes_params_(const HGCalParameters *)
cpar::HeterogeneousHGCalHEFParameters params_