Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ContigMachineShMemWin.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/* ContigMachineShMemWin.h (C) 2000-2026 */
9/* */
10/* Class allowing the creation of a shared memory window between the */
11/* processes of the same node. */
12/*---------------------------------------------------------------------------*/
13#ifndef ARCANE_CORE_CONTIGMACHINESHMEMWIN_H
14#define ARCANE_CORE_CONTIGMACHINESHMEMWIN_H
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
19#include "arcane/core/ContigMachineShMemWinBase.h"
20
21#include "arccore/base/Span.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32/*!
33 * \brief Class allowing the creation of a shared memory window between the
34 * subdomains of the same node.
35 * The segments of this window will be contiguous in memory.
36 *
37 * \tparam Type The type of the window elements.
38 */
39template <class Type>
41{
42 public:
43
44 /*!
45 * \brief Constructor.
46 * \param pm The ParallelMng containing the node processes.
47 * \param nb_elem_segment The number of elements for the segment of this subdomain.
48 */
50 : m_impl(pm, nb_elem_segment, static_cast<Int32>(sizeof(Type)))
51 {}
52
53 public:
54
55 /*!
56 * \brief Method allowing retrieval of a view on our window segment
57 * memory.
58 *
59 * \return A view.
60 */
62 {
63 return asSpan<Type>(m_impl.segmentView());
64 }
65
66 /*!
67 * \brief Method allowing retrieval of a view on the window segment
68 * memory of another subdomain of the node.
69 *
70 * \param rank The rank of the subdomain.
71 * \return A view.
72 */
74 {
75 return asSpan<Type>(m_impl.segmentView(rank));
76 }
77
78 /*!
79 * \brief Method allowing retrieval of a view on the entire memory window.
80 *
81 * \return A view.
82 */
84 {
85 return asSpan<Type>(m_impl.windowView());
86 }
87
88 /*!
89 * \brief Method allowing retrieval of a constant view on our segment
90 * memory window.
91 *
92 * \return A constant view.
93 */
95 {
96 return asSpan<const Type>(m_impl.segmentConstView());
97 }
98
99 /*!
100 * \brief Method allowing retrieval of a constant view on the segment of
101 * memory window of another subdomain of the node.
102 *
103 * \param rank The rank of the subdomain.
104 * \return A constant view.
105 */
107 {
108 return asSpan<const Type>(m_impl.segmentConstView(rank));
109 }
110
111 /*!
112 * \brief Method allowing retrieval of a constant view on the entire window
113 * memory.
114 *
115 * \return A constant view.
116 */
118 {
119 return asSpan<const Type>(m_impl.windowConstView());
120 }
121
122 /*!
123 * \brief Method allowing resizing of the window segments.
124 * Collective call.
125 *
126 * The total size of the window must be less than or equal to the original size.
127 *
128 * \param new_nb_elem The new size of our segment.
129 */
130 void resizeSegment(Integer new_nb_elem)
131 {
132 m_impl.resizeSegment(new_nb_elem);
133 }
134
135 /*!
136 * \brief Method allowing retrieval of the ranks that possess a segment
137 * in the window.
138 *
139 * The order of the processes in the returned view corresponds to the order of
140 * segments in the window.
141 *
142 * \return A view containing the rank IDs.
143 */
145 {
146 return m_impl.machineRanks();
147 }
148
149 /*!
150 * \brief Method allowing waiting until all processes/threads
151 * of the node call this method to continue execution.
152 */
153 void barrier() const
154 {
155 m_impl.barrier();
156 }
157
158 private:
159
161};
162
163/*---------------------------------------------------------------------------*/
164/*---------------------------------------------------------------------------*/
165
166} // End namespace Arcane
167
168/*---------------------------------------------------------------------------*/
169/*---------------------------------------------------------------------------*/
170
171#endif
Declarations of Arcane's general types.
Types and functions associated with the classes SpanImpl, SmallSpan and Span.
Constant view of an array of type T.
Class allowing the creation of a shared memory window between the subdomains of the same node....
Span< Type > segmentView(Int32 rank)
Method allowing retrieval of a view on the window segment memory of another subdomain of the node.
ConstArrayView< Int32 > machineRanks() const
Method allowing retrieval of the ranks that possess a segment in the window.
void barrier() const
Method allowing waiting until all processes/threads of the node call this method to continue executio...
Span< Type > windowView()
Method allowing retrieval of a view on the entire memory window.
void resizeSegment(Integer new_nb_elem)
Method allowing resizing of the window segments. Collective call.
Span< const Type > segmentConstView() const
Method allowing retrieval of a constant view on our segment memory window.
ContigMachineShMemWin(IParallelMng *pm, Int64 nb_elem_segment)
Constructor.
Span< const Type > segmentConstView(Int32 rank) const
Method allowing retrieval of a constant view on the segment of memory window of another subdomain of ...
Span< Type > segmentView()
Method allowing retrieval of a view on our window segment memory.
Span< const Type > windowConstView() const
Method allowing retrieval of a constant view on the entire window memory.
Interface of the parallelism manager for a subdomain.
View of an array of elements of type T.
Definition Span.h:635
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
Span< DataType > asSpan(Span< std::byte, Extent > bytes)
Converts a Span<std::byte> into a Span<DataType>.
Definition Span.h:1126
std::int32_t Int32
Signed integer type of 32 bits.