Template Numerical Library version\ main:4e58ea6
|
Public Types | |
enum class | AsyncPolicy { synchronous , deferred , threadpool , async } |
using | ByteArrayView = ArrayView< std::uint8_t, Device, Index > |
using | RequestsVector = std::vector< MPI_Request > |
Public Member Functions | |
virtual void | synchronizeByteArray (ByteArrayView array, int bytesPerValue)=0 |
Main synchronization function. | |
void | synchronizeByteArrayAsync (ByteArrayView array, int bytesPerValue, AsyncPolicy policy=AsyncPolicy::synchronous) |
An asynchronous version of synchronizeByteArray. | |
virtual RequestsVector | synchronizeByteArrayAsyncWorker (ByteArrayView array, int bytesPerValue)=0 |
Public Attributes | |
std::future< void > | async_op |
Can be used for checking if a synchronization started asynchronously has been finished. | |
std::size_t | async_ops_count = 0 |
Timer | async_start_timer |
Timer | async_wait_before_start_timer |
Timer | async_wait_timer |
|
pure virtual |
Main synchronization function.
This is only a pure virtual function – the functionality must be implemented in a subclass.
Implemented in TNL::Containers::DistributedArraySynchronizer< DistributedArray >, and TNL::Meshes::DistributedMeshes::DistributedMeshSynchronizer< DistributedMesh, EntityDimension >.
|
inline |
An asynchronous version of synchronizeByteArray.
Note that this method is not thread-safe - only the thread which created and "owns" the instance of this object can call this method.
Note that at most one async operation may be active at a time, the following calls will block until the pending operation is finished.
std::future< void > TNL::Containers::ByteArraySynchronizer< Device, Index >::async_op |
Can be used for checking if a synchronization started asynchronously has been finished.
Note that derived classes must make this check in the destructor, otherwise running synchronizeByteArrayAsync would lead to the error pure virtual method called
when the derived object is destructed before the async operation finishes. This cannot be implemented in the base class destructor, because the derived destructor is run first.
~Derived() { if( this->async_op.valid() ) this->async_op.wait(); }