Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-04 00:29:36

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
0003 
0004 # ECAL unpacker running on CPU
0005 from EventFilter.EcalRawToDigi.EcalUnpackerData_cfi import ecalEBunpacker as _ecalEBunpacker
0006 ecalDigisCPU = _ecalEBunpacker.clone()
0007 
0008 ecalDigis = SwitchProducerCUDA(
0009     cpu = ecalDigisCPU
0010 )
0011 
0012 ecalDigisTask = cms.Task(
0013     # ECAL unpacker running on CPU
0014     ecalDigis
0015 )
0016 
0017 from Configuration.StandardSequences.Accelerators_cff import *
0018 
0019 # process modifier to run on GPUs
0020 from Configuration.ProcessModifiers.gpu_cff import gpu
0021 
0022 # ECAL conditions used by the unpacker running on GPU
0023 from EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi import ecalElectronicsMappingGPUESProducer
0024 
0025 # ECAL unpacker running on GPU
0026 from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU
0027 ecalDigisGPU = _ecalRawToDigiGPU.clone()
0028 
0029 # extend the SwitchProducer to add a case to copy the ECAL digis from GPU to CPU and convert them from SoA to legacy format
0030 from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer
0031 gpu.toModify(ecalDigis,
0032     # copy the ECAL digis from GPU to CPU and convert them from SoA to legacy format
0033     cuda = _ecalCPUDigisProducer.clone(
0034         digisInLabelEB = ('ecalDigisGPU', 'ebDigis'),
0035         digisInLabelEE = ('ecalDigisGPU', 'eeDigis'),
0036         produceDummyIntegrityCollections = True
0037     )
0038 )
0039 
0040 gpu.toReplaceWith(ecalDigisTask, cms.Task(
0041     # ECAL conditions used by the unpacker running on GPU
0042     ecalElectronicsMappingGPUESProducer,
0043     # run the ECAL unpacker on GPU
0044     ecalDigisGPU,
0045     # run the ECAL unpacker on CPU, or copy the ECAL digis from GPU to CPU and convert them from SoA to legacy format
0046     ecalDigis
0047 ))
0048 
0049 # process modifier to run alpaka implementation
0050 from Configuration.ProcessModifiers.alpaka_cff import alpaka
0051 
0052 # ECAL conditions used by the portable unpacker
0053 from EventFilter.EcalRawToDigi.ecalElectronicsMappingHostESProducer_cfi import ecalElectronicsMappingHostESProducer
0054 
0055 # alpaka ECAL unpacker
0056 from EventFilter.EcalRawToDigi.ecalRawToDigiPortable_cfi import ecalRawToDigiPortable as _ecalRawToDigiPortable
0057 ecalDigisPortable = _ecalRawToDigiPortable.clone()
0058 
0059 from EventFilter.EcalRawToDigi.ecalDigisFromPortableProducer_cfi import ecalDigisFromPortableProducer as _ecalDigisFromPortableProducer
0060 
0061 # replace the SwitchProducer branches with a module to copy the ECAL digis from the accelerator to CPU (if needed) and convert them from SoA to legacy format
0062 _ecalDigisFromPortable = _ecalDigisFromPortableProducer.clone(
0063     digisInLabelEB = 'ecalDigisPortable:ebDigis',
0064     digisInLabelEE = 'ecalDigisPortable:eeDigis',
0065     produceDummyIntegrityCollections = True
0066 )
0067 alpaka.toModify(ecalDigis,
0068     cpu = _ecalDigisFromPortable.clone()
0069 )
0070 
0071 alpaka.toReplaceWith(ecalDigisTask, cms.Task(
0072     # ECAL conditions used by the portable unpacker
0073     ecalElectronicsMappingHostESProducer,
0074     # run the portable ECAL unpacker
0075     ecalDigisPortable,
0076     # copy the ECAL digis from GPU to CPU (if needed) and convert them from SoA to legacy format
0077     ecalDigis
0078 ))
0079 
0080 # for alpaka validation compare the legacy CPU module with the alpaka module
0081 from Configuration.ProcessModifiers.alpakaValidationEcal_cff import alpakaValidationEcal
0082 alpakaValidationEcal.toModify(ecalDigis, cpu = ecalDigisCPU)
0083 alpakaValidationEcal.toModify(ecalDigis, cuda = _ecalDigisFromPortable.clone())
0084