Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-14 23:17:06

0001 #include <alpaka/alpaka.hpp>
0002 
0003 #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
0004 
0005 #include "EcalRecHitBuilder.h"
0006 #include "EnergyComputationKernels.h"
0007 
0008 //#define DEBUG
0009 //#define ECAL_RECO_ALPAKA_DEBUG
0010 
0011 namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit {
0012 
0013   using namespace cms::alpakatools;
0014 
0015   // host version, to be called by the plugin
0016   void create_ecal_rechit(Queue& queue,
0017                           InputProduct const* ebUncalibRecHits,
0018                           InputProduct const* eeUncalibRecHits,
0019                           OutputProduct& ebRecHits,
0020                           OutputProduct& eeRecHits,
0021                           EcalRecHitConditionsDevice const& conditionsDev,
0022                           EcalRecHitParameters const* parametersDev,
0023                           edm::TimeValue_t const& eventTime,
0024                           ConfigurationParameters const& configParams,
0025                           bool const isPhase2) {
0026     auto nchannels = static_cast<uint32_t>(ebUncalibRecHits->const_view().metadata().size());
0027     if (!isPhase2) {
0028       nchannels += static_cast<uint32_t>(eeUncalibRecHits->const_view().metadata().size());
0029     }
0030 
0031     //
0032     // kernel create rechit
0033     //
0034     uint32_t constexpr nchannels_per_block = 16;
0035     auto constexpr threads = nchannels_per_block;
0036     auto const blocks = cms::alpakatools::divide_up_by(nchannels, threads);
0037     auto workDiv = cms::alpakatools::make_workdiv<Acc1D>(blocks, threads);
0038     if (!isPhase2) {
0039       alpaka::exec<Acc1D>(queue,
0040                           workDiv,
0041                           KernelCreateEcalRechit{},
0042                           ebUncalibRecHits->const_view(),
0043                           eeUncalibRecHits->const_view(),
0044                           ebRecHits.view(),
0045                           eeRecHits.view(),
0046                           conditionsDev.const_view(),
0047                           parametersDev,
0048                           eventTime,
0049                           configParams);
0050     } else {
0051       alpaka::exec<Acc1D>(queue,
0052                           workDiv,
0053                           KernelCreateEcalRechitPhase2{},
0054                           ebUncalibRecHits->const_view(),
0055                           ebRecHits.view(),
0056                           conditionsDev.const_view(),
0057                           parametersDev,
0058                           eventTime,
0059                           configParams);
0060     }
0061   }
0062 
0063 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE::ecal::rechit