Skip to content

Commit e5f2826

Browse files
Merge pull request #1604 from arcaneframework/dev/gg-add-check-sync-coherence
Add support to check coherence of synchronization
2 parents 16f72a4 + a3c7348 commit e5f2826

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Diff for: arcane/src/arcane/impl/VariableSynchronizer.cc

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "arcane/utils/FatalErrorException.h"
1919
#include "arcane/utils/ITraceMng.h"
2020
#include "arcane/utils/IMemoryRessourceMng.h"
21+
#include "arcane/utils/ValueConvert.h"
2122
#include "arcane/utils/internal/MemoryBuffer.h"
2223

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

228+
// Indique si on vérifie la cohérence des variables synchronisées
229+
if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_CHECK_SYNCHRONIZE_COHERENCE",true))
230+
m_is_check_coherence = (v.value()!=0);
231+
227232
m_default_message = _buildMessage();
228233
m_partial_message = makeRef<SyncMessage>(_buildMessage(m_partial_sync_info));
229234
}
@@ -424,6 +429,8 @@ _synchronize(IVariable* var, SyncMessage* message)
424429
message->initialize(var);
425430

426431
IParallelMng* pm = m_parallel_mng;
432+
if (m_is_check_coherence)
433+
MessagePassing::namedBarrier(pm,var->name());
427434
debug(Trace::High) << " Proc " << pm->commRank() << " Sync variable " << var->fullName();
428435
if (m_trace_sync) {
429436
info() << " Synchronize variable " << var->fullName()

Diff for: arcane/src/arcane/impl/internal/VariableSynchronizer.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ class ARCANE_IMPL_EXPORT VariableSynchronizer
7676
void synchronize(IVariable* var) override;
7777

7878
void synchronize(IVariable* var, Int32ConstArrayView local_ids) override;
79-
79+
8080
void synchronize(VariableCollection vars) override;
8181

8282
void synchronize(VariableCollection vars, Int32ConstArrayView local_ids) override;
83-
83+
8484
Int32ConstArrayView communicatingRanks() override;
8585

8686
Int32ConstArrayView sharedItems(Int32 index) override;
@@ -116,7 +116,8 @@ class ARCANE_IMPL_EXPORT VariableSynchronizer
116116
Ref<DataSynchronizeInfo> m_partial_sync_info;
117117
Ref<SyncMessage> m_partial_message;
118118
UniqueArray<Int32> m_partial_local_ids;
119-
119+
bool m_is_check_coherence = false;
120+
120121
private:
121122

122123
void _synchronize(IVariable* var, SyncMessage* message);

Diff for: arcane/src/arcane/tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ arcane_add_test_parallel(parallel2_synchronize_compare testParallel-synchronize1
418418
arcane_add_test_parallel(parallel2_synchronize_legacymulti testParallel-synchronize1.arc 4 -We,ARCANE_USE_LEGACY_MULTISYNCHRONIZE,1)
419419
arcane_add_test_parallel(parallel2_synchronize_v1 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,1)
420420
arcane_add_test_parallel(parallel2_synchronize_v2 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,2)
421-
arcane_add_test_parallel(parallel2_synchronize_v3 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,3)
421+
arcane_add_test_parallel(parallel2_synchronize_v3 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,3 -We,ARCANE_CHECK_SYNCHRONIZE_COHERENCE,1)
422422
arcane_add_test_parallel(parallel2_synchronize_v4 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,4 -We,ARCANE_SYNCHRONIZE_NB_SEQUENCE,3)
423423
arcane_add_test_parallel(parallel2_synchronize_v4_b1024 testParallel-synchronize1.arc 4 -We,ARCANE_SYNCHRONIZE_VERSION,4 -We,ARCANE_SYNCHRONIZE_BLOCK_SIZE,1024)
424424
arcane_add_test_parallel(parallel2_synchronize testParallel-synchronize2.arc 8)

0 commit comments

Comments
 (0)