CMS 3D CMS Logo

List of all members | Public Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::FastCluster Class Reference

Public Member Functions

template<bool debug = false, typename TAcc , typename = std::enable_if<!std::is_same_v<Device, alpaka::DevCpu>>>
ALPAKA_FN_ACC void operator() (const TAcc &acc, const reco::PFRecHitHostCollection::ConstView pfRecHits, const reco::PFClusterParamsDeviceCollection::ConstView pfClusParams, const reco::PFRecHitHCALTopologyDeviceCollection::ConstView topology, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, reco::PFClusterDeviceCollection::View clusterView, reco::PFRecHitFractionDeviceCollection::View fracView) const
 

Detailed Description

Definition at line 1348 of file PFClusterSoAProducerKernel.dev.cc.

Member Function Documentation

◆ operator()()

template<bool debug = false, typename TAcc , typename = std::enable_if<!std::is_same_v<Device, alpaka::DevCpu>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::FastCluster::operator() ( const TAcc &  acc,
const reco::PFRecHitHostCollection::ConstView  pfRecHits,
const reco::PFClusterParamsDeviceCollection::ConstView  pfClusParams,
const reco::PFRecHitHCALTopologyDeviceCollection::ConstView  topology,
reco::PFClusteringVarsDeviceCollection::View  pfClusteringVars,
reco::PFClusterDeviceCollection::View  clusterView,
reco::PFRecHitFractionDeviceCollection::View  fracView 
) const
inline

Definition at line 1351 of file PFClusterSoAProducerKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), debug, ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedIterative(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedParallel(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_singleSeed(), cms::alpakatools::once_per_block(), HLT_2024v10_cff::pfRecHits, ALPAKA_ACCELERATOR_NAMESPACE::threadsPerBlockForClustering, and HLT_2024v10_cff::topology.

1357  {
1358  const int nRH = pfRecHits.size();
1359  int& topoId = alpaka::declareSharedVar<int, __COUNTER__>(acc);
1360  int& nRHTopo = alpaka::declareSharedVar<int, __COUNTER__>(acc);
1361  int& nSeeds = alpaka::declareSharedVar<int, __COUNTER__>(acc);
1362 
1363  if (once_per_block(acc)) {
1364  topoId = alpaka::getIdx<alpaka::Grid, alpaka::Blocks>(acc)[0u];
1365  nRHTopo = pfClusteringVars[topoId].topoRHCount();
1366  nSeeds = pfClusteringVars[topoId].topoSeedCount();
1367  }
1368 
1369  alpaka::syncBlockThreads(acc); // all threads call sync
1370 
1371  if (topoId < nRH && nRHTopo > 0 && nSeeds > 0) {
1372  if (nRHTopo == nSeeds) {
1373  // PF cluster is isolated seed. No iterations needed
1374  if (once_per_block(acc)) {
1375  // Fill PFCluster-level information
1376  int rhIdx = pfClusteringVars[pfClusteringVars[topoId].topoSeedOffsets()].topoSeedList();
1377  int seedIdx = pfClusteringVars[rhIdx].rhIdxToSeedIdx();
1378  clusterView[seedIdx].energy() = pfRecHits[rhIdx].energy();
1379  clusterView[seedIdx].x() = pfRecHits[rhIdx].x();
1380  clusterView[seedIdx].y() = pfRecHits[rhIdx].y();
1381  clusterView[seedIdx].z() = pfRecHits[rhIdx].z();
1382  }
1383  // singleSeed and multiSeedParallel functions work only for GPU backend
1384  } else if ((not std::is_same_v<Device, alpaka::DevCpu>)&&nSeeds == 1) {
1385  // Single seed cluster
1387  acc, pfClusParams, topology, topoId, nRHTopo, pfRecHits, pfClusteringVars, clusterView, fracView);
1388  } else if ((not std::is_same_v<Device, alpaka::DevCpu>)&&nSeeds <= 100 &&
1389  nRHTopo - nSeeds < threadsPerBlockForClustering) {
1391  acc, pfClusParams, topology, topoId, nSeeds, nRHTopo, pfRecHits, pfClusteringVars, clusterView, fracView);
1392  } else if (nSeeds <= 400 && nRHTopo - nSeeds <= 1500) {
1393  // nSeeds value must match exotic in FastClusterExotic
1395  acc, pfClusParams, topology, topoId, nSeeds, nRHTopo, pfRecHits, pfClusteringVars, clusterView, fracView);
1396  } else {
1397  if constexpr (debug) {
1398  if (once_per_block(acc))
1399  printf("Topo cluster %d has %d seeds and %d rechits. Will be processed in next kernel.\n",
1400  topoId,
1401  nSeeds,
1402  nRHTopo);
1403  }
1404  }
1405  }
1406  }
ALPAKA_FN_ACC constexpr bool once_per_block(TAcc const &acc)
static ALPAKA_FN_ACC void hcalFastCluster_multiSeedIterative(const TAcc &acc, reco::PFClusterParamsDeviceCollection::ConstView pfClusParams, const reco::PFRecHitHCALTopologyDeviceCollection::ConstView topology, int topoId, int nSeeds, int nRHTopo, reco::PFRecHitDeviceCollection::ConstView pfRecHits, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, reco::PFClusterDeviceCollection::View clusterView, reco::PFRecHitFractionDeviceCollection::View fracView)
static ALPAKA_FN_ACC void hcalFastCluster_multiSeedParallel(const TAcc &acc, reco::PFClusterParamsDeviceCollection::ConstView pfClusParams, const reco::PFRecHitHCALTopologyDeviceCollection::ConstView topology, int topoId, int nSeeds, int nRHTopo, reco::PFRecHitDeviceCollection::ConstView pfRecHits, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, reco::PFClusterDeviceCollection::View clusterView, reco::PFRecHitFractionDeviceCollection::View fracView)
#define debug
Definition: HDRShower.cc:19
static ALPAKA_FN_ACC void hcalFastCluster_singleSeed(const TAcc &acc, reco::PFClusterParamsDeviceCollection::ConstView pfClusParams, const reco::PFRecHitHCALTopologyDeviceCollection::ConstView topology, int topoId, int nRHTopo, reco::PFRecHitDeviceCollection::ConstView pfRecHits, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, reco::PFClusterDeviceCollection::View clusterView, reco::PFRecHitFractionDeviceCollection::View fracView)