From 485e727045043a7e70bb8407d16b622f1fb66eac Mon Sep 17 00:00:00 2001 From: amassiro Date: Thu, 11 Jun 2020 17:44:21 +0200 Subject: [PATCH] fix for max number of channels --- .../EcalRecAlgos/interface/DeclsForKernels.h | 2 ++ .../EcalRecAlgos/src/EcalRecHitBuilderKernels.cu | 8 ++++++-- .../src/EcalUncalibRecHitMultiFitAlgo_gpu_new.cu | 5 +++-- .../plugins/EcalRecHitProducerGPU.cc | 15 ++++++++++++--- .../plugins/EcalUncalibRecHitProducerGPU.cc | 11 ++++++++++- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/RecoLocalCalo/EcalRecAlgos/interface/DeclsForKernels.h b/RecoLocalCalo/EcalRecAlgos/interface/DeclsForKernels.h index 80a3f838e9de9..81acb9e70bcb8 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/DeclsForKernels.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/DeclsForKernels.h @@ -239,6 +239,7 @@ namespace ecal { EcalSampleMask const& sampleMask; EcalTimeOffsetConstant const& timeOffsetConstant; uint32_t offsetForHashes; + uint32_t nchannels; }; //*/ @@ -339,6 +340,7 @@ namespace ecal { // // uint32_t offsetForHashes; + uint32_t nchannels; }; } // namespace rechit diff --git a/RecoLocalCalo/EcalRecAlgos/src/EcalRecHitBuilderKernels.cu b/RecoLocalCalo/EcalRecAlgos/src/EcalRecHitBuilderKernels.cu index 54c376214c4c6..f389f02a586d0 100644 --- a/RecoLocalCalo/EcalRecAlgos/src/EcalRecHitBuilderKernels.cu +++ b/RecoLocalCalo/EcalRecAlgos/src/EcalRecHitBuilderKernels.cu @@ -580,10 +580,14 @@ namespace ecal { ConditionsProducts const& conditions, ConfigurationParameters const& configParameters, uint32_t const nChannelsBarrel, +// uint32_t const nchannels, edm::TimeValue_t const event_time, cudaStream_t cudaStream) { - int nchannels = eventInputGPU.ebUncalibRecHits.size + eventInputGPU.eeUncalibRecHits.size; - +// int nchannels = eventInputGPU.ebUncalibRecHits.size + eventInputGPU.eeUncalibRecHits.size; + int nchannels = conditions.nchannels; + // + // nChannelsBarrel and offsetForHashes should be the same? TEST + // // unsigned int nchannels_per_block = 32; unsigned int nchannels_per_block = 16; unsigned int threads_min = nchannels_per_block; diff --git a/RecoLocalCalo/EcalRecAlgos/src/EcalUncalibRecHitMultiFitAlgo_gpu_new.cu b/RecoLocalCalo/EcalRecAlgos/src/EcalUncalibRecHitMultiFitAlgo_gpu_new.cu index c8d2926b29afc..ebb46bb5da276 100644 --- a/RecoLocalCalo/EcalRecAlgos/src/EcalUncalibRecHitMultiFitAlgo_gpu_new.cu +++ b/RecoLocalCalo/EcalRecAlgos/src/EcalUncalibRecHitMultiFitAlgo_gpu_new.cu @@ -43,8 +43,9 @@ namespace ecal { uint32_t const offsetForHashes = conditions.offsetForHashes; uint32_t const offsetForInputs = eventInputGPU.ebDigis.ndigis; - unsigned int totalChannels = eventInputGPU.ebDigis.ndigis + eventInputGPU.eeDigis.ndigis; - + // unsigned int totalChannels = eventInputGPU.ebDigis.ndigis + eventInputGPU.eeDigis.ndigis; + unsigned int totalChannels = conditions.nchannels; + // // 1d preparation kernel // diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc index 5b318152477eb..4104e1cb8f964 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc @@ -306,9 +306,16 @@ void EcalRecHitProducerGPU::acquire(edm::Event const& event, if ((neb_ + nee_) > maxNumberHits_) { edm::LogError("EcalRecHitProducerGPU") << "max number of channels exceeded. See options 'maxNumberHits' "; + if (neb_ > maxNumberHits_) { + neb_ = maxNumberHits_; + nee_ = 0; + } else if ((neb_ + nee_) > maxNumberHits_) { + nee_ = maxNumberHits_ - neb_; + } } - int nchannelsEB = ebUncalibRecHits.size; // --> offsetForInput, first EB and then EE + uint32_t nchannels = neb_ + nee_; +// int nchannelsEB = neb_; // --> offsetForInput, first EB and then EE // conditions // - laser correction @@ -346,7 +353,9 @@ void EcalRecHitProducerGPU::acquire(edm::Event const& event, LaserAlphasProduct, LinearCorrectionsProduct, // - IntercalibConstantsHandle_->getOffset()}; + //IntercalibConstantsHandle_->getOffset(), + neb_, + nchannels}; // // schedule algorithms @@ -359,7 +368,7 @@ void EcalRecHitProducerGPU::acquire(edm::Event const& event, // eventDataForScratchGPU_, conditions, configParameters_, - nchannelsEB, + neb_, event_time, ctx.stream()); diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc index cdf21e3240954..89fd96f81a0a2 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc @@ -289,7 +289,14 @@ void EcalUncalibRecHitProducerGPU::acquire(edm::Event const& event, if ((neb_ + nee_) > maxNumberHits_) { edm::LogError("EcalUncalibRecHitProducerGPU") << "max number of channels exceeded. See options 'maxNumberHits' "; + if (neb_ > maxNumberHits_) { + neb_ = maxNumberHits_; + nee_ = 0; + } else if ((neb_ + nee_) > maxNumberHits_) { + nee_ = maxNumberHits_ - neb_; + } } + auto nchannels = neb_ + nee_; // conditions setup.get().get(pedestalsHandle_); @@ -320,7 +327,9 @@ void EcalUncalibRecHitProducerGPU::acquire(edm::Event const& event, timeCalibConstantsProduct, *sampleMaskHandle_, *timeOffsetConstantHandle_, - timeCalibConstantsHandle_->getOffset()}; + //timeCalibConstantsHandle_->getOffset(), + neb_, + nchannels}; // // schedule algorithms