Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECAL RecHit producer Alpaka migration #46453

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
27 changes: 27 additions & 0 deletions CondFormats/DataRecord/interface/EcalRecHitConditionsRcd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef CondFormats_DataRecord_EcalRecHitConditionsRcd_h
#define CondFormats_DataRecord_EcalRecHitConditionsRcd_h

#include "FWCore/Framework/interface/DependentRecordImplementation.h"

#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h"
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h"
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h"
#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h"
#include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h"
#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h"
#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h"

class EcalRecHitConditionsRcd
: public edm::eventsetup::DependentRecordImplementation<EcalRecHitConditionsRcd,
edm::mpl::Vector<EcalADCToGeVConstantRcd,
EcalChannelStatusRcd,
EcalIntercalibConstantsRcd,
EcalLaserAPDPNRatiosRcd,
EcalLaserAPDPNRatiosRefRcd,
EcalLaserAlphasRcd,
EcalLinearCorrectionsRcd,
EcalTimeCalibConstantsRcd,
EcalTimeOffsetConstantRcd>> {};
#endif
8 changes: 8 additions & 0 deletions CondFormats/DataRecord/interface/EcalRecHitParametersRcd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef CondFormats_DataRecord_EcalRecHitParametersRcd_h
#define CondFormats_DataRecord_EcalRecHitParametersRcd_h

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"

class EcalRecHitParametersRcd : public edm::eventsetup::EventSetupRecordImplementation<EcalRecHitParametersRcd> {};

#endif
4 changes: 4 additions & 0 deletions CondFormats/DataRecord/src/EcalRecHitConditionsRcd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/DataRecord/interface/EcalRecHitConditionsRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(EcalRecHitConditionsRcd);
4 changes: 4 additions & 0 deletions CondFormats/DataRecord/src/EcalRecHitParametersRcd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/DataRecord/interface/EcalRecHitParametersRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(EcalRecHitParametersRcd);
11 changes: 11 additions & 0 deletions CondFormats/EcalObjects/interface/EcalRecHitConditionsHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CondFormats_EcalObjects_interface_EcalRecHitConditionsHost_h
#define CondFormats_EcalObjects_interface_EcalRecHitConditionsHost_h

#include "CondFormats/EcalObjects/interface/EcalRecHitConditionsSoA.h"
#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"

using EcalRecHitConditionsHost = PortableHostCollection<EcalRecHitConditionsSoA>;

#endif
46 changes: 46 additions & 0 deletions CondFormats/EcalObjects/interface/EcalRecHitConditionsSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef CondFormats_EcalObjects_EcalRecHitConditionsSoA_h
#define CondFormats_EcalObjects_EcalRecHitConditionsSoA_h

#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"
#include "DataFormats/SoATemplate/interface/SoAView.h"
#include "DataFormats/Provenance/interface/Timestamp.h"

GENERATE_SOA_LAYOUT(EcalRecHitConditionsSoALayout,
SOA_COLUMN(uint32_t, rawid),
// energy intercalibrations
SOA_COLUMN(float, intercalibConstants),
// time intercalibrations
SOA_COLUMN(float, timeCalibConstants),
// channel status
SOA_COLUMN(uint16_t, channelStatus),
// laser APDPN ratios
SOA_COLUMN(float, laserAPDPNRatios_p1),
SOA_COLUMN(float, laserAPDPNRatios_p2),
SOA_COLUMN(float, laserAPDPNRatios_p3),
SOA_COLUMN(edm::TimeValue_t, laserAPDPNRatios_t1),
SOA_COLUMN(edm::TimeValue_t, laserAPDPNRatios_t2),
SOA_COLUMN(edm::TimeValue_t, laserAPDPNRatios_t3),
// laser APDPN reference
SOA_COLUMN(float, laserAPDPNref),
// laser alphas
SOA_COLUMN(float, laserAlpha),
// linear corrections
SOA_COLUMN(float, linearCorrections_p1),
SOA_COLUMN(float, linearCorrections_p2),
SOA_COLUMN(float, linearCorrections_p3),
SOA_COLUMN(edm::TimeValue_t, linearCorrections_t1),
SOA_COLUMN(edm::TimeValue_t, linearCorrections_t2),
SOA_COLUMN(edm::TimeValue_t, linearCorrections_t3),
// ADC to GeV constants
SOA_SCALAR(float, adcToGeVConstantEB),
SOA_SCALAR(float, adcToGeVConstantEE),
// time offsets constants
SOA_SCALAR(float, timeOffsetConstantEB),
SOA_SCALAR(float, timeOffsetConstantEE),
// offset for hashed ID access to EE items of columns
SOA_SCALAR(uint32_t, offsetEE))

using EcalRecHitConditionsSoA = EcalRecHitConditionsSoALayout<>;

#endif
11 changes: 11 additions & 0 deletions CondFormats/EcalObjects/interface/EcalRecHitParametersHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CondFormats_EcalObjects_interface_EcalRecHitParametersHost_h
#define CondFormats_EcalObjects_interface_EcalRecHitParametersHost_h

#include "CondFormats/EcalObjects/interface/EcalRecHitParametersSoA.h"
#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"

using EcalRecHitParametersHost = PortableHostCollection<EcalRecHitParametersSoA>;

#endif
21 changes: 21 additions & 0 deletions CondFormats/EcalObjects/interface/EcalRecHitParametersSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef CondFormats_EcalObjects_EcalRecHitParametersSoA_h
#define CondFormats_EcalObjects_EcalRecHitParametersSoA_h

#include <bitset>
#include <array>
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"
#include "DataFormats/SoATemplate/interface/SoAView.h"

constexpr size_t kNEcalChannelStatusCodes = 16; // The HW supports 16 channel status codes
using RecoFlagBitsArray =
std::array<uint32_t, kNEcalChannelStatusCodes>; // associate recoFlagBits to all channel status codes

GENERATE_SOA_LAYOUT(EcalRecHitParametersSoALayout,
SOA_SCALAR(RecoFlagBitsArray, recoFlagBits),
SOA_SCALAR(std::bitset<kNEcalChannelStatusCodes>, channelStatusCodesToBeExcluded))

using EcalRecHitParametersSoA = EcalRecHitParametersSoALayout<>;

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

#include "CondFormats/EcalObjects/interface/EcalRecHitConditionsHost.h"
#include "CondFormats/EcalObjects/interface/EcalRecHitConditionsSoA.h"
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

using ::EcalRecHitConditionsHost;
using EcalRecHitConditionsDevice = PortableCollection<EcalRecHitConditionsSoA>;

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

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

#include "CondFormats/EcalObjects/interface/EcalRecHitParametersHost.h"
#include "CondFormats/EcalObjects/interface/EcalRecHitParametersSoA.h"
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

using ::EcalRecHitParametersHost;
using EcalRecHitParametersDevice = PortableCollection<EcalRecHitParametersSoA>;

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

#endif
4 changes: 4 additions & 0 deletions CondFormats/EcalObjects/src/ES_EcalRecHitConditionsHost.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/EcalObjects/interface/EcalRecHitConditionsHost.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(EcalRecHitConditionsHost);
4 changes: 4 additions & 0 deletions CondFormats/EcalObjects/src/ES_EcalRecHitParametersHost.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/EcalObjects/interface/EcalRecHitParametersHost.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(EcalRecHitParametersHost);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h"

#include "CondFormats/EcalObjects/interface/alpaka/EcalRecHitConditionsDevice.h"
TYPELOOKUP_ALPAKA_DATA_REG(EcalRecHitConditionsDevice);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h"

#include "CondFormats/EcalObjects/interface/alpaka/EcalRecHitParametersDevice.h"
TYPELOOKUP_ALPAKA_DATA_REG(EcalRecHitParametersDevice);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for turning on alpaka validation modules for ECAL DQM

alpakaValidationEcal = cms.Modifier()
2 changes: 2 additions & 0 deletions Configuration/ProcessModifiers/python/alpakaValidation_cff.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import FWCore.ParameterSet.Config as cms

from Configuration.ProcessModifiers.alpaka_cff import *
from Configuration.ProcessModifiers.alpakaValidationEcal_cff import *
from Configuration.ProcessModifiers.alpakaValidationPixel_cff import *

# This modifier chain is for turning on DQM modules used for alpaka device/host validation

alpakaValidation = cms.ModifierChain(
alpaka,
alpakaValidationEcal,
alpakaValidationPixel
)
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The offsets currently in use are:
* 0.407: Alpaka, pixel only triplets, portable vs. CPU validation
* 0.407: Alpaka, pixel only triplets, portable profiling
* 0.412: Alpaka, ECAL only, portable
* 0.413: Alpaka, ECAL only, portable vs. CPU validation
* 0.422: Alpaka, HCAL only, portable
* 0.423: Alpaka, HCAL only, portable vs CPU validation
* 0.424: Alpaka, HCAL only, portable profiling
Expand Down
4 changes: 2 additions & 2 deletions Configuration/PyReleaseValidation/python/relval_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# 2024, Alpaka-based noPU
12834.402, 12834.403, 12834.404,
12834.406, 12834.407, 12834.408,
12834.412,#12834.413, 12834.414,
12834.412, 12834.413,#12834.414,
12834.422, 12834.423, 12834.424,
#12834.482, 12834.483, 12834.484
#12834.486, 12834.487, 12834.488
Expand All @@ -60,7 +60,7 @@
# 2024 with PU, Alpaka-based
13034.402, 13034.403, 13034.404,
13034.406, 13034.407, 13034.408,
13034.412, #13034.413, 13034.414
13034.412, 13034.413, #13034.414
13034.422, 13034.423, 13034.424,
#13034.482, 13034.483, 13034.484
#13034.486, 13034.487, 13034.488
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ def setup_(self, step, stepName, stepDict, k, properties):
upgradeWFs['PatatrackECALOnlyAlpaka'] = PatatrackWorkflow(
digi = {
# customize the ECAL Local Reco part of the HLT menu for Alpaka
'--procModifiers': 'alpaka',
'--procModifiers': 'alpaka',
'--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling',
},
reco = {
Expand All @@ -1151,6 +1151,28 @@ def setup_(self, step, stepName, stepDict, k, properties):
offset = 0.412,
)

# ECAL-only workflow running on CPU or GPU with Alpaka code
# - HLT with Alpaka
# - ECAL-only reconstruction with Alpaka on both CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
# - harvesting
upgradeWFs['PatatrackECALOnlyAlpakaValidation'] = PatatrackWorkflow(
digi = {
# customize the ECAL Local Reco part of the HLT menu for Alpaka
'--procModifiers': 'alpaka',
'--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling',
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly',
'--procModifiers': 'alpakaValidation',
'--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling',
},
harvest = {
'-s': 'HARVESTING:@ecalOnlyValidation+@ecal'
},
suffix = 'Patatrack_ECALOnlyAlpakaValidation',
offset = 0.413,
)

# ECAL-only workflow running on CPU
# - HLT on CPU
# - ECAL-only reconstruction on CPU, with DQM and validation
Expand Down
8 changes: 8 additions & 0 deletions DQM/EcalMonitorTasks/python/EcalMonitorTask_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

# Customization to run the CPU vs GPU comparison task if the job runs on a GPU enabled machine
from Configuration.ProcessModifiers.gpuValidationEcal_cff import gpuValidationEcal
from Configuration.ProcessModifiers.alpakaValidationEcal_cff import alpakaValidationEcal
from DQM.EcalMonitorTasks.ecalGpuTask_cfi import ecalGpuTask

gpuValidationEcal.toModify(ecalGpuTask.params, runGpuTask = True)
gpuValidationEcal.toModify(ecalMonitorTask.workers, func = lambda workers: workers.append("GpuTask"))
gpuValidationEcal.toModify(ecalMonitorTask, workerParameters = dict(GpuTask = ecalGpuTask))

alpakaValidationEcal.toModify(ecalGpuTask.params, runGpuTask = True)
alpakaValidationEcal.toModify(ecalMonitorTask.workers, func = lambda workers: workers.append("GpuTask"))
alpakaValidationEcal.toModify(ecalMonitorTask, workerParameters = dict(GpuTask = ecalGpuTask))

# Skip consuming and running over the EcalRawData collection for all GPU WFs
# This is to be used as long as the GPU unpacker unpacks a dummy EcalRawData collection
from Configuration.ProcessModifiers.gpu_cff import gpu
gpu.toModify(ecalMonitorTask.skipCollections, func = lambda skipCollections: skipCollections.append("EcalRawData"))

from Configuration.ProcessModifiers.alpaka_cff import alpaka
alpaka.toModify(ecalMonitorTask.skipCollections, func = lambda skipCollections: skipCollections.append("EcalRawData"))
Loading