File indexing completed on 2024-04-06 12:25:54
0001 #ifndef HeterogeneousHGCalHEBConditions_h
0002 #define HeterogeneousHGCalHEBConditions_h
0003
0004 #include <numeric> //accumulate
0005 #include <typeinfo>
0006
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0009 #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"
0010 #include "CUDADataFormats/HGCal/interface/HGCConditions.h"
0011 #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
0012 #include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
0013 #include "RecoLocalCalo/HGCalRecProducers/plugins/KernelManagerHGCalRecHit.h"
0014
0015 namespace cp = hgcal_conditions::parameters;
0016
0017
0018
0019 class HeterogeneousHGCalHEBConditionsWrapper {
0020 public:
0021
0022
0023 HeterogeneousHGCalHEBConditionsWrapper(const HGCalParameters *);
0024
0025
0026 ~HeterogeneousHGCalHEBConditionsWrapper();
0027
0028
0029 hgcal_conditions::HeterogeneousHEBConditionsESProduct const *getHeterogeneousConditionsESProductAsync(
0030 cudaStream_t stream) const;
0031
0032 private:
0033
0034
0035 cp::HeterogeneousHGCalHEBParameters params_;
0036
0037 std::vector<size_t> sizes_;
0038 size_t chunk_;
0039
0040 void calculate_memory_bytes(const HGCalParameters *);
0041 double *&select_pointer_d(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const;
0042 std::vector<double> select_pointer_d(const HGCalParameters *, const unsigned int &) const;
0043 int32_t *&select_pointer_i(cp::HeterogeneousHGCalHEBParameters *, const unsigned int &) const;
0044 std::vector<int32_t> select_pointer_i(const HGCalParameters *, const unsigned int &) const;
0045
0046
0047
0048 struct GPUData {
0049
0050 ~GPUData();
0051
0052 hgcal_conditions::HeterogeneousHEBConditionsESProduct *host = nullptr;
0053
0054 hgcal_conditions::HeterogeneousHEBConditionsESProduct *device = nullptr;
0055 };
0056
0057
0058
0059 cms::cuda::ESProduct<GPUData> gpuData_;
0060 };
0061
0062 #endif