CMS 3D CMS Logo

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

#include <TestAlgo.h>

Public Member Functions

void fill (Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
 
void fillMulti2 (Queue &queue, portabletest::TestDeviceMultiCollection2 &collection, double xvalue=0.) const
 
void fillMulti3 (Queue &queue, portabletest::TestDeviceMultiCollection3 &collection, double xvalue=0.) const
 
void fillObject (Queue &queue, portabletest::TestDeviceObject &object, double x, double y, double z, int32_t id) const
 
portabletest::TestDeviceCollection update (Queue &queue, portabletest::TestDeviceCollection const &input, AlpakaESTestDataEDevice const &esData) const
 
portabletest::TestDeviceMultiCollection2 updateMulti2 (Queue &queue, portabletest::TestDeviceMultiCollection2 const &input, AlpakaESTestDataEDevice const &esData) const
 
portabletest::TestDeviceMultiCollection3 updateMulti3 (Queue &queue, portabletest::TestDeviceMultiCollection3 const &input, AlpakaESTestDataEDevice const &esData) const
 

Detailed Description

Definition at line 11 of file TestAlgo.h.

Member Function Documentation

◆ fill()

void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::fill ( Queue &  queue,
portabletest::TestDeviceCollection collection,
double  xvalue = 0. 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), mps_monitormerge::items, and createBeamHaloJobs::queue.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducerOffset::produce(), ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaProducer::produce(), ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducer::produce(), and ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaStreamProducer::produce().

83  {
84  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
85  uint32_t items = 64;
86 
87  // use as many groups as needed to cover the whole problem
88  uint32_t groups = divide_up_by(collection->metadata().size(), items);
89 
90  // map items to
91  // - threads with a single element per thread on a GPU backend
92  // - elements within a single thread on a CPU backend
93  auto workDiv = make_workdiv<Acc1D>(groups, items);
94 
95  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoKernel{}, collection.view(), xvalue);
96  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19

◆ fillMulti2()

void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::fillMulti2 ( Queue &  queue,
portabletest::TestDeviceMultiCollection2 collection,
double  xvalue = 0. 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), mps_monitormerge::items, and createBeamHaloJobs::queue.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaProducer::produce(), ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducer::produce(), and ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaStreamProducer::produce().

98  {
99  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
100  uint32_t items = 64;
101 
102  // use as many groups as needed to cover the whole problem
103  uint32_t groups = divide_up_by(collection->metadata().size(), items);
104  uint32_t groups2 = divide_up_by(collection.view<1>().metadata().size(), items);
105 
106  // map items to
107  // - threads with a single element per thread on a GPU backend
108  // - elements within a single thread on a CPU backend
109  auto workDiv = make_workdiv<Acc1D>(groups, items);
110  auto workDiv2 = make_workdiv<Acc1D>(groups2, items);
111 
112  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoKernel{}, collection.view<portabletest::TestSoA>(), xvalue);
113  alpaka::exec<Acc1D>(queue, workDiv2, TestAlgoMultiKernel2{}, collection.view<portabletest::TestSoA2>(), xvalue);
114  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19

◆ fillMulti3()

void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::fillMulti3 ( Queue &  queue,
portabletest::TestDeviceMultiCollection3 collection,
double  xvalue = 0. 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), mps_monitormerge::items, and createBeamHaloJobs::queue.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaProducer::produce(), ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducer::produce(), and ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaStreamProducer::produce().

143  {
144  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
145  uint32_t items = 64;
146 
147  // use as many groups as needed to cover the whole problem
148  uint32_t groups = divide_up_by(collection.view<portabletest::TestSoA>().metadata().size(), items);
149  uint32_t groups2 = divide_up_by(collection.view<portabletest::TestSoA2>().metadata().size(), items);
150  uint32_t groups3 = divide_up_by(collection.view<portabletest::TestSoA3>().metadata().size(), items);
151 
152  // map items to
153  // - threads with a single element per thread on a GPU backend
154  // - elements within a single thread on a CPU backend
155  auto workDiv = make_workdiv<Acc1D>(groups, items);
156  auto workDiv2 = make_workdiv<Acc1D>(groups2, items);
157  auto workDiv3 = make_workdiv<Acc1D>(groups3, items);
158 
159  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoKernel{}, collection.view<portabletest::TestSoA>(), xvalue);
160  alpaka::exec<Acc1D>(queue, workDiv2, TestAlgoMultiKernel2{}, collection.view<portabletest::TestSoA2>(), xvalue);
161  alpaka::exec<Acc1D>(queue, workDiv3, TestAlgoMultiKernel3{}, collection.view<portabletest::TestSoA3>(), xvalue);
162  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19

◆ fillObject()

void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::fillObject ( Queue &  queue,
portabletest::TestDeviceObject object,
double  x,
double  y,
double  z,
int32_t  id 
) const

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

References l1ctLayer2EG_cff::id, createBeamHaloJobs::queue, and x.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaProducer::produce().

136  {
137  // run on a single thread
138  auto workDiv = make_workdiv<Acc1D>(1, 1);
139 
140  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoStructKernel{}, object.data(), x, y, z, id);
141  }

◆ update()

portabletest::TestDeviceCollection ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::update ( Queue &  queue,
portabletest::TestDeviceCollection const &  input,
AlpakaESTestDataEDevice const &  esData 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), input, mps_monitormerge::items, createBeamHaloJobs::queue, and cms::alpakatest::AlpakaESTestDataE< TDev >::view().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), and ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducerE::produce().

267  {
269 
270  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
271  uint32_t items = 64;
272 
273  // use as many groups as needed to cover the whole problem
274  uint32_t groups = divide_up_by(collection->metadata().size(), items);
275 
276  // map items to
277  // - threads with a single element per thread on a GPU backend
278  // - elements within a single thread on a CPU backend
279  auto workDiv = make_workdiv<Acc1D>(groups, items);
280 
281  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoKernelUpdate{}, input.view(), esData.view(), collection.view());
282 
283  return collection;
284  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19
PortableCollection< TestSoA > TestDeviceCollection
static std::string const input
Definition: EdmProvDump.cc:50

◆ updateMulti2()

portabletest::TestDeviceMultiCollection2 ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::updateMulti2 ( Queue &  queue,
portabletest::TestDeviceMultiCollection2 const &  input,
AlpakaESTestDataEDevice const &  esData 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), input, mps_monitormerge::items, createBeamHaloJobs::queue, and cms::alpakatest::AlpakaESTestDataE< TDev >::view().

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducerE::produce().

288  {
290 
291  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
292  uint32_t items = 64;
293 
294  // use as many groups as needed to cover the whole problem
295  auto sizes = collection.sizes();
296  uint32_t groups = divide_up_by(*std::max_element(sizes.begin(), sizes.end()), items);
297 
298  // map items to
299  // - threads with a single element per thread on a GPU backend
300  // - elements within a single thread on a CPU backend
301  auto workDiv = make_workdiv<Acc1D>(groups, items);
302 
303  alpaka::exec<Acc1D>(queue,
304  workDiv,
305  TestAlgoKernelUpdateMulti2{},
308  esData.view(),
311 
312  return collection;
313  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19
static std::string const input
Definition: EdmProvDump.cc:50
PortableCollection2< TestSoA, TestSoA2 > TestDeviceMultiCollection2

◆ updateMulti3()

portabletest::TestDeviceMultiCollection3 ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::updateMulti3 ( Queue &  queue,
portabletest::TestDeviceMultiCollection3 const &  input,
AlpakaESTestDataEDevice const &  esData 
) const

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

References universalConfigTemplate::collection, cms::alpakatools::divide_up_by(), input, mps_monitormerge::items, createBeamHaloJobs::queue, and cms::alpakatest::AlpakaESTestDataE< TDev >::view().

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducerE::produce().

317  {
319 
320  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
321  uint32_t items = 64;
322 
323  // use as many groups as needed to cover the whole problem
324  auto sizes = collection.sizes();
325  uint32_t groups = divide_up_by(*std::max_element(sizes.begin(), sizes.end()), items);
326 
327  // map items to
328  // - threads with a single element per thread on a GPU backend
329  // - elements within a single thread on a CPU backend
330  auto workDiv = make_workdiv<Acc1D>(groups, items);
331 
332  alpaka::exec<Acc1D>(queue,
333  workDiv,
334  TestAlgoKernelUpdateMulti3{},
338  esData.view(),
342 
343  return collection;
344  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:19
static std::string const input
Definition: EdmProvDump.cc:50
PortableCollection3< TestSoA, TestSoA2, TestSoA3 > TestDeviceMultiCollection3