ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
AthCUDA::StreamHolder Class Reference

Helper class for handling CUDA streams. More...

#include <StreamHolder.h>

Collaboration diagram for AthCUDA::StreamHolder:

Public Member Functions

 StreamHolder ()
 Friend declaration(s). More...
 
 StreamHolder (void *stream, IStreamPoolSvc *pool)
 Constructor with the stream and the pool service. More...
 
 StreamHolder (const StreamHolder &)=delete
 Copy constructor. More...
 
 StreamHolder (StreamHolder &&parent)
 Move constructor. More...
 
 ~StreamHolder ()
 Destructor. More...
 
StreamHolderoperator= (const StreamHolder &)=delete
 Copy assignment operator. More...
 
StreamHolderoperator= (StreamHolder &&rhs)
 Move assignment operator. More...
 
 operator bool () const
 Convenience operator for checking if the holder has a valid object. More...
 

Private Attributes

void * m_stream
 The managed stream. More...
 
IStreamPoolSvcm_pool
 The pool that this holder is attached to. More...
 

Detailed Description

Helper class for handling CUDA streams.

This class is used to:

Note that objects of this type can only be moved, they can not be copied.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 24 of file StreamHolder.h.

Constructor & Destructor Documentation

◆ StreamHolder() [1/4]

AthCUDA::StreamHolder::StreamHolder ( )

Friend declaration(s).

Default constructor

Definition at line 11 of file StreamHolder.cxx.

12  : m_stream( nullptr ), m_pool( nullptr ) {
13 
14  }

◆ StreamHolder() [2/4]

AthCUDA::StreamHolder::StreamHolder ( void *  stream,
IStreamPoolSvc pool 
)

Constructor with the stream and the pool service.

Definition at line 16 of file StreamHolder.cxx.

17  : m_stream( stream ), m_pool( pool ) {
18 
19  }

◆ StreamHolder() [3/4]

AthCUDA::StreamHolder::StreamHolder ( const StreamHolder )
delete

Copy constructor.

◆ StreamHolder() [4/4]

AthCUDA::StreamHolder::StreamHolder ( StreamHolder &&  parent)

Move constructor.

Definition at line 21 of file StreamHolder.cxx.

22  : m_stream( parent.m_stream ), m_pool( parent.m_pool ) {
23 
24  parent.m_stream = nullptr;
25  parent.m_pool = nullptr;
26  }

◆ ~StreamHolder()

AthCUDA::StreamHolder::~StreamHolder ( )

Destructor.

Definition at line 28 of file StreamHolder.cxx.

28  {
29 
30  if( ( m_stream != nullptr ) && ( m_pool != nullptr ) ) {
31  m_pool->yieldStream( *this );
32  }
33  }

Member Function Documentation

◆ operator bool()

AthCUDA::StreamHolder::operator bool ( ) const

Convenience operator for checking if the holder has a valid object.

Definition at line 50 of file StreamHolder.cxx.

50  {
51 
52  return ( m_stream != nullptr );
53  }

◆ operator=() [1/2]

StreamHolder& AthCUDA::StreamHolder::operator= ( const StreamHolder )
delete

Copy assignment operator.

◆ operator=() [2/2]

StreamHolder & AthCUDA::StreamHolder::operator= ( StreamHolder &&  rhs)

Move assignment operator.

Definition at line 35 of file StreamHolder.cxx.

35  {
36 
37  // Check if anything needs to be done.
38  if( this == &rhs ) {
39  return *this;
40  }
41 
42  // Perform the move.
43  m_stream = rhs.m_stream;
44  rhs.m_stream = nullptr;
45  m_pool = rhs.m_pool;
46  rhs.m_pool = nullptr;
47  return *this;
48  }

Member Data Documentation

◆ m_pool

IStreamPoolSvc* AthCUDA::StreamHolder::m_pool
private

The pool that this holder is attached to.

Definition at line 55 of file StreamHolder.h.

◆ m_stream

void* AthCUDA::StreamHolder::m_stream
private

The managed stream.

Definition at line 53 of file StreamHolder.h.


The documentation for this class was generated from the following files:
AthCUDA::StreamHolder::m_stream
void * m_stream
The managed stream.
Definition: StreamHolder.h:53
pool
pool namespace
Definition: libname.h:15
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
AthCUDA::StreamHolder::m_pool
IStreamPoolSvc * m_pool
The pool that this holder is attached to.
Definition: StreamHolder.h:55
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthCUDA::IStreamPoolSvc::yieldStream
virtual void yieldStream(StreamHolder &stream)=0
Put a given stream back into the pool.