Skip to content

Commit

Permalink
Merge pull request #32039 from mariadalfonso/HCALcondGPU
Browse files Browse the repository at this point in the history
Patatrack integration - Hcal conditions (13/N)
  • Loading branch information
cmsbuild committed Dec 2, 2020
2 parents e066be0 + 041e3b9 commit 719f135
Show file tree
Hide file tree
Showing 35 changed files with 1,582 additions and 4 deletions.
19 changes: 19 additions & 0 deletions CondFormats/DataRecord/interface/HcalCombinedRecordsGPU.h
@@ -0,0 +1,19 @@
#ifndef CondFormats_DataRecord_interface_HcalCombinedRecordsGPU_h
#define CondFormats_DataRecord_interface_HcalCombinedRecordsGPU_h

#include "CondFormats/DataRecord/interface/HcalPedestalWidthsRcd.h"
#include "CondFormats/DataRecord/interface/HcalPedestalsRcd.h"
#include "CondFormats/DataRecord/interface/HcalQIEDataRcd.h"
#include "CondFormats/DataRecord/interface/HcalQIETypesRcd.h"
#include "FWCore/Framework/interface/DependentRecordImplementation.h"

template <typename... Sources>
class HcalCombinedRecord : public edm::eventsetup::DependentRecordImplementation<HcalCombinedRecord<Sources...>,
edm::mpl::Vector<Sources...>> {};

using HcalConvertedPedestalsRcd = HcalCombinedRecord<HcalPedestalsRcd, HcalQIEDataRcd, HcalQIETypesRcd>;

using HcalConvertedPedestalWidthsRcd =
HcalCombinedRecord<HcalPedestalsRcd, HcalPedestalWidthsRcd, HcalQIEDataRcd, HcalQIETypesRcd>;

#endif // CondFormats_DataRecord_interface_HcalCombinedRecordsGPU_h
5 changes: 5 additions & 0 deletions CondFormats/DataRecord/src/HcalCombinedRecordsGPU.cc
@@ -0,0 +1,5 @@
#include "CondFormats/DataRecord/interface/HcalCombinedRecordsGPU.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(HcalConvertedPedestalsRcd);
EVENTSETUP_RECORD_REG(HcalConvertedPedestalWidthsRcd);
10 changes: 6 additions & 4 deletions CondFormats/HcalObjects/BuildFile.xml
@@ -1,13 +1,15 @@
<ifrelease name="_UBSAN_">
<flags REM_CXXFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"/>
</ifrelease>
<use name="boost_serialization"/>
<use name="CondFormats/Serialization"/>
<use name="DataFormats/DetId"/>
<use name="DataFormats/HcalDetId"/>
<use name="Geometry/CaloTopology"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/MessageLogger"/>
<use name="CondFormats/Serialization"/>
<use name="boost_serialization"/>
<use name="FWCore/Utilities"/>
<use name="Geometry/CaloTopology"/>
<use name="HeterogeneousCore/CUDACore"/>
<use name="HeterogeneousCore/CUDAUtilities"/>
<export>
<lib name="1"/>
</export>
@@ -0,0 +1,12 @@
#ifndef CondFormats_HcalObjects_interface_HcalConvertedEffectivePedestalWidthsGPU_h
#define CondFormats_HcalObjects_interface_HcalConvertedEffectivePedestalWidthsGPU_h

#include "CondFormats/HcalObjects/interface/HcalConvertedPedestalWidthsGPU.h"

// similar to converted effective pedestals
class HcalConvertedEffectivePedestalWidthsGPU final : public HcalConvertedPedestalWidthsGPU {
public:
using HcalConvertedPedestalWidthsGPU::HcalConvertedPedestalWidthsGPU;
};

#endif // RecoLocalCalo_HcalRecAlgos_interface_HcalConvertedEffectivePedestalWidthsGPU_h
@@ -0,0 +1,14 @@
#ifndef CondFormats_HcalObjects_interface_HcalConvertedEffectivePedestalsGPU_h
#define CondFormats_HcalObjects_interface_HcalConvertedEffectivePedestalsGPU_h

#include "CondFormats/HcalObjects/interface/HcalConvertedPedestalsGPU.h"

// Separate access to effective and regular pedestals
// No need to transfer/rearrange effective or vice versa if they are not going
// to be used
class HcalConvertedEffectivePedestalsGPU final : public HcalConvertedPedestalsGPU {
public:
using HcalConvertedPedestalsGPU::HcalConvertedPedestalsGPU;
};

#endif // RecoLocalCalo_HcalRecAlgos_interface_HcalConvertedEffectivePedestalsGPU_h
43 changes: 43 additions & 0 deletions CondFormats/HcalObjects/interface/HcalConvertedPedestalWidthsGPU.h
@@ -0,0 +1,43 @@
#ifndef CondFormats_HcalObjects_interface_HcalConvertedPedestalWidthsGPU_h
#define CondFormats_HcalObjects_interface_HcalConvertedPedestalWidthsGPU_h

#include "CondFormats/HcalObjects/interface/HcalPedestalWidths.h"
#include "CondFormats/HcalObjects/interface/HcalPedestals.h"
#include "CondFormats/HcalObjects/interface/HcalQIEData.h"
#include "CondFormats/HcalObjects/interface/HcalQIETypes.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 HcalConvertedPedestalWidthsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> values;
};

#ifndef __CUDACC__
// order matters!
HcalConvertedPedestalWidthsGPU(HcalPedestals const&,
HcalPedestalWidths const&,
HcalQIEData const&,
HcalQIETypes const&);

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

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

private:
uint64_t totalChannels_;
std::vector<float, cms::cuda::HostAllocator<float>> values_;

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

#endif
42 changes: 42 additions & 0 deletions CondFormats/HcalObjects/interface/HcalConvertedPedestalsGPU.h
@@ -0,0 +1,42 @@
#ifndef CondFormats_HcalObjects_interface_HcalConvertedPedestalsGPU_h
#define CondFormats_HcalObjects_interface_HcalConvertedPedestalsGPU_h

#include "CondFormats/HcalObjects/interface/HcalPedestals.h"
#include "CondFormats/HcalObjects/interface/HcalQIEData.h"
#include "CondFormats/HcalObjects/interface/HcalQIETypes.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 HcalConvertedPedestalsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> values;
};

#ifndef __CUDACC__
// order matters!
HcalConvertedPedestalsGPU(HcalPedestals const&, HcalQIEData const&, HcalQIETypes const&);

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

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

uint32_t offsetForHashes() const { return offsetForHashes_; }

protected:
uint64_t totalChannels_;
uint32_t offsetForHashes_;
std::vector<float, cms::cuda::HostAllocator<float>> values_;

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

#endif
40 changes: 40 additions & 0 deletions CondFormats/HcalObjects/interface/HcalGainWidthsGPU.h
@@ -0,0 +1,40 @@
#ifndef CondFormats_HcalObjects_interface_HcalGainWidthsGPU_h
#define CondFormats_HcalObjects_interface_HcalGainWidthsGPU_h

#include "CondFormats/HcalObjects/interface/HcalGainWidths.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 HcalGainWidthsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> value0;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> value1;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> value2;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> value3;
};

#ifndef __CUDACC__
// rearrange reco params
HcalGainWidthsGPU(HcalGainWidths const &);

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

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

private:
uint64_t totalChannels_;
std::vector<float, cms::cuda::HostAllocator<float>> value0_, value1_, value2_, value3_;

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

#endif
37 changes: 37 additions & 0 deletions CondFormats/HcalObjects/interface/HcalGainsGPU.h
@@ -0,0 +1,37 @@
#ifndef CondFormats_HcalObjects_interface_HcalGainsGPU_h
#define CondFormats_HcalObjects_interface_HcalGainsGPU_h

#include "CondFormats/HcalObjects/interface/HcalGains.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 HcalGainsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> values;
};

#ifndef __CUDACC__
// rearrange reco params
HcalGainsGPU(HcalGains const&);

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

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

private:
uint64_t totalChannels_;
std::vector<float, cms::cuda::HostAllocator<float>> values_;

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

#endif
36 changes: 36 additions & 0 deletions CondFormats/HcalObjects/interface/HcalLUTCorrsGPU.h
@@ -0,0 +1,36 @@
#ifndef CondFormats_HcalObjects_interface_HcalLUTCorrsGPU_h
#define CondFormats_HcalObjects_interface_HcalLUTCorrsGPU_h

#include "CondFormats/HcalObjects/interface/HcalLUTCorrs.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 HcalLUTCorrsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> value;
};

#ifndef __CUDACC__
// rearrange reco params
HcalLUTCorrsGPU(HcalLUTCorrs const&);

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

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

private:
std::vector<float, cms::cuda::HostAllocator<float>> value_;

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

#endif
71 changes: 71 additions & 0 deletions CondFormats/HcalObjects/interface/HcalPedestalWidthsGPU.h
@@ -0,0 +1,71 @@
#ifndef CondFormats_HcalObjects_interface_HcalPedestalWidthsGPU_h
#define CondFormats_HcalObjects_interface_HcalPedestalWidthsGPU_h

#include "CondFormats/HcalObjects/interface/HcalPedestalWidths.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 HcalPedestalWidthsGPU {
public:
struct Product {
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma00;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma01;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma02;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma03;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma10;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma11;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma12;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma13;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma20;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma21;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma22;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma23;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma30;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma31;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma32;
edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma33;
};

#ifndef __CUDACC__
// rearrange reco params
HcalPedestalWidthsGPU(HcalPedestalWidths const&);

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

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

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

private:
bool unitIsADC_;
uint64_t totalChannels_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma00_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma01_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma02_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma03_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma10_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma11_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma12_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma13_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma20_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma21_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma22_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma23_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma30_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma31_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma32_;
std::vector<float, cms::cuda::HostAllocator<float>> sigma33_;

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

#endif
46 changes: 46 additions & 0 deletions CondFormats/HcalObjects/interface/HcalPedestalsGPU.h
@@ -0,0 +1,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

0 comments on commit 719f135

Please sign in to comment.