Skip to content

Commit

Permalink
Merge pull request cms-sw#7 from missirol/devel_pfClusParamsESSource
Browse files Browse the repository at this point in the history
Copy PF-Clustering parameters to device via `ESSource`
  • Loading branch information
jsamudio authored Feb 22, 2023
2 parents 31b5750 + 2e6b019 commit 2eed927
Show file tree
Hide file tree
Showing 16 changed files with 883 additions and 378 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
process.load("RecoParticleFlow.PFClusterProducer.pfhbheRecHitParamsGPUESProducer_cfi")
process.load("RecoParticleFlow.PFClusterProducer.pfhbheTopologyGPUESProducer_cfi")

from RecoParticleFlow.PFClusterProducer.pfClusteringParamsGPUESSource_cfi import pfClusteringParamsGPUESSource as _pfClusteringParamsGPUESSource
process.pfClusteringParamsGPUESSource = _pfClusteringParamsGPUESSource.clone()

# Automatic addition of the customisation function from HLTrigger.Configuration.customizeHLTforPatatrack
#from HLTrigger.Configuration.customizeHLTforPatatrack import customizeHLTforPatatrack, customiseCommon, customiseHcalLocalReconstruction

Expand Down
7 changes: 7 additions & 0 deletions RecoParticleFlow/Configuration/test/testPFOnGPUvsCPU_HBHE.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e

[ ! -z "${CMSSW_BASE}" ] || exit 1

cmsRun "${CMSSW_BASE}"/src/RecoParticleFlow/Configuration/test/run_HBHEandPF_onCPUandGPU.py
cmsRun "${CMSSW_BASE}"/src/Validation/RecoParticleFlow/test/run_DQM_forGPU_HLT.py
cmsRun "${CMSSW_BASE}"/src/Validation/RecoParticleFlow/test/run_HARVESTING_forGPU_HLT.py &> /dev/null
5 changes: 5 additions & 0 deletions RecoParticleFlow/PFClusterProducer/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<use name="CalibCalorimetry/EcalTPGTools"/>
<use name="DataFormats/HGCRecHit"/>
<use name="RecoLocalCalo/HGCalRecAlgos"/>
<use name="FWCore/Utilities"/>
<use name="HeterogeneousCore/CUDACore"/>
<use name="HeterogeneousCore/CUDAUtilities"/>
<use name="CUDADataFormats/Common"/>
<use name="DataFormats/SoATemplate"/>
<use name="vdt_headers"/>
<use name="rootmath"/>
<use name="root"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#ifndef RecoParticleFlow_PFClusterProducer_PFClusteringParamsGPU_h
#define RecoParticleFlow_PFClusterProducer_PFClusteringParamsGPU_h

#include <vector>

#include "FWCore/Utilities/interface/propagate_const.h"
#include "FWCore/Utilities/interface/propagate_const_array.h"
#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
#include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h"

#include "CUDADataFormats/Common/interface/PortableDeviceCollection.h"
#include "CUDADataFormats/Common/interface/PortableHostCollection.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"

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

namespace edm {
class ParameterSet;
class ParameterSetDescription;
}

class PFClusteringParamsGPU {
public:
GENERATE_SOA_LAYOUT(ProductSoALayout,
SOA_SCALAR(int32_t, nNeigh),
SOA_SCALAR(float, seedPt2ThresholdEB),
SOA_SCALAR(float, seedPt2ThresholdEE),
SOA_COLUMN(float, seedEThresholdEB_vec),
SOA_COLUMN(float, seedEThresholdEE_vec),
SOA_COLUMN(float, topoEThresholdEB_vec),
SOA_COLUMN(float, topoEThresholdEE_vec),
SOA_SCALAR(float, showerSigma2),
SOA_SCALAR(float, minFracToKeep),
SOA_SCALAR(float, minFracTot),
SOA_SCALAR(uint32_t, maxIterations),
SOA_SCALAR(bool, excludeOtherSeeds),
SOA_SCALAR(float, stoppingTolerance),
SOA_SCALAR(float, minFracInCalc),
SOA_SCALAR(float, minAllowedNormalization),
SOA_COLUMN(float, recHitEnergyNormInvEB_vec),
SOA_COLUMN(float, recHitEnergyNormInvEE_vec),
SOA_SCALAR(float, barrelTimeResConsts_corrTermLowE),
SOA_SCALAR(float, barrelTimeResConsts_threshLowE),
SOA_SCALAR(float, barrelTimeResConsts_noiseTerm),
SOA_SCALAR(float, barrelTimeResConsts_constantTermLowE2),
SOA_SCALAR(float, barrelTimeResConsts_noiseTermLowE),
SOA_SCALAR(float, barrelTimeResConsts_threshHighE),
SOA_SCALAR(float, barrelTimeResConsts_constantTerm2),
SOA_SCALAR(float, barrelTimeResConsts_resHighE2),
SOA_SCALAR(float, endcapTimeResConsts_corrTermLowE),
SOA_SCALAR(float, endcapTimeResConsts_threshLowE),
SOA_SCALAR(float, endcapTimeResConsts_noiseTerm),
SOA_SCALAR(float, endcapTimeResConsts_constantTermLowE2),
SOA_SCALAR(float, endcapTimeResConsts_noiseTermLowE),
SOA_SCALAR(float, endcapTimeResConsts_threshHighE),
SOA_SCALAR(float, endcapTimeResConsts_constantTerm2),
SOA_SCALAR(float, endcapTimeResConsts_resHighE2))

using HostProduct = cms::cuda::PortableHostCollection<ProductSoALayout<>>;
using DeviceProduct = cms::cuda::PortableDeviceCollection<ProductSoALayout<>>;

#ifndef __CUDACC__
PFClusteringParamsGPU(edm::ParameterSet const&);
~PFClusteringParamsGPU() = default;

static void fillDescription(edm::ParameterSetDescription& psetDesc);

DeviceProduct const& getProduct(cudaStream_t) const;

private:
constexpr static uint32_t kMaxDepth_barrel = 4;
constexpr static uint32_t kMaxDepth_endcap = 7;

void setParameterValues(edm::ParameterSet const& iConfig);

HostProduct params_;
cms::cuda::ESProduct<DeviceProduct> product_;
#endif
};

#endif // RecoParticleFlow_PFClusterProducer_PFClusteringParamsGPU_h
9 changes: 8 additions & 1 deletion RecoParticleFlow/PFClusterProducer/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<library name="RecoParticleFlowPFClusterProducerPlugins" file="*.cc *.cu">
<iftool name="cuda-gcc-support">
<use name="cuda"/>
<set name="cuda_src" value="*.cu"/>
<else/>
<set name="cuda_src" value=""/>
</iftool>

<library name="RecoParticleFlowPFClusterProducerPlugins" file="*.cc ${cuda_src}">
<use name="CondFormats/HcalObjects"/>
<use name="CondFormats/EcalObjects"/>
<use name="CondFormats/DataRecord"/>
Expand Down
Loading

0 comments on commit 2eed927

Please sign in to comment.