CMS 3D CMS Logo

testESAlgoAsync.dev.cc
Go to the documentation of this file.
1 #include "testESAlgoAsync.h"
2 
5  AlpakaESTestDataADevice const& dataA,
7  auto const size = std::min(dataA->metadata().size(), static_cast<int>(dataB.size()));
9 
10  auto const& deviceProperties = alpaka::getAccDevProps<Acc1D>(alpaka::getDev(queue));
11  uint32_t maxThreadsPerBlock = deviceProperties.m_blockThreadExtentMax[0];
12 
13  uint32_t threadsPerBlock = maxThreadsPerBlock;
14  uint32_t blocksPerGrid = (size + threadsPerBlock - 1) / threadsPerBlock;
15  uint32_t elementsPerThread = 1;
16  auto workDiv = WorkDiv1D{blocksPerGrid, threadsPerBlock, elementsPerThread};
17 
18  alpaka::exec<Acc1D>(
19  queue,
20  workDiv,
21  [] ALPAKA_FN_ACC(Acc1D const& acc,
23  int const* b,
25  int size) {
26  const int32_t thread = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc)[0u];
27  const int32_t stride = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc)[0u];
28  for (auto i = thread; i < size; i += stride) {
29  c[i] = a.z()[i] + b[i];
30  }
31  },
32  dataA.view(),
33  dataB.data(),
34  ret.view(),
35  size);
36 
37  return ret;
38  }
39 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
ret
prodAgent to be discontinued
typename Layout::ConstView ConstView
WorkDiv< Dim1D > WorkDiv1D
Definition: config.h:32
double b
Definition: hdecay.h:120
AlpakaESTestDataDDevice testESAlgoAsync(Queue &queue, AlpakaESTestDataADevice const &dataA, cms::alpakatest::AlpakaESTestDataB< Device > const &dataB)
double a
Definition: hdecay.h:121