CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
cms::alpakatools::ScopedContextProduce< TQueue, typename > Class Template Reference

#include <ScopedContext.h>

Inheritance diagram for cms::alpakatools::ScopedContextProduce< TQueue, typename >:
cms::alpakatools::impl::ScopedContextGetterBase< TQueue > cms::alpakatools::impl::ScopedContextBase< TQueue >

Public Types

using Event = alpaka::Event< Queue >
 
using Queue = TQueue
 
using ScopedContextGetterBase = impl::ScopedContextGetterBase< Queue >
 
- Public Types inherited from cms::alpakatools::impl::ScopedContextGetterBase< TQueue >
using Queue = TQueue
 
- Public Types inherited from cms::alpakatools::impl::ScopedContextBase< TQueue >
using Device = alpaka::Dev< Queue >
 
using Platform = alpaka::Pltf< Device >
 
using Queue = TQueue
 

Public Member Functions

template<typename T , typename... Args>
auto emplace (edm::Event &iEvent, edm::EDPutTokenT< Product< Queue, T >> token, Args &&... args)
 
 ScopedContextProduce (ContextState< Queue > &state)
 Constructor to re-use the queue of acquire() (ExternalWork module) More...
 
 ScopedContextProduce (ProductBase< Queue > const &data)
 
 ScopedContextProduce (edm::StreamID streamID)
 
template<typename T >
std::unique_ptr< Product< Queue, T > > wrap (T data)
 
 ~ScopedContextProduce ()
 Record the event, all asynchronous work must have been queued before the destructor. More...
 
- Public Member Functions inherited from cms::alpakatools::impl::ScopedContextGetterBase< TQueue >
const Tget (Product< Queue, T > const &data)
 
const Tget (edm::Event const &event, edm::EDGetTokenT< Product< Queue, T >> token)
 
- Public Member Functions inherited from cms::alpakatools::impl::ScopedContextBase< TQueue >
Device device () const
 
Queuequeue ()
 
const std::shared_ptr< Queue > & queuePtr () const
 

Private Member Functions

 ScopedContextProduce (std::shared_ptr< Queue > queue)
 

Private Attributes

std::shared_ptr< Eventevent_
 

Friends

class ::cms::alpakatest::TestScopedContext
 

Additional Inherited Members

- Protected Member Functions inherited from cms::alpakatools::impl::ScopedContextGetterBase< TQueue >
 ScopedContextGetterBase (Args &&... args)
 
void synchronizeStreams (ProductBase< Queue > const &data)
 
- Protected Member Functions inherited from cms::alpakatools::impl::ScopedContextBase< TQueue >
 ScopedContextBase (ProductBase< Queue > const &data)
 
 ScopedContextBase (std::shared_ptr< Queue > queue)
 
 ScopedContextBase (edm::StreamID streamID)
 

Detailed Description

template<typename TQueue, typename>
class cms::alpakatools::ScopedContextProduce< TQueue, typename >

The aim of this class is to do necessary per-event "initialization" in ExternalWork produce() or normal produce():

Definition at line 201 of file ScopedContext.h.

Member Typedef Documentation

◆ Event

template<typename TQueue , typename >
using cms::alpakatools::ScopedContextProduce< TQueue, typename >::Event = alpaka::Event<Queue>

Definition at line 204 of file ScopedContext.h.

◆ Queue

template<typename TQueue , typename >
using cms::alpakatools::ScopedContextProduce< TQueue, typename >::Queue = TQueue

Definition at line 203 of file ScopedContext.h.

◆ ScopedContextGetterBase

template<typename TQueue , typename >
using cms::alpakatools::ScopedContextProduce< TQueue, typename >::ScopedContextGetterBase = impl::ScopedContextGetterBase<Queue>

Definition at line 205 of file ScopedContext.h.

Constructor & Destructor Documentation

◆ ScopedContextProduce() [1/4]

template<typename TQueue , typename >
cms::alpakatools::ScopedContextProduce< TQueue, typename >::ScopedContextProduce ( ContextState< Queue > &  state)
inlineexplicit

Constructor to re-use the queue of acquire() (ExternalWork module)

Definition at line 211 of file ScopedContext.h.

References cms::alpakatools::impl::ScopedContextBase< TQueue >::device().

212  : ScopedContextGetterBase(state.releaseQueuePtr()), event_{getEventCache<Event>().get(device())} {}
impl::ScopedContextGetterBase< Queue > ScopedContextGetterBase

◆ ScopedContextProduce() [2/4]

template<typename TQueue , typename >
cms::alpakatools::ScopedContextProduce< TQueue, typename >::ScopedContextProduce ( ProductBase< Queue > const &  data)
inlineexplicit

Definition at line 214 of file ScopedContext.h.

References cms::alpakatools::impl::ScopedContextBase< TQueue >::device().

215  : ScopedContextGetterBase(data), event_{getEventCache<Event>().get(device())} {}
impl::ScopedContextGetterBase< Queue > ScopedContextGetterBase
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ ScopedContextProduce() [3/4]

template<typename TQueue , typename >
cms::alpakatools::ScopedContextProduce< TQueue, typename >::ScopedContextProduce ( edm::StreamID  streamID)
inlineexplicit

Definition at line 217 of file ScopedContext.h.

References cms::alpakatools::impl::ScopedContextBase< TQueue >::device().

218  : ScopedContextGetterBase(streamID), event_{getEventCache<Event>().get(device())} {}
impl::ScopedContextGetterBase< Queue > ScopedContextGetterBase

◆ ~ScopedContextProduce()

template<typename TQueue , typename >
cms::alpakatools::ScopedContextProduce< TQueue, typename >::~ScopedContextProduce ( )
inline

Record the event, all asynchronous work must have been queued before the destructor.

Definition at line 221 of file ScopedContext.h.

References cms::alpakatools::ScopedContextProduce< TQueue, typename >::event_, and cms::alpakatools::impl::ScopedContextBase< TQueue >::queue().

221  {
222  // FIXME: this may throw an execption if the underlaying call fails.
223  alpaka::enqueue(queue(), *event_);
224  }

◆ ScopedContextProduce() [4/4]

template<typename TQueue , typename >
cms::alpakatools::ScopedContextProduce< TQueue, typename >::ScopedContextProduce ( std::shared_ptr< Queue queue)
inlineexplicitprivate

Definition at line 240 of file ScopedContext.h.

References cms::alpakatools::impl::ScopedContextBase< TQueue >::device().

241  : ScopedContextGetterBase(std::move(queue)), event_{getEventCache<Event>().get(device())} {}
impl::ScopedContextGetterBase< Queue > ScopedContextGetterBase
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ emplace()

template<typename TQueue , typename >
template<typename T , typename... Args>
auto cms::alpakatools::ScopedContextProduce< TQueue, typename >::emplace ( edm::Event iEvent,
edm::EDPutTokenT< Product< Queue, T >>  token,
Args &&...  args 
)
inline

◆ wrap()

template<typename TQueue , typename >
template<typename T >
std::unique_ptr<Product<Queue, T> > cms::alpakatools::ScopedContextProduce< TQueue, typename >::wrap ( T  data)
inline

Definition at line 227 of file ScopedContext.h.

References data, eostools::move(), and cms::alpakatools::impl::ScopedContextBase< TQueue >::queuePtr().

227  {
228  // make_unique doesn't work because of private constructor
229  return std::unique_ptr<Product<Queue, T>>(new Product<Queue, T>(queuePtr(), std::move(data)));
230  }
const std::shared_ptr< Queue > & queuePtr() const
Definition: ScopedContext.h:42
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
def move(src, dest)
Definition: eostools.py:511

Friends And Related Function Documentation

◆ ::cms::alpakatest::TestScopedContext

template<typename TQueue , typename >
friend class ::cms::alpakatest::TestScopedContext
friend

Definition at line 238 of file ScopedContext.h.

Member Data Documentation

◆ event_

template<typename TQueue , typename >
std::shared_ptr<Event> cms::alpakatools::ScopedContextProduce< TQueue, typename >::event_
private