Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::VariableSynchronizer Class Reference

Interface of a variable synchronization service. More...

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

Inheritance diagram for Arcane::VariableSynchronizer:
Collaboration diagram for Arcane::VariableSynchronizer:

Classes

class  SyncMessage
 Synchronization management. More...

Public Member Functions

 VariableSynchronizer (IParallelMng *pm, const ItemGroup &group, Ref< IDataSynchronizeImplementationFactory > implementation_factory)
IParallelMngparallelMng () override
 Associated parallel manager.
const ItemGroupitemGroup () override
 Entity group used for synchronization.
void compute () override
 Creation of the list of synchronization elements.
void changeLocalIds (Int32ConstArrayView old_to_new_ids) override
 Called when the local IDs of the entities are modified.
void synchronize (IVariable *var) override
 Synchronizes the variable var in blocking mode.
void synchronize (IVariable *var, Int32ConstArrayView local_ids) override
 Synchronizes the variable var on the entities local_ids in blocking mode.
void synchronize (VariableCollection vars) override
 Synchronizes the variables vars in blocking mode.
void synchronize (VariableCollection vars, Int32ConstArrayView local_ids) override
 Synchronizes the variables vars in blocking mode.
Int32ConstArrayView communicatingRanks () override
 Ranks of subdomains with which communication occurs.
Int32ConstArrayView sharedItems (Int32 index) override
 List of local IDs of entities shared with a subdomain.
Int32ConstArrayView ghostItems (Int32 index) override
 List of local IDs of ghost entities with a subdomain.
void synchronizeData (IData *data) override
 Synchronizes the data data.
EventObservable< const VariableSynchronizerEventArgs & > & onSynchronized () override
 Event sent at the beginning and end of synchronization.
IVariableSynchronizerMngsynchronizeMng () const
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const

Private Member Functions

void _synchronize (IVariable *var, SyncMessage *message)
void _synchronizeMulti (const VariableCollection &vars, SyncMessage *message)
bool _canSynchronizeMulti (const VariableCollection &vars)
 Indicates if the variables in the list vars can be synchronized at once.
DataSynchronizeResult _synchronize (INumericDataInternal *data, bool is_compare_sync)
SyncMessage_buildMessage ()
SyncMessage_buildMessage (Ref< DataSynchronizeInfo > &sync_info)
void _rebuildMessage (Int32ConstArrayView local_ids)
void _sendBeginEvent (VariableSynchronizerEventArgs &args)
void _sendEndEvent (VariableSynchronizerEventArgs &args)
void _sendEvent (VariableSynchronizerEventArgs &args)
void _checkCreateTimer ()
void _doSynchronize (SyncMessage *message)
void _setCurrentDevice ()
 Positions the device associated with our RunQueue as the current device.

Private Attributes

IParallelMngm_parallel_mng = nullptr
ItemGroup m_item_group
Ref< DataSynchronizeInfom_sync_info
Timerm_sync_timer = nullptr
bool m_is_verbose = false
bool m_allow_multi_sync = true
bool m_trace_sync = false
EventObservable< const VariableSynchronizerEventArgs & > m_on_synchronized
Ref< IDataSynchronizeImplementationFactorym_implementation_factory
IVariableSynchronizerMngm_variable_synchronizer_mng = nullptr
SyncMessagem_default_message = nullptr
Runner m_runner
Ref< DataSynchronizeInfom_partial_sync_info
Ref< SyncMessagem_partial_message
UniqueArray< Int32m_partial_local_ids
bool m_is_check_coherence = false

Friends

class VariableSynchronizerComputeList

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Interface of a variable synchronization service.

An instance of this class is created via IParallelMng::createVariableSynchronizer(). An instance is associated with an item group. The compute() function must be called to calculate the synchronization information.

Definition at line 53 of file VariableSynchronizer.h.

Constructor & Destructor Documentation

◆ VariableSynchronizer()

Arcane::VariableSynchronizer::VariableSynchronizer ( IParallelMng * pm,
const ItemGroup & group,
Ref< IDataSynchronizeImplementationFactory > implementation_factory )

Definition at line 198 of file VariableSynchronizer.cc.

◆ ~VariableSynchronizer()

Arcane::VariableSynchronizer::~VariableSynchronizer ( )
override

Definition at line 236 of file VariableSynchronizer.cc.

Member Function Documentation

◆ _buildMessage() [1/2]

VariableSynchronizer::SyncMessage * Arcane::VariableSynchronizer::_buildMessage ( )
private

Definition at line 246 of file VariableSynchronizer.cc.

◆ _buildMessage() [2/2]

VariableSynchronizer::SyncMessage * Arcane::VariableSynchronizer::_buildMessage ( Ref< DataSynchronizeInfo > & sync_info)
private

Definition at line 263 of file VariableSynchronizer.cc.

◆ _canSynchronizeMulti()

bool Arcane::VariableSynchronizer::_canSynchronizeMulti ( const VariableCollection & vars)
private

Indicates if the variables in the list vars can be synchronized at once.

For this to be possible, these variables must not be partial and must rely on the same ItemGroup (i.e., belong to the same family)

Definition at line 546 of file VariableSynchronizer.cc.

References Arcane::IVariable::isPartial(), and Arcane::IVariable::itemGroup().

Referenced by synchronize(), and synchronize().

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

◆ _checkCreateTimer()

void Arcane::VariableSynchronizer::_checkCreateTimer ( )
private

Definition at line 651 of file VariableSynchronizer.cc.

◆ _doSynchronize()

void Arcane::VariableSynchronizer::_doSynchronize ( SyncMessage * message)
private

Definition at line 316 of file VariableSynchronizer.cc.

◆ _rebuildMessage()

void Arcane::VariableSynchronizer::_rebuildMessage ( Int32ConstArrayView local_ids)
private

Definition at line 354 of file VariableSynchronizer.cc.

◆ _sendBeginEvent()

void Arcane::VariableSynchronizer::_sendBeginEvent ( VariableSynchronizerEventArgs & args)
private

Definition at line 616 of file VariableSynchronizer.cc.

◆ _sendEndEvent()

void Arcane::VariableSynchronizer::_sendEndEvent ( VariableSynchronizerEventArgs & args)
private

Definition at line 627 of file VariableSynchronizer.cc.

◆ _sendEvent()

void Arcane::VariableSynchronizer::_sendEvent ( VariableSynchronizerEventArgs & args)
private

Definition at line 641 of file VariableSynchronizer.cc.

◆ _setCurrentDevice()

void Arcane::VariableSynchronizer::_setCurrentDevice ( )
private

Positions the device associated with our RunQueue as the current device.

If a RunQueue is used, it positions the device associated with that RunQueue. This ensures that memory allocations performed during synchronizations will be on the correct device.

Definition at line 668 of file VariableSynchronizer.cc.

Referenced by compute().

Here is the caller graph for this function:

◆ _synchronize() [1/2]

DataSynchronizeResult Arcane::VariableSynchronizer::_synchronize ( INumericDataInternal * data,
bool is_compare_sync )
private

Definition at line 504 of file VariableSynchronizer.cc.

◆ _synchronize() [2/2]

void Arcane::VariableSynchronizer::_synchronize ( IVariable * var,
SyncMessage * message )
private

Definition at line 424 of file VariableSynchronizer.cc.

◆ _synchronizeMulti()

void Arcane::VariableSynchronizer::_synchronizeMulti ( const VariableCollection & vars,
SyncMessage * message )
private

Definition at line 571 of file VariableSynchronizer.cc.

◆ changeLocalIds()

void Arcane::VariableSynchronizer::changeLocalIds ( Int32ConstArrayView old_to_new_ids)
overridevirtual

Called when the local IDs of the entities are modified.

Implements Arcane::IVariableSynchronizer.

Definition at line 526 of file VariableSynchronizer.cc.

References Arcane::TraceAccessor::info().

Here is the call graph for this function:

◆ communicatingRanks()

Int32ConstArrayView Arcane::VariableSynchronizer::communicatingRanks ( )
overridevirtual

Ranks of subdomains with which communication occurs.

Implements Arcane::IVariableSynchronizer.

Definition at line 589 of file VariableSynchronizer.cc.

Referenced by Arcane::VariableSynchronizerMpiCommunicator::compute().

Here is the caller graph for this function:

◆ compute()

void Arcane::VariableSynchronizer::compute ( )
overridevirtual

Creation of the list of synchronization elements.

Implements Arcane::IVariableSynchronizer.

Definition at line 301 of file VariableSynchronizer.cc.

References _setCurrentDevice(), Arcane::VariableSynchronizerComputeList::compute(), Arcane::platform::getCurrentDateTime(), and Arcane::TraceAccessor::info().

Referenced by Arcane::MpiVariableSynchronizer::compute().

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

◆ ghostItems()

Int32ConstArrayView Arcane::VariableSynchronizer::ghostItems ( Int32 index)
overridevirtual

List of local IDs of ghost entities with a subdomain.

The rank of the subdomain is that of communicatingRanks()[index].

Implements Arcane::IVariableSynchronizer.

Definition at line 607 of file VariableSynchronizer.cc.

◆ itemGroup()

const ItemGroup & Arcane::VariableSynchronizer::itemGroup ( )
inlineoverridevirtual

Entity group used for synchronization.

The current implementation only supports the group of all entities of a family.

Implements Arcane::IVariableSynchronizer.

Definition at line 73 of file VariableSynchronizer.h.

◆ onSynchronized()

EventObservable< const VariableSynchronizerEventArgs & > & Arcane::VariableSynchronizer::onSynchronized ( )
inlineoverridevirtual

Event sent at the beginning and end of synchronization.

This event is sent during calls to the methods synchronize(IVariable* var) and synchronize(VariableCollection vars). If you wish to be notified of synchronizations for all instances of IVariableSynchronizer, you must use IVariableMng::synchronizerMng().

Implements Arcane::IVariableSynchronizer.

Definition at line 95 of file VariableSynchronizer.h.

◆ parallelMng()

IParallelMng * Arcane::VariableSynchronizer::parallelMng ( )
inlineoverridevirtual

Associated parallel manager.

Implements Arcane::IVariableSynchronizer.

Definition at line 68 of file VariableSynchronizer.h.

◆ sharedItems()

Int32ConstArrayView Arcane::VariableSynchronizer::sharedItems ( Int32 index)
overridevirtual

List of local IDs of entities shared with a subdomain.

The rank of the subdomain is that of communicatingRanks()[index].

Implements Arcane::IVariableSynchronizer.

Definition at line 598 of file VariableSynchronizer.cc.

◆ synchronize() [1/4]

void Arcane::VariableSynchronizer::synchronize ( IVariable * var)
overridevirtual

Synchronizes the variable var in blocking mode.

Implements Arcane::IVariableSynchronizer.

Definition at line 443 of file VariableSynchronizer.cc.

◆ synchronize() [2/4]

void Arcane::VariableSynchronizer::synchronize ( IVariable * var,
Int32ConstArrayView local_ids )
overridevirtual

Synchronizes the variable var on the entities local_ids in blocking mode.

Only the entities listed in local_ids will be synchronized. Note: an entity present in this list on one subdomain must be present in this list for any other subdomain that owns this entity.

Reimplemented from Arcane::IVariableSynchronizer.

Definition at line 452 of file VariableSynchronizer.cc.

◆ synchronize() [3/4]

void Arcane::VariableSynchronizer::synchronize ( VariableCollection vars)
overridevirtual

Synchronizes the variables vars in blocking mode.

All variables must belong to the same family and this entity group.

Implements Arcane::IVariableSynchronizer.

Definition at line 462 of file VariableSynchronizer.cc.

References _canSynchronizeMulti().

Here is the call graph for this function:

◆ synchronize() [4/4]

void Arcane::VariableSynchronizer::synchronize ( VariableCollection vars,
Int32ConstArrayView local_ids )
overridevirtual

Synchronizes the variables vars in blocking mode.

All variables must belong to the same family and this entity group.

Only the entities listed in local_ids will be synchronized. Note: an entity present in this list on one subdomain must be present in this list for any other subdomain that owns this entity.

Reimplemented from Arcane::IVariableSynchronizer.

Definition at line 482 of file VariableSynchronizer.cc.

References _canSynchronizeMulti().

Here is the call graph for this function:

◆ synchronizeData()

void Arcane::VariableSynchronizer::synchronizeData ( IData * data)
overridevirtual

Synchronizes the data data.

The data data must be associated with a variable for which it is valid to call synchronize(). This method is internal to Arcane.

Implements Arcane::IVariableSynchronizer.

Definition at line 513 of file VariableSynchronizer.cc.

References Arcane::IData::_commonInternal(), ARCANE_CHECK_POINTER, ARCANE_FATAL, and Arcane::IDataInternal::numericData().

Here is the call graph for this function:

◆ synchronizeMng()

IVariableSynchronizerMng * Arcane::VariableSynchronizer::synchronizeMng ( ) const
inline

Definition at line 102 of file VariableSynchronizer.h.

◆ VariableSynchronizerComputeList

friend class VariableSynchronizerComputeList
friend

Definition at line 57 of file VariableSynchronizer.h.

Member Data Documentation

◆ m_allow_multi_sync

bool Arcane::VariableSynchronizer::m_allow_multi_sync = true
private

Definition at line 111 of file VariableSynchronizer.h.

◆ m_default_message

SyncMessage* Arcane::VariableSynchronizer::m_default_message = nullptr
private

Definition at line 116 of file VariableSynchronizer.h.

◆ m_implementation_factory

Ref<IDataSynchronizeImplementationFactory> Arcane::VariableSynchronizer::m_implementation_factory
private

Definition at line 114 of file VariableSynchronizer.h.

◆ m_is_check_coherence

bool Arcane::VariableSynchronizer::m_is_check_coherence = false
private

Definition at line 122 of file VariableSynchronizer.h.

◆ m_is_verbose

bool Arcane::VariableSynchronizer::m_is_verbose = false
private

Definition at line 110 of file VariableSynchronizer.h.

◆ m_item_group

ItemGroup Arcane::VariableSynchronizer::m_item_group
private

Definition at line 107 of file VariableSynchronizer.h.

◆ m_on_synchronized

EventObservable<const VariableSynchronizerEventArgs&> Arcane::VariableSynchronizer::m_on_synchronized
private

Definition at line 113 of file VariableSynchronizer.h.

◆ m_parallel_mng

IParallelMng* Arcane::VariableSynchronizer::m_parallel_mng = nullptr
private

Definition at line 106 of file VariableSynchronizer.h.

◆ m_partial_local_ids

UniqueArray<Int32> Arcane::VariableSynchronizer::m_partial_local_ids
private

Definition at line 121 of file VariableSynchronizer.h.

◆ m_partial_message

Ref<SyncMessage> Arcane::VariableSynchronizer::m_partial_message
private

Definition at line 120 of file VariableSynchronizer.h.

◆ m_partial_sync_info

Ref<DataSynchronizeInfo> Arcane::VariableSynchronizer::m_partial_sync_info
private

Definition at line 119 of file VariableSynchronizer.h.

◆ m_runner

Runner Arcane::VariableSynchronizer::m_runner
private

Definition at line 117 of file VariableSynchronizer.h.

◆ m_sync_info

Ref<DataSynchronizeInfo> Arcane::VariableSynchronizer::m_sync_info
private

Definition at line 108 of file VariableSynchronizer.h.

◆ m_sync_timer

Timer* Arcane::VariableSynchronizer::m_sync_timer = nullptr
private

Definition at line 109 of file VariableSynchronizer.h.

◆ m_trace_sync

bool Arcane::VariableSynchronizer::m_trace_sync = false
private

Definition at line 112 of file VariableSynchronizer.h.

◆ m_variable_synchronizer_mng

IVariableSynchronizerMng* Arcane::VariableSynchronizer::m_variable_synchronizer_mng = nullptr
private

Definition at line 115 of file VariableSynchronizer.h.


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