LAMA
lama::SyncToken Class Reference

Abstract class that defines tokens for asynchronous operations. More...

#include <SyncToken.hpp>

Inheritance diagram for lama::SyncToken:

Public Member Functions

 SyncToken ()
 Default constructor.
virtual ~SyncToken ()
 Destructor.
bool isSynchronized () const
 Query whether token has already been synchronized.
virtual void wait ()=0
 Method to wait on the completion of an operation.
virtual bool probe () const =0
 Predicate to ask if an asynchronous operation is already completed.
virtual void writeAt (std::ostream &stream) const
 Base class provides a default implementation for the virtual method of Printable.
void pushAccess (std::auto_ptr< BaseAccess > access)
 Add a read/write access to the token so that LAMA arrays will be locked until synchronization.
void pushArray (std::auto_ptr< _LAMAArray > array)
 Add a LAMA array that will be free after synchronization.
void pushSyncToken (std::auto_ptr< SyncToken > syncToken)
 Add a Synctoken that will be synchronized after synchronization.

Protected Member Functions

void setSynchronized ()
 This method should be called by base classes after a successful wait.
 LAMA_LOG_DECL_STATIC_LOGGER (logger)
 logger for this class

Private Attributes

std::vector< BaseAccess * > mAccesses
 Vector of accesses that will be freed after completion.
std::vector< _LAMAArray * > mArrays
std::vector< SyncToken * > mChilds
bool mSynchronized

Detailed Description

Abstract class that defines tokens for asynchronous operations.

Communication and computations can be executed asynchronously. A token is needed mainly to wait on the completion of the operation.

This class also supports the possibility to push LAMA array accesses and LAMA arrays to a token. After successful synchronization, the accesses are destroyed and the arrays can be accesses for other purposes. LAMA arrays used for temporary purpose can also be freed at synchronization.


Constructor & Destructor Documentation

Default constructor.

Destructor.

The destructor will not wait here for completion of the action this must be done in each derived class.

References mAccesses, mArrays, mChilds, and mSynchronized.


Member Function Documentation

logger for this class

Reimplemented in lama::TaskSyncToken, and CUDATracerSyncToken.

virtual bool lama::SyncToken::probe ( ) const [pure virtual]

Predicate to ask if an asynchronous operation is already completed.

Implemented in lama::CUDAStreamSyncToken, lama::MPISyncToken, lama::TaskSyncToken, lama::PGASSyncToken, CUDATracerSyncToken, and lama::NoSyncToken.

void lama::SyncToken::pushAccess ( std::auto_ptr< BaseAccess access)

Add a read/write access to the token so that LAMA arrays will be locked until synchronization.

References LAMA_ASSERT_ERROR, mAccesses, and mSynchronized.

Referenced by lama::ELLStorage< T >::matrixTimesVectorAsync(), lama::CSRStorage< T >::matrixTimesVectorAsync(), and lama::COOStorage< T >::matrixTimesVectorAsyncToDo().

void lama::SyncToken::pushArray ( std::auto_ptr< _LAMAArray array)

Add a LAMA array that will be free after synchronization.

References LAMA_ASSERT_ERROR, mArrays, and mSynchronized.

void lama::SyncToken::pushSyncToken ( std::auto_ptr< SyncToken syncToken)

Add a Synctoken that will be synchronized after synchronization.

References LAMA_ASSERT_ERROR, mChilds, and mSynchronized.

Referenced by CUDATracerHelper< Tracer >::CUDATracerHelper().

virtual void lama::SyncToken::wait ( ) [pure virtual]
void lama::SyncToken::writeAt ( std::ostream &  stream) const [virtual]

Base class provides a default implementation for the virtual method of Printable.

Reimplemented from Printable.

Reimplemented in lama::MPISyncToken, lama::TaskSyncToken, lama::PGASSyncToken, and lama::NoSyncToken.

References mSynchronized.


Field Documentation

std::vector< BaseAccess* > lama::SyncToken::mAccesses [private]

Vector of accesses that will be freed after completion.

Referenced by pushAccess(), setSynchronized(), and ~SyncToken().

std::vector< _LAMAArray* > lama::SyncToken::mArrays [private]
std::vector< SyncToken* > lama::SyncToken::mChilds [private]

The documentation for this class was generated from the following files: