-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implementation of PFClusterSoAProducer
Includes implementation of the Alpaka-based PFClusterSoAProducer along with relevant SoA definitions. The atomicMaxF function is added in HeterogeneousCore/AlpakaInterface. Configuration additions and changes are made to run the SoA producer in CMSDriver commands. A DQM module is added to be used for cluster-level validation in a follow-up.
- Loading branch information
Showing
36 changed files
with
3,478 additions
and
1 deletion.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
DataFormats/ParticleFlowReco/interface/PFClusterHostCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_PFClusterHostCollection_h | ||
#define DataFormats_ParticleFlowReco_interface_PFClusterHostCollection_h | ||
|
||
#include "DataFormats/ParticleFlowReco/interface/PFClusterSoA.h" | ||
#include "DataFormats/Portable/interface/PortableHostCollection.h" | ||
|
||
namespace reco { | ||
|
||
using PFClusterHostCollection = PortableHostCollection<PFClusterSoA>; | ||
|
||
} // namespace reco | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_PFClusterHostCollection_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_PFClusterSoA_h | ||
#define DataFormats_ParticleFlowReco_interface_PFClusterSoA_h | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace reco { | ||
|
||
GENERATE_SOA_LAYOUT(PFClusterSoALayout, | ||
SOA_COLUMN(int, depth), | ||
SOA_COLUMN(int, seedRHIdx), | ||
SOA_COLUMN(int, topoId), | ||
SOA_COLUMN(int, rhfracSize), | ||
SOA_COLUMN(int, rhfracOffset), | ||
SOA_COLUMN(float, energy), | ||
SOA_COLUMN(float, x), | ||
SOA_COLUMN(float, y), | ||
SOA_COLUMN(float, z), | ||
SOA_COLUMN(int, topoRHCount), | ||
SOA_SCALAR(int, nTopos), | ||
SOA_SCALAR(int, nSeeds), | ||
SOA_SCALAR(int, nRHFracs), | ||
SOA_SCALAR(int, size) // nRH | ||
) | ||
using PFClusterSoA = PFClusterSoALayout<>; | ||
} // namespace reco | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_PFClusterSoA_h |
11 changes: 11 additions & 0 deletions
11
DataFormats/ParticleFlowReco/interface/PFRecHitFractionHostCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_PFRecHitFractionHostCollection_h | ||
#define DataFormats_ParticleFlowReco_interface_PFRecHitFractionHostCollection_h | ||
|
||
#include "DataFormats/ParticleFlowReco/interface/PFRecHitFractionSoA.h" | ||
#include "DataFormats/Portable/interface/PortableHostCollection.h" | ||
|
||
namespace reco { | ||
using PFRecHitFractionHostCollection = PortableHostCollection<PFRecHitFractionSoA>; | ||
} | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_PFRecHitFractionHostCollection_h |
18 changes: 18 additions & 0 deletions
18
DataFormats/ParticleFlowReco/interface/PFRecHitFractionSoA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_PFRecHitFractionSoA_h | ||
#define DataFormats_ParticleFlowReco_interface_PFRecHitFractionSoA_h | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace reco { | ||
|
||
GENERATE_SOA_LAYOUT(PFRecHitFractionSoALayout, | ||
SOA_COLUMN(float, frac), | ||
SOA_COLUMN(int, pfrhIdx), | ||
SOA_COLUMN(int, pfcIdx)) | ||
|
||
using PFRecHitFractionSoA = PFRecHitFractionSoALayout<>; | ||
} // namespace reco | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_PFRecHitFractionSoA_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
DataFormats/ParticleFlowReco/interface/alpaka/PFClusterDeviceCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_alpaka_PFClusterDeviceCollection_h | ||
#define DataFormats_ParticleFlowReco_interface_alpaka_PFClusterDeviceCollection_h | ||
|
||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFClusterSoA.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFClusterHostCollection.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE::reco { | ||
|
||
using ::reco::PFClusterHostCollection; | ||
|
||
using PFClusterDeviceCollection = PortableCollection<::reco::PFClusterSoA>; | ||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::reco | ||
|
||
// check that the portable device collection for the host device is the same as the portable host collection | ||
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(reco::PFClusterDeviceCollection, reco::PFClusterHostCollection); | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_alpaka_PFClusterDeviceCollection_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
DataFormats/ParticleFlowReco/interface/alpaka/PFRecHitFractionDeviceCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef DataFormats_ParticleFlowReco_interface_alpaka_PFRecHitFractionDeviceCollection_h | ||
#define DataFormats_ParticleFlowReco_interface_alpaka_PFRecHitFractionDeviceCollection_h | ||
|
||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFRecHitFractionSoA.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFRecHitFractionHostCollection.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE::reco { | ||
|
||
using ::reco::PFRecHitFractionHostCollection; | ||
|
||
using PFRecHitFractionDeviceCollection = PortableCollection<::reco::PFRecHitFractionSoA>; | ||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::reco | ||
|
||
// check that the portable device collection for the host device is the same as the portable host collection | ||
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(reco::PFRecHitFractionDeviceCollection, reco::PFRecHitFractionHostCollection); | ||
|
||
#endif // DataFormats_ParticleFlowReco_interface_alpaka_PFRecHitFractionDeviceCollection_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef HeterogeneousCore_AlpakaCore_interface_atomicMaxF_h | ||
#define HeterogeneousCore_AlpakaCore_interface_atomicMaxF_h | ||
#include <alpaka/alpaka.hpp> | ||
|
||
#include "FWCore/Utilities/interface/bit_cast.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
|
||
#if defined(__CUDA_ARCH__) or defined(__HIP_DEVICE_COMPILE__) | ||
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>> | ||
static __device__ __forceinline__ float atomicMaxF(const TAcc& acc, float* address, float val) { | ||
int ret = __float_as_int(*address); | ||
while (val > __int_as_float(ret)) { | ||
int old = ret; | ||
if ((ret = atomicCAS((int*)address, old, __float_as_int(val))) == old) | ||
break; | ||
} | ||
return __int_as_float(ret); | ||
} | ||
#else | ||
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>> | ||
ALPAKA_FN_ACC ALPAKA_FN_INLINE static float atomicMaxF(const TAcc& acc, float* address, float val) { | ||
// CPU implementation uses edm::bit_cast | ||
int ret = edm::bit_cast<int>(*address); | ||
while (val > edm::bit_cast<float>(ret)) { | ||
int old = ret; | ||
if ((ret = alpaka::atomicCas(acc, (int*)address, old, edm::bit_cast<int>(val))) == old) | ||
break; | ||
} | ||
return edm::bit_cast<float>(ret); | ||
} | ||
#endif // __CUDA_ARCH__ or __HIP_DEVICE_COMPILE__ | ||
|
||
#endif // HeterogeneousCore_AlpakaCore_interface_atomicMaxF_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
RecoParticleFlow/PFClusterProducer/interface/PFClusterParamsHostCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef RecoParticleFlow_PFClusterProducer_interface_PFClusterParamsHostCollection_h | ||
#define RecoParticleFlow_PFClusterProducer_interface_PFClusterParamsHostCollection_h | ||
|
||
#include "DataFormats/Portable/interface/PortableHostCollection.h" | ||
|
||
#include "RecoParticleFlow/PFClusterProducer/interface/PFClusterParamsSoA.h" | ||
|
||
namespace reco { | ||
|
||
using PFClusterParamsHostCollection = PortableHostCollection<PFClusterParamsSoA>; | ||
|
||
} | ||
|
||
#endif |
49 changes: 49 additions & 0 deletions
49
RecoParticleFlow/PFClusterProducer/interface/PFClusterParamsSoA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef RecoParticleFlow_PFClusterProducer_interface_PFRecHitHBHEParamsSoA_h | ||
#define RecoParticleFlow_PFClusterProducer_interface_PFRecHitHBHEParamsSoA_h | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace reco { | ||
|
||
GENERATE_SOA_LAYOUT(PFClusterParamsSoALayout, | ||
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 PFClusterParamsSoA = PFClusterParamsSoALayout<>; | ||
|
||
} // namespace reco | ||
|
||
#endif |
17 changes: 17 additions & 0 deletions
17
RecoParticleFlow/PFClusterProducer/interface/PFClusteringEdgeVarsSoA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef RecoParticleFlow_PFRecHitProducer_interface_PFClusteringEdgeVarsSoA_h | ||
#define RecoParticleFlow_PFRecHitProducer_interface_PFClusteringEdgeVarsSoA_h | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace reco { | ||
|
||
GENERATE_SOA_LAYOUT(PFClusteringEdgeVarsSoALayout, | ||
SOA_COLUMN(int, pfrh_edgeIdx), // needs nRH + 1 allocation | ||
SOA_COLUMN(int, pfrh_edgeList)) // needs nRH + maxNeighbors allocation | ||
|
||
using PFClusteringEdgeVarsSoA = PFClusteringEdgeVarsSoALayout<>; | ||
} // namespace reco | ||
|
||
#endif |
31 changes: 31 additions & 0 deletions
31
RecoParticleFlow/PFClusterProducer/interface/PFClusteringVarsSoA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef RecoParticleFlow_PFClusterProducer_interface_PFClusteringVarsSoA_h | ||
#define RecoParticleFlow_PFClusterProducer_interface_PFClusteringVarsSoA_h | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace reco { | ||
|
||
GENERATE_SOA_LAYOUT(PFClusteringVarsSoALayout, | ||
SOA_COLUMN(int, pfrh_topoId), | ||
SOA_COLUMN(int, pfrh_isSeed), | ||
SOA_COLUMN(int, pfrh_passTopoThresh), | ||
SOA_COLUMN(int, topoSeedCount), | ||
SOA_COLUMN(int, topoRHCount), | ||
SOA_COLUMN(int, seedFracOffsets), | ||
SOA_COLUMN(int, topoSeedOffsets), | ||
SOA_COLUMN(int, topoSeedList), | ||
SOA_SCALAR(int, pcrhFracSize), | ||
SOA_COLUMN(int, rhCount), | ||
SOA_SCALAR(int, nEdges), | ||
SOA_COLUMN(int, rhcount), | ||
SOA_SCALAR(int, nTopos), | ||
SOA_COLUMN(int, topoIds), | ||
SOA_SCALAR(int, nRHFracs), | ||
SOA_COLUMN(int, rhIdxToSeedIdx)) | ||
|
||
using PFClusteringVarsSoA = PFClusteringVarsSoALayout<>; | ||
} // namespace reco | ||
|
||
#endif |
Oops, something went wrong.