Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::DataSynchronizeBufferBase Class Referenceabstract

Base class for the IDataSynchronizeBuffer implementation. More...

#include <arcane/impl/internal/DataSynchronizeBuffer.h>

Inheritance diagram for Arcane::DataSynchronizeBufferBase:
Collaboration diagram for Arcane::DataSynchronizeBufferBase:

Classes

class  BufferInfo
 Buffer for one synchronization element (send, receive, or comparison). More...

Public Member Functions

Int32 nbRank () const final
 Number of ranks.
Int32 targetRank (Int32 index) const final
 Target rank of the index-th rank.
bool hasGlobalBuffer () const final
 Indicates if the buffers are global.
MutableMemoryView receiveBuffer (Int32 index) final
 Receive buffer for the index-th rank.
MutableMemoryView sendBuffer (Int32 index) final
 Send buffer for the index-th rank.
Int64 receiveDisplacement (Int32 index) const final
 Displacement (in bytes) from the start of receiveBuffer() for the index-th rank.
Int64 sendDisplacement (Int32 index) const final
 Displacement (in bytes) from the start of sendBuffer() for the index-th rank.
MutableMemoryView globalReceiveBuffer () final
 Receive buffer.
MutableMemoryView globalSendBuffer () final
 Send buffer.
Int64 totalReceiveSize () const final
 Total size to receive in bytes.
Int64 totalSendSize () const final
 Total size to send in bytes.
void barrier () final
 Waits until the copies (copySendAsync() and copyReceiveAsync()) are finished.
 DataSynchronizeBufferBase (DataSynchronizeInfo *sync_info, Ref< IBufferCopier > copier)
bool isCompareSynchronizedValues () const
 Indicates whether values are compared before/after synchronization.
void setSynchronizeBuffer (Ref< MemoryBuffer > v)
virtual void prepareSynchronize (bool is_compare_sync)=0
 Prepares the synchronization.
Public Member Functions inherited from Arcane::IDataSynchronizeBuffer
virtual void copyReceiveAsync (Int32 index)=0
 Copies into the data from the receive buffer of the index-th rank.
virtual void copyAllReceive ()
 Copies all data from the receive buffer.
virtual void copySendAsync (Int32 index)=0
 Copies the data of the index-th rank into the send buffer.
virtual void copyAllSend ()
 Copies all data into the send buffer.

Protected Member Functions

void _allocateBuffers ()
 Calculates and allocates the buffers necessary for sends and receives for 1D variable synchronizations.
void _compute (ConstArrayView< Int32 > datatype_sizes)
 Computes the information for the synchronization.

Protected Attributes

DataSynchronizeInfom_sync_info = nullptr
BufferInfo m_ghost_buffer_info
 Buffer for all data of ghost entities used for reception.
BufferInfo m_share_buffer_info
 Buffer for all data of shared entities used for sending.
BufferInfo m_compare_sync_buffer_info
 Buffer for testing if synchronization modified the values of ghost cells.
Int32 m_nb_rank = 0
bool m_is_compare_sync_values = false
Ref< MemoryBufferm_memory
 Buffer containing the concatenated data for sending and receiving.
Ref< IBufferCopierm_buffer_copier

Detailed Description

Base class for the IDataSynchronizeBuffer implementation.

This implementation uses a single memory buffer to manage the three parts of the synchronization: the send buffer, the receive buffer, and the buffer for comparing if the synchronization modified values (the latter is optional). Each buffer is then divided into N parts, called sub-buffers, where N is the number of ranks communicating. Finally, each sub-buffer is itself divided into P parts, where P is the number of data items to communicate.

Definition at line 52 of file DataSynchronizeBuffer.h.

Constructor & Destructor Documentation

◆ DataSynchronizeBufferBase()

Arcane::DataSynchronizeBufferBase::DataSynchronizeBufferBase ( DataSynchronizeInfo * sync_info,
Ref< IBufferCopier > copier )

Definition at line 209 of file DataSynchronizeBuffer.cc.

Member Function Documentation

◆ _allocateBuffers()

void Arcane::DataSynchronizeBufferBase::_allocateBuffers ( )
protected

Calculates and allocates the buffers necessary for sends and receives for 1D variable synchronizations.

_compute() must be called beforehand to calculate the sizes and offsets for each buffer.

Todo
: do not conserve buffers for each data type of the variables because their retention is costly in terms of memory.

Definition at line 266 of file DataSynchronizeBuffer.cc.

References m_compare_sync_buffer_info, m_ghost_buffer_info, m_memory, m_share_buffer_info, Arcane::makeMutableMemoryView(), and Arcane::Span< T, Extent >::subspan().

Referenced by _compute(), and prepareSynchronize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _compute()

void Arcane::DataSynchronizeBufferBase::_compute ( ConstArrayView< Int32 > datatype_sizes)
protected

Computes the information for the synchronization.

Calculates and allocates the buffers necessary for sends and receives for 1D variable synchronizations.

Definition at line 241 of file DataSynchronizeBuffer.cc.

References _allocateBuffers(), m_compare_sync_buffer_info, m_ghost_buffer_info, and m_share_buffer_info.

Referenced by prepareSynchronize(), Arcane::MultiDataSynchronizeBuffer::prepareSynchronize(), and Arcane::SingleDataSynchronizeBuffer::prepareSynchronize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ barrier()

void Arcane::DataSynchronizeBufferBase::barrier ( )
finalvirtual

Waits until the copies (copySendAsync() and copyReceiveAsync()) are finished.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 228 of file DataSynchronizeBuffer.cc.

◆ globalReceiveBuffer()

MutableMemoryView Arcane::DataSynchronizeBufferBase::globalReceiveBuffer ( )
inlinefinalvirtual

Receive buffer.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 124 of file DataSynchronizeBuffer.h.

References m_ghost_buffer_info.

◆ globalSendBuffer()

MutableMemoryView Arcane::DataSynchronizeBufferBase::globalSendBuffer ( )
inlinefinalvirtual

Send buffer.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 125 of file DataSynchronizeBuffer.h.

References m_share_buffer_info.

◆ hasGlobalBuffer()

bool Arcane::DataSynchronizeBufferBase::hasGlobalBuffer ( ) const
inlinefinalvirtual

Indicates if the buffers are global.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 116 of file DataSynchronizeBuffer.h.

◆ isCompareSynchronizedValues()

bool Arcane::DataSynchronizeBufferBase::isCompareSynchronizedValues ( ) const
inline

Indicates whether values are compared before/after synchronization.

Definition at line 139 of file DataSynchronizeBuffer.h.

References isCompareSynchronizedValues().

Referenced by isCompareSynchronizedValues().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nbRank()

Int32 Arcane::DataSynchronizeBufferBase::nbRank ( ) const
inlinefinalvirtual

Number of ranks.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 114 of file DataSynchronizeBuffer.h.

Referenced by Arcane::SingleDataSynchronizeBuffer::prepareSynchronize().

Here is the caller graph for this function:

◆ prepareSynchronize()

virtual void Arcane::DataSynchronizeBufferBase::prepareSynchronize ( bool is_compare_sync)
pure virtual

Prepares the synchronization.

Prepares the synchronization and allocates buffers if necessary.

If is_compare_sync is true, the values of ghost entities are compared after synchronization with their value before synchronization.

setSynchronizeBuffer() must be called at least once before calling this method to position the allocated memory area.

Implemented in Arcane::MultiDataSynchronizeBuffer, and Arcane::SingleDataSynchronizeBuffer.

References _allocateBuffers(), and _compute().

Here is the call graph for this function:

◆ receiveBuffer()

MutableMemoryView Arcane::DataSynchronizeBufferBase::receiveBuffer ( Int32 index)
inlinefinalvirtual

Receive buffer for the index-th rank.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 118 of file DataSynchronizeBuffer.h.

References m_ghost_buffer_info.

◆ receiveDisplacement()

Int64 Arcane::DataSynchronizeBufferBase::receiveDisplacement ( Int32 index) const
inlinefinalvirtual

Displacement (in bytes) from the start of receiveBuffer() for the index-th rank.

This value is only meaningful if hasGlobalBuffer() is true.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 121 of file DataSynchronizeBuffer.h.

References m_ghost_buffer_info.

◆ sendBuffer()

MutableMemoryView Arcane::DataSynchronizeBufferBase::sendBuffer ( Int32 index)
inlinefinalvirtual

Send buffer for the index-th rank.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 119 of file DataSynchronizeBuffer.h.

References m_share_buffer_info.

◆ sendDisplacement()

Int64 Arcane::DataSynchronizeBufferBase::sendDisplacement ( Int32 index) const
inlinefinalvirtual

Displacement (in bytes) from the start of sendBuffer() for the index-th rank.

This value is only meaningful if hasGlobalBuffer() is true.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 122 of file DataSynchronizeBuffer.h.

References m_share_buffer_info.

◆ setSynchronizeBuffer()

void Arcane::DataSynchronizeBufferBase::setSynchronizeBuffer ( Ref< MemoryBuffer > v)
inline

Definition at line 141 of file DataSynchronizeBuffer.h.

◆ targetRank()

Int32 Arcane::DataSynchronizeBufferBase::targetRank ( Int32 index) const
finalvirtual

Target rank of the index-th rank.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 219 of file DataSynchronizeBuffer.cc.

◆ totalReceiveSize()

Int64 Arcane::DataSynchronizeBufferBase::totalReceiveSize ( ) const
inlinefinalvirtual

Total size to receive in bytes.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 127 of file DataSynchronizeBuffer.h.

References m_ghost_buffer_info.

◆ totalSendSize()

Int64 Arcane::DataSynchronizeBufferBase::totalSendSize ( ) const
inlinefinalvirtual

Total size to send in bytes.

Implements Arcane::IDataSynchronizeBuffer.

Definition at line 128 of file DataSynchronizeBuffer.h.

References m_share_buffer_info.

Member Data Documentation

◆ m_buffer_copier

Ref<IBufferCopier> Arcane::DataSynchronizeBufferBase::m_buffer_copier
protected

Definition at line 183 of file DataSynchronizeBuffer.h.

◆ m_compare_sync_buffer_info

BufferInfo Arcane::DataSynchronizeBufferBase::m_compare_sync_buffer_info
protected

Buffer for testing if synchronization modified the values of ghost cells.

Definition at line 173 of file DataSynchronizeBuffer.h.

Referenced by _allocateBuffers(), _compute(), Arcane::SingleDataSynchronizeBuffer::finalizeSynchronize(), and Arcane::SingleDataSynchronizeBuffer::prepareSynchronize().

◆ m_ghost_buffer_info

◆ m_is_compare_sync_values

bool Arcane::DataSynchronizeBufferBase::m_is_compare_sync_values = false
protected

Definition at line 178 of file DataSynchronizeBuffer.h.

◆ m_memory

Ref<MemoryBuffer> Arcane::DataSynchronizeBufferBase::m_memory
protected

Buffer containing the concatenated data for sending and receiving.

Definition at line 181 of file DataSynchronizeBuffer.h.

Referenced by _allocateBuffers().

◆ m_nb_rank

Int32 Arcane::DataSynchronizeBufferBase::m_nb_rank = 0
protected

Definition at line 177 of file DataSynchronizeBuffer.h.

◆ m_share_buffer_info

BufferInfo Arcane::DataSynchronizeBufferBase::m_share_buffer_info
protected

◆ m_sync_info

DataSynchronizeInfo* Arcane::DataSynchronizeBufferBase::m_sync_info = nullptr
protected

Definition at line 167 of file DataSynchronizeBuffer.h.


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