CMS 3D CMS Logo

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

Public Member Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (TAcc const &acc, portabletest::TestDeviceCollection::View view, double xvalue) const
 

Detailed Description

Definition at line 19 of file TestAlgo.dev.cc.

Member Function Documentation

◆ operator()()

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgoKernel::operator() ( TAcc const &  acc,
portabletest::TestDeviceCollection::View  view,
double  xvalue 
) const
inline

Definition at line 22 of file TestAlgo.dev.cc.

References cms::alpakatools::elements_with_stride(), HLT_2024v10_cff::flags, mps_fire::i, makeMuonMisalignmentScenario::matrix, and cms::alpakatools::once_per_grid().

22  {
23  // global index of the thread within the grid
24  const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
25  const portabletest::Array flags = {{6, 4, 2, 0}};
26 
27  // set this only once in the whole kernel grid
28  if (once_per_grid(acc)) {
29  view.r() = 1.;
30  }
31 
32  // make a strided loop over the kernel grid, covering up to "size" elements
33  for (int32_t i : elements_with_stride(acc, view.metadata().size())) {
34  view[i] = {xvalue, 0., 0., i, flags, matrix * i};
35  }
36  }
Eigen::Matrix< double, 3, 6 > Matrix
Definition: TestSoA.h:19
ALPAKA_FN_ACC auto elements_with_stride(TAcc const &acc, TArgs... args)
Definition: workdivision.h:346
ALPAKA_FN_ACC constexpr bool once_per_grid(TAcc const &acc)