CMS 3D CMS Logo

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

#include <ContextState.h>

Public Types

using Device = alpaka::Dev< Queue >
 
using Queue = TQueue
 

Public Member Functions

 ContextState ()=default
 
 ContextState (const ContextState &)=delete
 
 ContextState (ContextState &&)=delete
 
ContextStateoperator= (const ContextState &)=delete
 
ContextStateoperator= (ContextState &&other)=delete
 
 ~ContextState ()=default
 

Private Member Functions

Device device () const
 
Queue queue () const
 
std::shared_ptr< Queue > const & queuePtr () const
 
std::shared_ptr< QueuereleaseQueuePtr ()
 
void set (std::shared_ptr< Queue > queue)
 
void throwIfNoQueue () const
 
void throwIfQueue () const
 

Private Attributes

std::shared_ptr< Queuequeue_
 

Friends

class ScopedContextAcquire< TQueue >
 
class ScopedContextProduce< TQueue >
 
class ScopedContextTask< TQueue >
 

Detailed Description

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
class cms::alpakatools::ContextState< TQueue, typename >

The purpose of this class is to deliver the device and queue information from ExternalWork's acquire() to producer() via a member/QueueCache variable.

Definition at line 22 of file ContextState.h.

Member Typedef Documentation

◆ Device

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
using cms::alpakatools::ContextState< TQueue, typename >::Device = alpaka::Dev<Queue>

Definition at line 25 of file ContextState.h.

◆ Queue

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
using cms::alpakatools::ContextState< TQueue, typename >::Queue = TQueue

Definition at line 24 of file ContextState.h.

Constructor & Destructor Documentation

◆ ContextState() [1/3]

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
cms::alpakatools::ContextState< TQueue, typename >::ContextState ( )
default

◆ ~ContextState()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
cms::alpakatools::ContextState< TQueue, typename >::~ContextState ( )
default

◆ ContextState() [2/3]

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
cms::alpakatools::ContextState< TQueue, typename >::ContextState ( const ContextState< TQueue, typename > &  )
delete

◆ ContextState() [3/3]

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
cms::alpakatools::ContextState< TQueue, typename >::ContextState ( ContextState< TQueue, typename > &&  )
delete

Member Function Documentation

◆ device()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
Device cms::alpakatools::ContextState< TQueue, typename >::device ( ) const
inlineprivate

Definition at line 45 of file ContextState.h.

45  {
47  return alpaka::getDev(*queue_);
48  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82

◆ operator=() [1/2]

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
ContextState& cms::alpakatools::ContextState< TQueue, typename >::operator= ( const ContextState< TQueue, typename > &  )
delete

◆ operator=() [2/2]

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
ContextState& cms::alpakatools::ContextState< TQueue, typename >::operator= ( ContextState< TQueue, typename > &&  other)
delete

◆ queue()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
Queue cms::alpakatools::ContextState< TQueue, typename >::queue ( ) const
inlineprivate

Definition at line 50 of file ContextState.h.

Referenced by cms::alpakatools::ContextState< Queue >::releaseQueuePtr(), and cms::alpakatools::ContextState< Queue >::set().

50  {
52  return *queue_;
53  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82

◆ queuePtr()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
std::shared_ptr<Queue> const& cms::alpakatools::ContextState< TQueue, typename >::queuePtr ( ) const
inlineprivate

Definition at line 55 of file ContextState.h.

55  {
57  return queue_;
58  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82

◆ releaseQueuePtr()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
std::shared_ptr<Queue> cms::alpakatools::ContextState< TQueue, typename >::releaseQueuePtr ( )
inlineprivate

Definition at line 60 of file ContextState.h.

60  {
62  // This function needs to effectively reset queue_ (i.e. queue_
63  // must be empty after this function). This behavior ensures that
64  // the std::shared_ptr<Queue> is not hold for inadvertedly long (i.e. to
65  // the next event), and is checked at run time.
67  return queue;
68  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82
def move(src, dest)
Definition: eostools.py:511

◆ set()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
void cms::alpakatools::ContextState< TQueue, typename >::set ( std::shared_ptr< Queue queue)
inlineprivate

Definition at line 40 of file ContextState.h.

Referenced by cms::alpakatools::ScopedContextAcquire< TQueue, typename >::~ScopedContextAcquire().

40  {
41  throwIfQueue();
43  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82
def move(src, dest)
Definition: eostools.py:511

◆ throwIfNoQueue()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
void cms::alpakatools::ContextState< TQueue, typename >::throwIfNoQueue ( ) const
inlineprivate

Definition at line 76 of file ContextState.h.

Referenced by cms::alpakatools::ContextState< Queue >::device(), cms::alpakatools::ContextState< Queue >::queue(), cms::alpakatools::ContextState< Queue >::queuePtr(), and cms::alpakatools::ContextState< Queue >::releaseQueuePtr().

76  {
77  if (not queue_) {
78  throw cms::Exception("LogicError") << "Trying to get ContextState, but it did not have a valid state";
79  }
80  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82

◆ throwIfQueue()

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
void cms::alpakatools::ContextState< TQueue, typename >::throwIfQueue ( ) const
inlineprivate

Definition at line 70 of file ContextState.h.

Referenced by cms::alpakatools::ContextState< Queue >::set().

70  {
71  if (queue_) {
72  throw cms::Exception("LogicError") << "Trying to set ContextState, but it already had a valid state";
73  }
74  }
std::shared_ptr< Queue > queue_
Definition: ContextState.h:82

Friends And Related Function Documentation

◆ ScopedContextAcquire< TQueue >

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
friend class ScopedContextAcquire< TQueue >
friend

Definition at line 36 of file ContextState.h.

◆ ScopedContextProduce< TQueue >

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
friend class ScopedContextProduce< TQueue >
friend

Definition at line 37 of file ContextState.h.

◆ ScopedContextTask< TQueue >

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
friend class ScopedContextTask< TQueue >
friend

Definition at line 38 of file ContextState.h.

Member Data Documentation

◆ queue_

template<typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
std::shared_ptr<Queue> cms::alpakatools::ContextState< TQueue, typename >::queue_
private