Skip to content

Commit

Permalink
Merge pull request arcaneframework#1604 from arcaneframework/dev/gg-a…
Browse files Browse the repository at this point in the history
…dd-check-sync-coherence

Add support to check coherence of synchronization
  • Loading branch information
grospelliergilles authored Sep 2, 2024
2 parents 16f72a4 + a3c7348 commit e5f2826
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions arcane/src/arcane/impl/VariableSynchronizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "arcane/utils/FatalErrorException.h"
#include "arcane/utils/ITraceMng.h"
#include "arcane/utils/IMemoryRessourceMng.h"
#include "arcane/utils/ValueConvert.h"
#include "arcane/utils/internal/MemoryBuffer.h"

#include "arcane/core/VariableSynchronizerEventArgs.h"
Expand Down Expand Up @@ -224,6 +225,10 @@ VariableSynchronizer(IParallelMng* pm, const ItemGroup& group,
m_trace_sync = true;
}

// Indique si on vérifie la cohérence des variables synchronisées
if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_CHECK_SYNCHRONIZE_COHERENCE",true))
m_is_check_coherence = (v.value()!=0);

m_default_message = _buildMessage();
m_partial_message = makeRef<SyncMessage>(_buildMessage(m_partial_sync_info));
}
Expand Down Expand Up @@ -424,6 +429,8 @@ _synchronize(IVariable* var, SyncMessage* message)
message->initialize(var);

IParallelMng* pm = m_parallel_mng;
if (m_is_check_coherence)
MessagePassing::namedBarrier(pm,var->name());
debug(Trace::High) << " Proc " << pm->commRank() << " Sync variable " << var->fullName();
if (m_trace_sync) {
info() << " Synchronize variable " << var->fullName()
Expand Down
7 changes: 4 additions & 3 deletions arcane/src/arcane/impl/internal/VariableSynchronizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ class ARCANE_IMPL_EXPORT VariableSynchronizer
void synchronize(IVariable* var) override;

void synchronize(IVariable* var, Int32ConstArrayView local_ids) override;

void synchronize(VariableCollection vars) override;

void synchronize(VariableCollection vars, Int32ConstArrayView local_ids) override;

Int32ConstArrayView communicatingRanks() override;

Int32ConstArrayView sharedItems(Int32 index) override;
Expand Down Expand Up @@ -116,7 +116,8 @@ class ARCANE_IMPL_EXPORT VariableSynchronizer
Ref<DataSynchronizeInfo> m_partial_sync_info;
Ref<SyncMessage> m_partial_message;
UniqueArray<Int32> m_partial_local_ids;

bool m_is_check_coherence = false;

private:

void _synchronize(IVariable* var, SyncMessage* message);
Expand Down
2 changes: 1 addition & 1 deletion arcane/src/arcane/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ arcane_add_test_parallel(parallel2_synchronize_compare testParallel-synchronize1
arcane_add_test_parallel(parallel2_synchronize_legacymulti testParallel-synchronize1.arc 4 -We,ARCANE_USE_LEGACY_MULTISYNCHRONIZE,1)
arcane_add_test_parallel(parallel2_synchronize_v1 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,1)
arcane_add_test_parallel(parallel2_synchronize_v2 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,2)
arcane_add_test_parallel(parallel2_synchronize_v3 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,3)
arcane_add_test_parallel(parallel2_synchronize_v3 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,3 -We,ARCANE_CHECK_SYNCHRONIZE_COHERENCE,1)
arcane_add_test_parallel(parallel2_synchronize_v4 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,4 -We,ARCANE_SYNCHRONIZE_NB_SEQUENCE,3)
arcane_add_test_parallel(parallel2_synchronize_v4_b1024 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,4 -We,ARCANE_SYNCHRONIZE_BLOCK_SIZE,1024)
arcane_add_test_parallel(parallel2_synchronize testParallel-synchronize2.arc 8)
Expand Down

0 comments on commit e5f2826

Please sign in to comment.