CMS 3D CMS Logo

List of all members | Public Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::TestAlgoKernelUpdateMulti3 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::TestSoA::ConstView input, portabletest::TestSoA2::ConstView input2, portabletest::TestSoA3::ConstView input3, AlpakaESTestDataEDevice::ConstView esData, portabletest::TestSoA::View output, portabletest::TestSoA2::View output2, portabletest::TestSoA3::View output3) const
 

Detailed Description

Definition at line 220 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::TestAlgoKernelUpdateMulti3::operator() ( TAcc const &  acc,
portabletest::TestSoA::ConstView  input,
portabletest::TestSoA2::ConstView  input2,
portabletest::TestSoA3::ConstView  input3,
AlpakaESTestDataEDevice::ConstView  esData,
portabletest::TestSoA::View  output,
portabletest::TestSoA2::View  output2,
portabletest::TestSoA3::View  output3 
) const
inline

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

References cms::alpakatools::elements_with_stride(), mps_fire::i, input, input2, cms::alpakatools::once_per_grid(), skim900GeV_StreamA_MinBiasPD_cfg::output2, skim900GeV_StreamA_MinBiasPD_cfg::output3, cms::alpakatest::AlpakaESTestDataE< TDev >::ConstView::size(), cms::alpakatest::AlpakaESTestDataE< TDev >::ConstView::val(), cms::alpakatest::AlpakaESTestDataE< TDev >::ConstView::val2(), and x.

230  {
231  // set this only once in the whole kernel grid
232  if (once_per_grid(acc)) {
233  output.r() = input.r();
234  output2.r2() = input2.r2();
235  output3.r3() = input3.r3();
236  }
237 
238  // make a strided loop over the kernel grid, covering up to "size" elements
239  for (int32_t i : elements_with_stride(acc, output.metadata().size())) {
240  double x = input[i].x();
241  if (i < esData.size()) {
242  x += esData.val(i) + esData.val2(i);
243  if (0 == i)
244  printf("Setting x[0] to %f\n", x);
245  }
246  output[i] = {x, input[i].y(), input[i].z(), input[i].id(), input[i].flags(), input[i].m()};
247  }
248  for (int32_t i : elements_with_stride(acc, output2.metadata().size())) {
249  double x2 = input2[i].x2();
250  if (i < esData.size()) {
251  x2 += esData.val(i) + esData.val2(i);
252  }
253  output2[i] = {x2, input2[i].y2(), input2[i].z2(), input2[i].id2(), input2[i].m2()};
254  }
255  for (int32_t i : elements_with_stride(acc, output3.metadata().size())) {
256  double x3 = input3[i].x3();
257  if (i < esData.size()) {
258  x3 += esData.val(i) + esData.val2(i);
259  }
260  output3[i] = {x3, input3[i].y3(), input3[i].z3(), input3[i].id3(), input3[i].m3()};
261  }
262  }
#define input2
Definition: AMPTWrapper.h:159
static std::string const input
Definition: EdmProvDump.cc:50
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)
Definition: output.py:1