Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariableSynchronizerMng.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* VariableSynchronizerMng.h (C) 2000-2025 */
9/* */
10/* Variable synchronizer manager. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13#ifndef ARCANE_IMPL_INTERNAL_VARIABLESYNCHRONIZERMNG_H
14#define ARCANE_IMPL_INTERNAL_VARIABLESYNCHRONIZERMNG_H
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
18#include "arcane/utils/TraceAccessor.h"
19#include "arcane/utils/Event.h"
20
21#include "arcane/core/IVariableSynchronizerMng.h"
22#include "arcane/core/internal/IVariableSynchronizerMngInternal.h"
23
24#include <memory>
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane
30{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
39class ARCANE_IMPL_EXPORT VariableSynchronizerMng
40: public TraceAccessor
42{
43 public:
44
45 explicit VariableSynchronizerMng(IVariableMng* vm);
46 ~VariableSynchronizerMng();
47
48 public:
49
50 class InternalApi
51 : public TraceAccessor
53 {
54 class BufferList;
55
56 public:
57
58 explicit InternalApi(VariableSynchronizerMng* vms);
59 ~InternalApi();
60
61 public:
62
63 Ref<MemoryBuffer> createSynchronizeBuffer(IMemoryAllocator* allocator) override;
64 void releaseSynchronizeBuffer(IMemoryAllocator* allocator, MemoryBuffer* v) override;
65
66 public:
67
68 void dumpStats(std::ostream& ostr) const;
69
70 private:
71
72 VariableSynchronizerMng* m_synchronizer_mng = nullptr;
73 std::unique_ptr<BufferList> m_buffer_list;
74 };
75
76 public:
77
78 void initialize();
79
80 public:
81
82 IParallelMng* parallelMng() const override { return m_parallel_mng; }
83
85 {
86 return m_on_synchronized;
87 }
88
89 void setSynchronizationCompareLevel(Int32 v) final { m_synchronize_compare_level = v; }
90 Int32 synchronizationCompareLevel() const final { return m_synchronize_compare_level; }
91 bool isSynchronizationComparisonEnabled() const final { return m_synchronize_compare_level > 0; }
92
93 void dumpStats(std::ostream& ostr) const override;
94 void flushPendingStats() override;
95 IVariableSynchronizerMngInternal* _internalApi() override { return &m_internal_api; }
96 bool isDoingStats() const { return m_is_doing_stats || m_synchronize_compare_level > 0; }
97
98 private:
99
100 IVariableMng* m_variable_mng = nullptr;
101 IParallelMng* m_parallel_mng = nullptr;
102 InternalApi m_internal_api{ this };
103 EventObservable<const VariableSynchronizerEventArgs&> m_on_synchronized;
104 VariableSynchronizerStats* m_stats = nullptr;
105 Int32 m_synchronize_compare_level = 0;
106 bool m_is_doing_stats = false;
107};
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
111
112} // End namespace Arcane
113
114/*---------------------------------------------------------------------------*/
115/*---------------------------------------------------------------------------*/
116
117#endif
File containing event management mechanisms.
Interface of the parallelism manager for a subdomain.
Variable manager interface.
Internal Arcane API for IVariableSynchronizerMng.
Interface of the variable synchronization manager.
Management of a memory buffer.
Reference to an instance.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
Manages a pool of buffers associated with an allocator.
void setSynchronizationCompareLevel(Int32 v) final
Sets the comparison level between values before and after synchronization.
bool isSynchronizationComparisonEnabled() const final
Indicates whether comparisons of values before and after synchronization are performed.
EventObservable< const VariableSynchronizerEventArgs & > & onSynchronized() override
Event sent at the beginning and end of synchronization.
Int32 synchronizationCompareLevel() const final
Comparison level of values before and after synchronization.
IParallelMng * parallelMng() const override
Associated parallelism manager.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.