CMS 3D CMS Logo

List of all members | Public Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::TestAlgoMultiKernel2 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::TestDeviceMultiCollection2::View< 1 > view, double xvalue) const
 

Detailed Description

Definition at line 39 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::TestAlgoMultiKernel2::operator() ( TAcc const &  acc,
portabletest::TestDeviceMultiCollection2::View< 1 >  view,
double  xvalue 
) const
inline

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

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

44  {
45  // global index of the thread within the grid
46  const int32_t thread = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc)[0u];
47  const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
48 
49  // set this only once in the whole kernel grid
50  if (thread == 0) {
51  view.r2() = 2.;
52  }
53 
54  // make a strided loop over the kernel grid, covering up to "size" elements
55  for (int32_t i : elements_with_stride(acc, view.metadata().size())) {
56  view[i] = {xvalue, 0., 0., i, matrix * i};
57  }
58  }
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