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
 

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,
double  xvalue = 0. 
) const

Definition at line 42 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(), ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaGlobalProducerOffset::produce(), and ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaStreamProducer::produce().

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