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) const
 

Detailed Description

Definition at line 9 of file TestAlgo.h.

Member Function Documentation

◆ fill()

void ALPAKA_ACCELERATOR_NAMESPACE::TestAlgo::fill ( Queue &  queue,
portabletest::TestDeviceCollection collection 
) const

Definition at line 39 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().

39  {
40  // use 64 items per group (this value is arbitrary, but it's a reasonable starting point)
41  uint32_t items = 64;
42 
43  // use as many groups as needed to cover the whole problem
44  uint32_t groups = divide_up_by(collection->metadata().size(), items);
45 
46  // map items to
47  // - threads with a single element per thread on a GPU backend
48  // - elements within a single thread on a CPU backend
49  auto workDiv = make_workdiv<Acc1D>(groups, items);
50 
51  alpaka::exec<Acc1D>(queue, workDiv, TestAlgoKernel{}, collection.view(), collection->metadata().size());
52  }
constexpr Idx divide_up_by(Idx value, Idx divisor)
Definition: workdivision.h:20