Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MachineShMemWinBase.cc
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/* MachineShMemWinBase.cc (C) 2000-2026 */
9/* */
10/* Class allowing the creation of memory windows for a computing node. */
11/* The segments of these windows are not contiguous in memory and can */
12/* be resized. */
13/*---------------------------------------------------------------------------*/
14
15#include "arcane/core/MachineShMemWinBase.h"
16
17#include "arcane/utils/NumericTypes.h"
18
19#include "arcane/core/IParallelMng.h"
20#include "arcane/core/internal/IParallelMngInternal.h"
21
22#include "arccore/message_passing/internal/IMachineShMemWinBaseInternal.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
34MachineShMemWinBase(IParallelMng* pm, Int64 nb_elem_segment, Int32 sizeof_elem)
35: m_pm_internal(pm->_internalApi())
36, m_node_window_base(m_pm_internal->createMachineShMemWinBase(nb_elem_segment * static_cast<Int64>(sizeof_elem), sizeof_elem))
37, m_sizeof_elem(sizeof_elem)
38{}
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
44machineRanks() const
45{
46 return m_node_window_base->machineRanks();
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
53barrier() const
54{
55 m_node_window_base->barrier();
56}
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60
63{
64 return m_node_window_base->segmentView();
65}
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
72{
73 return m_node_window_base->segmentView(rank);
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
80segmentConstView() const
81{
82 return m_node_window_base->segmentConstView();
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
89segmentConstView(Int32 rank) const
90{
91 return m_node_window_base->segmentConstView(rank);
92}
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
99{
100 return m_node_window_base->add(elem);
101}
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
107add()
108{
109 return m_node_window_base->add();
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
117{
118 m_node_window_base->addToAnotherSegment(rank, elem);
119}
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
123
126{
127 m_node_window_base->addToAnotherSegment();
128}
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
134reserve(Int64 new_nb_elem_segment_capacity)
135{
136 m_node_window_base->reserve(new_nb_elem_segment_capacity * static_cast<Int64>(m_sizeof_elem));
137}
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
143reserve()
144{
145 m_node_window_base->reserve();
146}
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
152resize(Int64 new_nb_elem_segment)
153{
154 m_node_window_base->resize(new_nb_elem_segment * static_cast<Int64>(m_sizeof_elem));
155}
156
157/*---------------------------------------------------------------------------*/
158/*---------------------------------------------------------------------------*/
159
161resize()
162{
163 m_node_window_base->resize();
164}
165
166/*---------------------------------------------------------------------------*/
167/*---------------------------------------------------------------------------*/
168
170shrink()
171{
172 m_node_window_base->shrink();
173}
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
178} // End namespace Arcane
179
180/*---------------------------------------------------------------------------*/
181/*---------------------------------------------------------------------------*/
Constant view of an array of type T.
Interface of the parallelism manager for a subdomain.
void barrier() const
Method to wait until all processes/threads on the node call this method to continue execution.
MachineShMemWinBase(IParallelMng *pm, Int64 sizeof_segment, Int32 sizeof_elem)
Constructor.
Span< const std::byte > segmentConstView() const
Method to obtain a view of our segment.
void reserve()
Method to be called by the subdomain(s) that do not wish to reserve more memory for their segments.
void shrink()
Method to reduce the reserved memory space for the segments to the minimum necessary.
void add()
Method to be called by the subdomain(s) that do not wish to add elements to its segment.
void resize()
Method to be called by the subdomain(s) that do not wish to resize their segments.
ConstArrayView< Int32 > machineRanks() const
Method to obtain the ranks that possess a segment in the window.
void addToAnotherSegment()
Method to be called by the subdomain(s) that do not wish to add elements into the segment of another ...
Span< std::byte > segmentView()
Method to obtain a view of our segment.
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.
std::int32_t Int32
Signed integer type of 32 bits.