LAMA
|
Abstract class that defines tokens for asynchronous operations. More...
#include <SyncToken.hpp>
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 |
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.
Default constructor.
lama::SyncToken::~SyncToken | ( | ) | [virtual] |
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.
bool lama::SyncToken::isSynchronized | ( | ) | const |
Query whether token has already been synchronized.
References mSynchronized.
Referenced by lama::PGASSyncToken::probe(), lama::CUDAStreamSyncToken::probe(), lama::NoSyncToken::wait(), lama::PGASSyncToken::wait(), lama::TaskSyncToken::wait(), lama::MPISyncToken::wait(), lama::CUDAStreamSyncToken::wait(), lama::NoSyncToken::writeAt(), lama::PGASSyncToken::writeAt(), lama::TaskSyncToken::writeAt(), lama::MPISyncToken::writeAt(), CUDATracerSyncToken::~CUDATracerSyncToken(), lama::MPISyncToken::~MPISyncToken(), lama::NoSyncToken::~NoSyncToken(), and lama::PGASSyncToken::~PGASSyncToken().
lama::SyncToken::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected] |
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().
void lama::SyncToken::setSynchronized | ( | ) | [protected] |
This method should be called by base classes after a successful wait.
References LAMA_THROWEXCEPTION, mAccesses, mArrays, mChilds, and mSynchronized.
Referenced by lama::NoSyncToken::wait(), CUDATracerSyncToken::wait(), lama::PGASSyncToken::wait(), lama::TaskSyncToken::wait(), lama::MPISyncToken::wait(), lama::CUDAStreamSyncToken::wait(), and lama::NoSyncToken::~NoSyncToken().
virtual void lama::SyncToken::wait | ( | ) | [pure virtual] |
Method to wait on the completion of an operation.
Implemented in lama::CUDAStreamSyncToken, lama::MPISyncToken, lama::TaskSyncToken, lama::PGASSyncToken, CUDATracerSyncToken, and lama::NoSyncToken.
Referenced by lama::DenseMatrix< T >::matrixTimesVectorImpl().
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.
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] |
Referenced by pushArray(), setSynchronized(), and ~SyncToken().
std::vector< SyncToken* > lama::SyncToken::mChilds [private] |
Referenced by pushSyncToken(), setSynchronized(), and ~SyncToken().
bool lama::SyncToken::mSynchronized [private] |
Referenced by isSynchronized(), pushAccess(), pushArray(), pushSyncToken(), setSynchronized(), writeAt(), and ~SyncToken().