Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-03 04:18:12

0001 // Check that ALPAKA_HOST_ONLY is not defined during device compilation:
0002 #ifdef ALPAKA_HOST_ONLY
0003 #error ALPAKA_HOST_ONLY defined in device compilation
0004 #endif
0005 
0006 #include "RecoLocalCalo/HGCalRecProducers/interface/HGCalTilesConstants.h"
0007 
0008 #include "HGCalLayerClustersAlgoWrapper.h"
0009 #include "ConstantsForClusters.h"
0010 
0011 #include "CLUEAlgoAlpaka.h"
0012 
0013 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0014 
0015   using namespace cms::alpakatools;
0016   using namespace hgcal::constants;
0017 
0018   void HGCalLayerClustersAlgoWrapper::run(Queue& queue,
0019                                           const unsigned int size,
0020                                           const float dc,
0021                                           const float kappa,
0022                                           const float outlierDeltaFactor,
0023                                           const HGCalSoARecHitsDeviceCollection::ConstView inputs,
0024                                           HGCalSoARecHitsExtraDeviceCollection::View outputs) const {
0025     CLUEAlgoAlpaka<ALPAKA_ACCELERATOR_NAMESPACE::Acc1D, Queue, HGCalSiliconTilesConstants, kHGCalLayers> algoStandalone(
0026         queue, dc, kappa, outlierDeltaFactor, false);
0027 
0028     // Initialize output memory to 0
0029     auto delta = cms::alpakatools::make_device_view<float>(alpaka::getDev(queue), outputs.delta(), size);
0030     alpaka::memset(queue, delta, 0x0);
0031     auto rho = cms::alpakatools::make_device_view<float>(alpaka::getDev(queue), outputs.rho(), size);
0032     alpaka::memset(queue, rho, 0x0);
0033     auto nearestHigher =
0034         cms::alpakatools::make_device_view<unsigned int>(alpaka::getDev(queue), outputs.nearestHigher(), size);
0035     alpaka::memset(queue, nearestHigher, 0x0);
0036     auto clusterIndex = cms::alpakatools::make_device_view<int>(alpaka::getDev(queue), outputs.clusterIndex(), size);
0037     alpaka::memset(queue, clusterIndex, kInvalidClusterByte);
0038     auto isSeed = cms::alpakatools::make_device_view<uint8_t>(alpaka::getDev(queue), outputs.isSeed(), size);
0039     alpaka::memset(queue, isSeed, 0x0);
0040 
0041     algoStandalone.makeClustersCMSSW(size,
0042                                      inputs.dim1(),
0043                                      inputs.dim2(),
0044                                      inputs.layer(),
0045                                      inputs.weight(),
0046                                      inputs.sigmaNoise(),
0047                                      inputs.detid(),
0048                                      outputs.rho(),
0049                                      outputs.delta(),
0050                                      outputs.nearestHigher(),
0051                                      outputs.clusterIndex(),
0052                                      outputs.isSeed(),
0053                                      &outputs.numberOfClustersScalar());
0054   }
0055 
0056 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE