Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import FWCore.ParameterSet.Config as cms

# This modifier enables the portable (alpaka) HLT electron pixel-seed matching,
# replacing ElectronNHitSeedProducer with the ElectronNHitSeedAlpakaProducer +
# ElectronSeedConverter pair.
egammaPixelSeedingPortable = cms.Modifier()
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The offsets currently in use are:
* 0.7502: HLT phase-2 menu, with tracking ntuple
* 0.7503: HLT phase-2 menu, CPU vs. GPU validation
* 0.751: HLT phase-2 timing menu Alpaka variant
* 0.7511: HLT phase-2 timing menu with portable e/gamma pixel seeding
* 0.7521: HLT phase-2 timing menu ticlv5TrackLinkingGNN variant
* 0.7522: HLT phase-2 timing menu mtd_at_hlt variant
* 0.753: HLT phase-2 timing menu legacy tracking
Expand Down
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/python/relval_Run4.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
numWFIB.extend([prefixDet+34.7502]) # HLTTrackingNtuple75e33
numWFIB.extend([prefixDet+34.7503]) # HLTHeterogeneousValid
numWFIB.extend([prefixDet+34.751]) # HLTTiming75e33, alpaka
numWFIB.extend([prefixDet+34.7511]) # HLTTiming75e33, portable e/gamma pixel seeding
numWFIB.extend([prefixDet+34.7521]) # HLTTiming75e33, ticlv5TrackLinkingGNN
numWFIB.extend([prefixDet+34.7522]) # HLTTiming75e33, mtd_at_hlt
numWFIB.extend([prefixDet+34.753]) # HLTTiming75e33, legacy tracking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,11 @@ def condition(self, fragment, stepList, key, hasHarvest):
upgradeWFs['HLTTiming75e33Alpaka'].offset = 0.751
upgradeWFs['HLTTiming75e33Alpaka'].step2['--procModifiers'] = 'alpaka'

upgradeWFs['HLTTiming75e33EgammaSeedingPortable'] = deepcopy(upgradeWFs['HLTTiming75e33'])
upgradeWFs['HLTTiming75e33EgammaSeedingPortable'].suffix = '_HLT75e33TimingEgammaSeedingPortable'
upgradeWFs['HLTTiming75e33EgammaSeedingPortable'].offset = 0.7511
upgradeWFs['HLTTiming75e33EgammaSeedingPortable'].step2['--procModifiers'] = 'egammaPixelSeedingPortable'

upgradeWFs['HLTTiming75e33TiclV5TrackLinkingGNN'] = deepcopy(upgradeWFs['HLTTiming75e33'])
upgradeWFs['HLTTiming75e33TiclV5TrackLinkingGNN'].suffix = '_HLT75e33TimingTiclV5TrackLinkGNN'
upgradeWFs['HLTTiming75e33TiclV5TrackLinkingGNN'].offset = 0.7521
Expand Down
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/scripts/runTheMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def runSelected(opt):
prefixDet+34.7502, # HLT phase-2 tracking menu with tracking ntuple
prefixDet+34.7503, # HLT phase-2 menu, CPU vs. GPU validation
prefixDet+34.751, # HLT phase-2 timing menu Alpaka variant
prefixDet+34.7511, # HLT phase-2 timing menu with portable e/gamma pixel seeding
prefixDet+34.7521, # HLT phase-2 timing menu ticlv5TrackLinkGNN variant
prefixDet+34.7522, # HLT phase-2 timing menu mtd_at_hlt variant
prefixDet+34.753, # HLT phase-2 timing menu legacy tracking
Expand Down
5 changes: 5 additions & 0 deletions DataFormats/EgammaReco/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<use name="eigen"/>
<use name="rootcling"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/EcalRecHit"/>
Expand All @@ -9,6 +10,10 @@
<use name="DataFormats/DetId"/>
<use name="DataFormats/Math"/>
<use name="DataFormats/TrajectoryState"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="DataFormats/SoATemplate"/>
<use name="DataFormats/Portable"/>
<flags ALPAKA_BACKENDS="!serial"/>
<export>
<lib name="1"/>
</export>
13 changes: 13 additions & 0 deletions DataFormats/EgammaReco/interface/ElectronSeedHostCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef DataFormats_EgammaReco_interface_ElectronSeedHostCollection_h
#define DataFormats_EgammaReco_interface_ElectronSeedHostCollection_h

#include <Eigen/Core>
#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/PortableTestObjects/interface/TestSoA.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"

namespace reco {
using ElectronSeedHostCollection = PortableHostCollection<ElectronSeedSoA>;
} // namespace reco

#endif // DataFormats_EgammaReco_interface_ElectronSeedHostCollection_h
41 changes: 41 additions & 0 deletions DataFormats/EgammaReco/interface/ElectronSeedSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef DataFormats_EgammaReco_interface_ElectronSeedSoA_h
#define DataFormats_EgammaReco_interface_ElectronSeedSoA_h

#include <Eigen/Core>
#include <cstdint>
#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"

namespace reco {

using Vector3d = Eigen::Matrix<double, 3, 1>;
using Vector3f = Eigen::Matrix<float, 3, 1>;

GENERATE_SOA_LAYOUT(ElectronSeedLayout,
SOA_COLUMN(int8_t, nHits),
SOA_COLUMN(int8_t, isMatched),
SOA_COLUMN(int16_t, matchedScID),
SOA_COLUMN(int32_t, id),
SOA_COLUMN(int16_t, hit0detectorID),
SOA_COLUMN(int16_t, hit0isValid),
SOA_COLUMN(int16_t, hit1detectorID),
SOA_COLUMN(int16_t, hit1isValid),
SOA_COLUMN(int16_t, hit2detectorID),
SOA_COLUMN(int16_t, hit2isValid),
SOA_EIGEN_COLUMN(Vector3d, hit0Pos),
SOA_EIGEN_COLUMN(Vector3d, surf0Pos),
SOA_EIGEN_COLUMN(Vector3d, surf0Rot),
SOA_EIGEN_COLUMN(Vector3d, hit1Pos),
SOA_EIGEN_COLUMN(Vector3d, surf1Pos),
SOA_EIGEN_COLUMN(Vector3d, surf1Rot),
SOA_EIGEN_COLUMN(Vector3d, hit2Pos),
SOA_EIGEN_COLUMN(Vector3d, surf2Pos),
SOA_EIGEN_COLUMN(Vector3d, surf2Rot),
Comment on lines +25 to +33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double vs float ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for the PMVars_* I can say that they currently are used created as float only, and the EDFilters making a decision based only compare the PMVars with float. That's why I implemented them as float instead of double.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I wasn't very clear.

float is much better from the performance point of view, and somewhat better from the memory usage point of view.

double is what we tend to use "by default", at leas in legacy CPU code.

I would ask to evaluate what is the impact on the physics results and on the stability and reproducibility of doing the computation in single precision, or even doing some computations in double precision but storing the variable in single precision.

SOA_EIGEN_COLUMN(Vector3f, PMVars_dRZPos),
SOA_EIGEN_COLUMN(Vector3f, PMVars_dRZNeg),
SOA_EIGEN_COLUMN(Vector3f, PMVars_dPhiPos),
SOA_EIGEN_COLUMN(Vector3f, PMVars_dPhiNeg))
using ElectronSeedSoA = ElectronSeedLayout<>;
} // namespace reco

#endif
14 changes: 14 additions & 0 deletions DataFormats/EgammaReco/interface/SuperClusterHostCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef DataFormats_EgammaReco_interface_SuperClusterHostCollection_h
#define DataFormats_EgammaReco_interface_SuperClusterHostCollection_h

#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"

namespace reco {

// SoA with x, y, z, id fields in host memory
using SuperClusterHostCollection = PortableHostCollection<SuperClusterSoA>;

} // namespace reco

#endif // DataFormats_EgammaReco_interface_SuperClusterHostCollection_h
21 changes: 21 additions & 0 deletions DataFormats/EgammaReco/interface/SuperClusterSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef DataFormats_EgammaReco_interface_SuperClusterSoA_h
#define DataFormats_EgammaReco_interface_SuperClusterSoA_h

#include <cstdint>
#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"

namespace reco {

// SoA layout for supercluster
GENERATE_SOA_LAYOUT(SuperClusterSoALayout,
// columns: one value per element
SOA_COLUMN(double, scSeedTheta),
SOA_COLUMN(double, scPhi),
SOA_COLUMN(double, scR),
SOA_COLUMN(double, scEnergy),
Comment on lines +13 to +16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be double?
Would float provide enough precision?

SOA_COLUMN(int32_t, id))
using SuperClusterSoA = SuperClusterSoALayout<>;
} // namespace reco

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef DataFormats_EgammaReco_interface_alpaka_ElectronSeedDeviceCollection_h
#define DataFormats_EgammaReco_interface_alpaka_ElectronSeedDeviceCollection_h

#include <Eigen/Core>
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/PortableTestObjects/interface/TestSoA.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE::reco {
using namespace ::reco;
using ElectronSeedDeviceCollection = PortableCollection<ElectronSeedSoA>;
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::reco

#endif // DataFormats_EgammaReco_interface_alpaka_ElectronSeedDeviceCollection_h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef DataFormats_EgammaReco_interface_alpaka_SuperClusterDeviceCollection_h
#define DataFormats_EgammaReco_interface_alpaka_SuperClusterDeviceCollection_h

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

namespace reco {

using namespace ::reco;
using SuperClusterDeviceCollection = PortableCollection<SuperClusterSoA>;

} // namespace reco

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

#endif // DataFormats_EgammaReco_interface_alpaka_SuperClusterDeviceCollection_h
9 changes: 9 additions & 0 deletions DataFormats/EgammaReco/src/alpaka/classes_cuda.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <Eigen/Core>
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/Common/interface/Wrapper.h"

#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"
#include "DataFormats/EgammaReco/interface/alpaka/SuperClusterDeviceCollection.h"

#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"
#include "DataFormats/EgammaReco/interface/alpaka/ElectronSeedDeviceCollection.h"
9 changes: 9 additions & 0 deletions DataFormats/EgammaReco/src/alpaka/classes_cuda_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<lcgdict>
<class name="alpaka_cuda_async::reco::SuperClusterDeviceCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::reco::SuperClusterDeviceCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::reco::SuperClusterDeviceCollection>>" persistent="false"/>

<class name="alpaka_cuda_async::reco::ElectronSeedDeviceCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::reco::ElectronSeedDeviceCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::reco::ElectronSeedDeviceCollection>>" persistent="false"/>
</lcgdict>
10 changes: 10 additions & 0 deletions DataFormats/EgammaReco/src/alpaka/classes_rocm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <Eigen/Core>

#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/Common/interface/Wrapper.h"

#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"
#include "DataFormats/EgammaReco/interface/alpaka/SuperClusterDeviceCollection.h"

#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"
#include "DataFormats/EgammaReco/interface/alpaka/ElectronSeedDeviceCollection.h"
9 changes: 9 additions & 0 deletions DataFormats/EgammaReco/src/alpaka/classes_rocm_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<lcgdict>
<class name="alpaka_rocm_async::reco::SuperClusterDeviceCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::reco::SuperClusterDeviceCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::reco::SuperClusterDeviceCollection>>" persistent="false"/>

<class name="alpaka_rocm_async::reco::ElectronSeedDeviceCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::reco::ElectronSeedDeviceCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::reco::ElectronSeedDeviceCollection>>" persistent="false"/>
</lcgdict>
10 changes: 10 additions & 0 deletions DataFormats/EgammaReco/src/classes.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <Eigen/Core>
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/EgammaReco/interface/SuperClusterHostCollection.h"
#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedHostCollection.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"
#include "DataFormats/Portable/interface/PortableHostCollectionReadRules.h"

SET_PORTABLEHOSTCOLLECTION_READ_RULES(reco::SuperClusterHostCollection);
SET_PORTABLEHOSTCOLLECTION_READ_RULES(reco::ElectronSeedHostCollection);
5 changes: 5 additions & 0 deletions DataFormats/EgammaReco/src/classes.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <Eigen/Core>
#include "DataFormats/EgammaReco/interface/SuperClusterSoA.h"
#include "DataFormats/EgammaReco/interface/SuperClusterHostCollection.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedSoA.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedHostCollection.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/AtomicPtrCache.h"
#include "DataFormats/EgammaReco/interface/BasicCluster.h"
Expand Down
14 changes: 14 additions & 0 deletions DataFormats/EgammaReco/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<lcgdict>

<class name="reco::SuperClusterHostCollection" rntupleStreamerMode="true"/>
<!-- reco::SuperClusterHostCollection::Layout alias must be listed before the aliased-to type -->
<class name="reco::SuperClusterHostCollection::Layout"/>
<class name="reco::SuperClusterSoA"/>
<class name="reco::SuperClusterSoA::View"/>
<class name="edm::Wrapper<reco::SuperClusterHostCollection>" splitLevel="0"/>

<class name="reco::ElectronSeedHostCollection" rntupleStreamerMode="true"/>
<!-- reco::ElectronSeedHostCollection::Layout alias must be listed before the aliased-to type -->
<class name="reco::ElectronSeedHostCollection::Layout"/>
<class name="reco::ElectronSeedSoA"/>
<class name="reco::ElectronSeedSoA::View"/>
<class name="edm::Wrapper<reco::ElectronSeedHostCollection>" splitLevel="0"/>

<class name="edm::RefToBase<reco::io_v1::CaloCluster>" rntupleStreamerMode="true"/>
<class name="edm::reftobase::BaseHolder<reco::io_v1::CaloCluster>"/>
<class name="edm::reftobase::IndirectHolder<reco::io_v1::CaloCluster>" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@
superClusters = cms.VInputTag("hltEgammaSuperClustersToPixelMatchL1Seeded"),
vertices = cms.InputTag("")
)

from Configuration.ProcessModifiers.egammaPixelSeedingPortable_cff import egammaPixelSeedingPortable
_hltEgammaElectronPixelSeedsL1SeededFromSoA = cms.EDProducer("ElectronSeedConverter",
beamSpot = cms.InputTag("hltOnlineBeamSpot"),
detLayerGeom = cms.ESInputTag("","GlobalDetLayerGeometry"),
eleSeedsSoA = cms.InputTag("hltEgammaElectronPixelSeedsPortable"),
initialSeeds = cms.InputTag("hltElePixelSeedsCombinedL1Seeded"),
measTkEvt = cms.InputTag("hltMeasurementTrackerEvent"),
navSchool = cms.ESInputTag("","SimpleNavigationSchool"),
superClusters = cms.InputTag("hltEgammaSuperClustersToPixelMatchL1Seeded")
)
egammaPixelSeedingPortable.toReplaceWith(hltEgammaElectronPixelSeedsL1Seeded, _hltEgammaElectronPixelSeedsL1SeededFromSoA)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

hltEgammaElectronPixelSeedsPortable = cms.EDProducer("ElectronNHitSeedAlpakaProducer@alpaka",
beamSpot = cms.InputTag("hltOnlineBeamSpot"),
initialSeeds = cms.InputTag("hltElePixelSeedsCombinedL1Seeded"),
superClusters = cms.InputTag("hltEgammaSuperClustersToPixelMatchL1Seeded")
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ..modules.hltEgammaHoverEL1Seeded_cfi import *
from ..modules.hltEgammaElectronPixelSeedsL1Seeded_cfi import *
from ..modules.hltEgammaElectronPixelSeedsPortable_cfi import *
from ..modules.hltEgammaPixelMatchVarsL1Seeded_cfi import *
from ..modules.hltEgammaSuperClustersToPixelMatchL1Seeded_cfi import *
from ..modules.hltElePixelHitDoubletsForTripletsL1Seeded_cfi import *
Expand Down Expand Up @@ -35,3 +36,10 @@
+hltElePixelSeedsCombinedL1Seeded
+hltEgammaElectronPixelSeedsL1Seeded
+hltEgammaPixelMatchVarsL1Seeded))

from Configuration.ProcessModifiers.egammaPixelSeedingPortable_cff import egammaPixelSeedingPortable
_HLTElePixelMatchL1SeededSequencePortable = HLTElePixelMatchL1SeededSequence.copy()
_HLTElePixelMatchL1SeededSequencePortable.replace(
hltEgammaElectronPixelSeedsL1Seeded,
hltEgammaElectronPixelSeedsPortable+hltEgammaElectronPixelSeedsL1Seeded)
egammaPixelSeedingPortable.toReplaceWith(HLTElePixelMatchL1SeededSequence, _HLTElePixelMatchL1SeededSequencePortable)
1 change: 1 addition & 0 deletions RecoEgamma/EgammaElectronAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="MagneticField/Engine"/>
<use name="MagneticField/Portable"/>
<use name="DataFormats/DetId"/>
<use name="DataFormats/TrackingRecHit"/>
<use name="DataFormats/GsfTrackReco"/>
Expand Down
Loading