CMS 3D CMS Logo

testESAlgoAsync.dev.cc
Go to the documentation of this file.
1 #include "testESAlgoAsync.h"
2 
5  AlpakaESTestDataA const& dataA,
7  auto const size = std::min(dataA.size(), 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, int const* a, int const* b, AlpakaESTestDataDDevice::View c, int size) {
22  const int32_t thread = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc)[0u];
23  const int32_t stride = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc)[0u];
24  for (auto i = thread; i < size; i += stride) {
25  c[i] = a[i] + b[i];
26  }
27  },
28  dataA.data(),
29  dataB.data(),
30  ret.view(),
31  size);
32 
33  return ret;
34  }
35 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
size
Write out results.
ret
prodAgent to be discontinued
AlpakaESTestDataDDevice testESAlgoAsync(Queue &queue, AlpakaESTestDataA const &dataA, cms::alpakatest::AlpakaESTestDataB< Device > const &dataB)
WorkDiv< Dim1D > WorkDiv1D
Definition: config.h:31
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119