Template Numerical Library version\ main:52827a2
Loading...
Searching...
No Matches
TNL::Containers::ByteArraySynchronizer< Device, Index > Class Template Referenceabstract
Collaboration diagram for TNL::Containers::ByteArraySynchronizer< Device, Index >:

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
 

Member Function Documentation

◆ synchronizeByteArray()

template<typename Device , typename Index >
virtual void TNL::Containers::ByteArraySynchronizer< Device, Index >::synchronizeByteArray ( ByteArrayView array,
int bytesPerValue )
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 >.

◆ synchronizeByteArrayAsync()

template<typename Device , typename Index >
void TNL::Containers::ByteArraySynchronizer< Device, Index >::synchronizeByteArrayAsync ( ByteArrayView array,
int bytesPerValue,
AsyncPolicy policy = AsyncPolicy::synchronous )
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.

Member Data Documentation

◆ async_op

template<typename Device , typename Index >
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(); }


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