Skip to content

Commit

Permalink
Merge pull request #47047 from makortel/useCachesInsteadOfESProducers
Browse files Browse the repository at this point in the history
Replace configuration-copying Alpaka ESProducers with MoveToDeviceCache
  • Loading branch information
cmsbuild authored Jan 14, 2025
2 parents f9fd695 + c43fa27 commit dcded52
Show file tree
Hide file tree
Showing 48 changed files with 517 additions and 827 deletions.
8 changes: 0 additions & 8 deletions CondFormats/DataRecord/interface/EcalMultifitParametersRcd.h

This file was deleted.

4 changes: 0 additions & 4 deletions CondFormats/DataRecord/src/EcalMultifitParametersRcd.cc

This file was deleted.

11 changes: 0 additions & 11 deletions CondFormats/EcalObjects/interface/EcalMultifitParametersHost.h

This file was deleted.

22 changes: 0 additions & 22 deletions CondFormats/EcalObjects/interface/EcalMultifitParametersSoA.h

This file was deleted.

9 changes: 0 additions & 9 deletions CondFormats/EcalObjects/interface/EcalRecHitParametersHost.h

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions CondFormats/EcalObjects/src/ES_EcalMultifitParametersHost.cc

This file was deleted.

4 changes: 0 additions & 4 deletions CondFormats/EcalObjects/src/ES_EcalRecHitParametersHost.cc

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions CondFormats/HcalObjects/interface/HcalMahiPulseOffsetsHost.h

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions CondFormats/HcalObjects/src/ES_HcalMahiPulseOffsetsHost.cc

This file was deleted.

This file was deleted.

42 changes: 42 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,47 @@ def customizeHLTfor47079(process):

return process


def customizeHLTfor47047(process):
"""Migrates many ESProducers to MoveToDeviceCache"""
import copy
if hasattr(process, "ecalMultifitParametersSource"):
del process.ecalMultifitParametersSource
esProducer = None
for prod in esproducers_by_type(process, "EcalMultifitParametersHostESProducer@alpaka"):
if esProducer is not None:
raise Exception("Assumption of only one EcalMultifitParametersHostESProducer@alpaka in a process broken")
esProducer = prod
if esProducer is not None:
for prod in producers_by_type(process, "EcalUncalibRecHitProducerPortable@alpaka", "alpaka_serial_sync::EcalUncalibRecHitProducerPortable"):
for attr in ["EBtimeFitParameters", "EEtimeFitParameters", "EBamplitudeFitParameters", "EEamplitudeFitParameters"]:
setattr(prod, attr, copy.deepcopy(getattr(esProducer, attr)))
delattr(process, esProducer.label())

for prod in producers_by_type(process, "HBHERecHitProducerPortable@alpaka", "alpaka_serial_sync::HBHERecHitProducerPortable"):
pulseOffsetLabel = prod.mahiPulseOffSets.getModuleLabel()
if hasattr(process, pulseOffsetLabel):
esProducer = getattr(process, pulseOffsetLabel)
prod.pulseOffsets = copy.deepcopy(esProducer.pulseOffsets)
del prod.mahiPulseOffSets
for prod in list(esproducers_by_type(process, "HcalMahiPulseOffsetsESProducer@alpaka")):
delattr(process, prod.label())

for prod in producers_by_type(process, "PFClusterSoAProducer@alpaka", "alpaka_serial_sync::PFClusterSoAProducer"):
clusterParamsLabel = prod.pfClusterParams.getModuleLabel()
if hasattr(process, clusterParamsLabel):
esProducer = getattr(process, clusterParamsLabel)
for attr in ["seedFinder", "initialClusteringStep", "pfClusterBuilder"]:
setattr(prod, attr, copy.deepcopy(getattr(esProducer, attr).copy()))
del prod.pfClusterParams
for prod in list(esproducers_by_type(process, "PFClusterParamsESProducer@alpaka")):
delattr(process, prod.label())

if hasattr(process, "hltESSJobConfigurationGPURecord"):
del process.hltESSJobConfigurationGPURecord

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

Expand All @@ -138,6 +179,7 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
process = customizeHLTfor46935(process)
process = customizeHLTfor47017(process)
process = customizeHLTfor47079(process)
process = customizeHLTfor47047(process)

return process

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef RecoLocalcalo_EcalRecProducers_plugins_alpaka_EcalMultifitParameters_h
#define RecoLocalcalo_EcalRecProducers_plugins_alpaka_EcalMultifitParameters_h

#include <array>

struct EcalMultifitParameters {
static constexpr size_t kNTimeFitParams = 8;
static constexpr size_t kNAmplitudeFitParams = 2;
using TimeFitParamsArray = std::array<float, kNTimeFitParams>;
using AmplitudeFitParamsArray = std::array<float, kNAmplitudeFitParams>;

TimeFitParamsArray timeFitParamsEB;
TimeFitParamsArray timeFitParamsEE;
AmplitudeFitParamsArray amplitudeFitParamsEB;
AmplitudeFitParamsArray amplitudeFitParamsEE;
};

#endif

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit {
OutputProduct& ebRecHits,
OutputProduct& eeRecHits,
EcalRecHitConditionsDevice const& conditionsDev,
EcalRecHitParametersDevice const& parametersDev,
EcalRecHitParameters const* parametersDev,
edm::TimeValue_t const& eventTime,
ConfigurationParameters const& configParams,
bool const isPhase2) {
Expand All @@ -44,7 +44,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit {
ebRecHits.view(),
eeRecHits.view(),
conditionsDev.const_view(),
parametersDev.const_data(),
parametersDev,
eventTime,
configParams);
} else {
Expand All @@ -54,7 +54,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit {
ebUncalibRecHits->const_view(),
ebRecHits.view(),
conditionsDev.const_view(),
parametersDev.const_data(),
parametersDev,
eventTime,
configParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Builder of ECAL RecHits on GPU
//

#include "CondFormats/EcalObjects/interface/EcalRecHitParameters.h"
#include "CondFormats/EcalObjects/interface/alpaka/EcalRecHitConditionsDevice.h"
#include "CondFormats/EcalObjects/interface/alpaka/EcalRecHitParametersDevice.h"
#include "DataFormats/EcalRecHit/interface/alpaka/EcalRecHitDeviceCollection.h"
#include "DataFormats/EcalRecHit/interface/alpaka/EcalUncalibratedRecHitDeviceCollection.h"
#include "DataFormats/Provenance/interface/Timestamp.h"
Expand All @@ -26,7 +26,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit {
OutputProduct& ebRecHits,
OutputProduct& eeRecHits,
EcalRecHitConditionsDevice const& conditionsDev,
EcalRecHitParametersDevice const& parametersDev,
EcalRecHitParameters const* parametersDev,
edm::TimeValue_t const& eventTime,
ConfigurationParameters const& configParams,
bool const isPhase2);
Expand Down
Loading

0 comments on commit dcded52

Please sign in to comment.