CMS 3D CMS Logo

HeterogeneousHGCalHEFCellPositionsConditions.h
Go to the documentation of this file.
1 #ifndef CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h
2 #define CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h
3 
4 #include <numeric> //accumulate
5 #include <typeinfo>
6 
14 
17 
18 // Declare the wrapper ESProduct. The corresponding ESProducer should
19 // produce objects of this type.
21 public:
22  // Constructor takes the standard CPU ESProduct, and transforms the
23  // necessary data to array(s) in pinned host memory
25 
26  // Deallocates all pinned host memory
28 
29  // Function to return the actual payload on the memory of the current device
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)
38 
39  std::vector<size_t> sizes_;
40  size_t chunk_;
41  const size_t number_position_arrays =
42  2; //x and y; required due to the assymetry between cpos::HeterogeneousHGCalPositionsMapping and cpos::HGCalPositionsMapping
43 
45  size_t allocate_memory_(const std::vector<size_t>&);
48 
49  /*methods for managing SoA's pointers*/
50  //float
51  float*& select_pointer_f_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const;
52  std::vector<float>& select_pointer_f_(cpos::HGCalPositionsMapping*, const unsigned int&);
53  //int32_t
54  int32_t*& select_pointer_i_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const;
55  std::vector<int32_t>& select_pointer_i_(cpos::HGCalPositionsMapping*, const unsigned int&);
56  //uint32_t
57  uint32_t*& select_pointer_u_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const;
58  std::vector<uint32_t>& select_pointer_u_(cpos::HGCalPositionsMapping*, const unsigned int&);
59 
60  // Helper struct to hold all information that has to be allocated and
61  // deallocated per device
62  struct GPUData {
63  // Destructor should free all member pointers
64  ~GPUData();
65  // internal pointers are on device, struct itself is on CPU
67  // internal pounters and struct are on device
69  };
70 
71  // Helper that takes care of complexity of transferring the data to
72  // multiple devices
74 };
75 
76 #endif //CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
MessageLogger.h
HeterogeneousHGCalHEFCellPositionsConditions::select_pointer_u_
uint32_t *& select_pointer_u_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:199
hgcal_conditions::positions
Definition: HGCConditions.h:135
HeterogeneousHGCalHEFCellPositionsConditions::nelems_posmap_
size_t nelems_posmap_
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:37
HeterogeneousHGCalHEFCellPositionsConditions
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:20
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
HeterogeneousHGCalHEFCellPositionsConditions::transfer_data_to_heterogeneous_pointers_
void transfer_data_to_heterogeneous_pointers_(const std::vector< size_t > &, cpos::HGCalPositionsMapping *)
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:18
hgcal_conditions::parameters
Definition: HGCConditions.h:86
HGCConditions.h
HeterogeneousHGCalHEFCellPositionsConditions::gpuData_
cms::cuda::ESProduct< GPUData > gpuData_
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:73
HeterogeneousHGCalHEFCellPositionsConditions::chunk_
size_t chunk_
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:40
HeterogeneousHGCalHEFCellPositionsConditions::sizes_
std::vector< size_t > sizes_
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:39
cms::cuda::ESProduct
Definition: ESProduct.h:19
HeterogeneousHGCalHEFCellPositionsConditions::select_pointer_i_
int32_t *& select_pointer_i_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:167
HeterogeneousHGCalHEFCellPositionsConditions::posmap_
cpos::HeterogeneousHGCalPositionsMapping posmap_
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:36
KernelManagerHGCalCellPositions.h
HeterogeneousHGCalHEFCellPositionsConditions::GPUData
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:62
HeterogeneousHGCalHEFCellPositionsConditions::HeterogeneousHGCalHEFCellPositionsConditions
HeterogeneousHGCalHEFCellPositionsConditions(cpos::HGCalPositionsMapping *)
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:3
HeterogeneousHGCalHEFCellPositionsConditions::getHeterogeneousConditionsESProductAsync
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct const * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:224
HeterogeneousHGCalHEFCellPositionsConditions::GPUData::~GPUData
~GPUData()
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:298
HeterogeneousHGCalHEFCellPositionsConditions::GPUData::device
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct * device
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:68
hgcal_conditions::positions::HGCalPositionsMapping
Definition: HGCConditions.h:147
HeterogeneousHGCalHEFCellPositionsConditions::number_position_arrays
const size_t number_position_arrays
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:41
cudaCheck.h
hgcal_conditions::positions::HeterogeneousHGCalPositionsMapping
Definition: HGCConditions.h:163
HeterogeneousHGCalHEFCellPositionsConditions::transfer_data_to_heterogeneous_vars_
void transfer_data_to_heterogeneous_vars_(const cpos::HGCalPositionsMapping *)
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:85
HeterogeneousHGCalHEFCellPositionsConditions::select_pointer_f_
float *& select_pointer_f_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:139
HGCalDDDConstants.h
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct
Definition: HGCConditions.h:196
HeterogeneousHGCalHEFCellPositionsConditions::GPUData::host
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct * host
Definition: HeterogeneousHGCalHEFCellPositionsConditions.h:66
HGCalParameters.h
ESProduct.h
HeterogeneousHGCalHEFCellPositionsConditions::calculate_memory_bytes_
std::vector< size_t > calculate_memory_bytes_(cpos::HGCalPositionsMapping *)
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:96
HeterogeneousHGCalHEFCellPositionsConditions::allocate_memory_
size_t allocate_memory_(const std::vector< size_t > &)
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:12
HeterogeneousHGCalHEFCellPositionsConditions::~HeterogeneousHGCalHEFCellPositionsConditions
~HeterogeneousHGCalHEFCellPositionsConditions()
Definition: HeterogeneousHGCalHEFCellPositionsConditions.cc:133