HcalPedestalsGPU

Product

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#ifndef CondFormats_HcalObjects_interface_HcalPedestalsGPU_h
#define CondFormats_HcalObjects_interface_HcalPedestalsGPU_h

#include "CondFormats/HcalObjects/interface/HcalPedestals.h"
#include "FWCore/Utilities/interface/propagate_const_array.h"
#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"

#ifndef __CUDACC__
#include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
#include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
#endif

class HcalPedestalsGPU {
public:
  struct Product {
    edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> values;
    edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> widths;
  };

#ifndef __CUDACC__
  // rearrange reco params
  HcalPedestalsGPU(HcalPedestals const &);

  // will trigger deallocation of Product thru ~Product
  ~HcalPedestalsGPU() = default;

  // get device pointers
  Product const &getProduct(cudaStream_t) const;

  // as in cpu version
  bool unitIsADC() const { return unitIsADC_; }

  uint32_t offsetForHashes() const { return offsetForHashes_; }

private:
  bool unitIsADC_;
  uint64_t totalChannels_;
  uint32_t offsetForHashes_;
  std::vector<float, cms::cuda::HostAllocator<float>> values_;
  std::vector<float, cms::cuda::HostAllocator<float>> widths_;

  cms::cuda::ESProduct<Product> product_;
#endif
};

#endif