CMS 3D CMS Logo

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

Public Member Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (TAcc const &acc, const unsigned int numer_of_clusters, const HGCalSoARecHitsDeviceCollection::ConstView input_rechits_soa, const HGCalSoARecHitsExtraDeviceCollection::ConstView input_clusters_soa, HGCalSoAClustersDeviceCollection::View outputs) const
 

Detailed Description

Definition at line 14 of file HGCalLayerClustersSoAAlgoWrapper.dev.cc.

Member Function Documentation

◆ operator()()

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::HGCalLayerClustersSoAAlgoKernelEnergy::operator() ( TAcc const &  acc,
const unsigned int  numer_of_clusters,
const HGCalSoARecHitsDeviceCollection::ConstView  input_rechits_soa,
const HGCalSoARecHitsExtraDeviceCollection::ConstView  input_clusters_soa,
HGCalSoAClustersDeviceCollection::View  outputs 
) const
inline

Definition at line 17 of file HGCalLayerClustersSoAAlgoWrapper.dev.cc.

References cms::cudacompat::atomicAdd(), hgcalTBTopologyTester_cfi::cells, hcalRecHitTable_cff::energy, mps_fire::i, hgcal::constants::kInvalidCluster, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, cms::alpakatools::uniform_elements(), and mps_merge::weight.

21  {
22  // make a strided loop over the kernel grid, covering up to "size" elements
23  for (int32_t i : uniform_elements(acc, input_rechits_soa.metadata().size())) {
24  // Skip unassigned rechits
25  if (input_clusters_soa[i].clusterIndex() == kInvalidCluster) {
26  continue;
27  }
28  auto clIdx = input_clusters_soa[i].clusterIndex();
29  alpaka::atomicAdd(acc, &outputs[clIdx].energy(), input_rechits_soa[i].weight());
30  alpaka::atomicAdd(acc, &outputs[clIdx].cells(), 1);
31  if (input_clusters_soa[i].isSeed() == 1) {
32  outputs[clIdx].seed() = input_rechits_soa[i].detid();
33  }
34  }
35  }
ALPAKA_FN_ACC auto uniform_elements(TAcc const &acc, TArgs... args)
Definition: workdivision.h:311
static constexpr int kInvalidCluster
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:61