Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SharedMemoryMachineShMemWinBaseInternal.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/* SharedMemoryMachineShMemWinBaseInternal.h (C) 2000-2026 */
9/* */
10/* Class allowing the creation of memory windows for all subdomains in */
11/* shared memory. */
12/* The segments of these windows are not contiguous in memory and can */
13/* be resized. */
14/*---------------------------------------------------------------------------*/
15
16#ifndef ARCANE_PARALLEL_THREAD_INTERNAL_SHAREDMEMORYMACHINESHMEMWINBASEINTERNAL_H
17#define ARCANE_PARALLEL_THREAD_INTERNAL_SHAREDMEMORYMACHINESHMEMWINBASEINTERNAL_H
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22#include "arccore/message_passing/internal/IMachineShMemWinBaseInternal.h"
23
25#include "arcane/utils/Ref.h"
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
31{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36class ARCANE_THREAD_EXPORT SharedMemoryMachineShMemWinBaseInternal
38{
39 public:
40
41 SharedMemoryMachineShMemWinBaseInternal(Int32 my_rank, ConstArrayView<Int32> ranks, Int32 sizeof_type, Ref<UniqueArray<UniqueArray<std::byte>>> windows, Ref<UniqueArray<Int32>> target_segments, IThreadBarrier* barrier);
42
43 ~SharedMemoryMachineShMemWinBaseInternal() override = default;
44
45 public:
46
47 Int32 sizeofOneElem() const override;
48 ConstArrayView<Int32> machineRanks() const override;
49 void barrier() const override;
50
52 Span<std::byte> segmentView(Int32 rank) override;
53
55 Span<const std::byte> segmentConstView(Int32 rank) const override;
56
57 void add(Span<const std::byte> elem) override;
58 void add() override;
59
60 void addToAnotherSegment(Int32 rank, Span<const std::byte> elem) override;
61 void addToAnotherSegment() override;
62
63 void reserve(Int64 new_capacity) override;
64 void reserve() override;
65
66 void resize(Int64 new_size) override;
67 void resize() override;
68
69 void shrink() override;
70
71 private:
72
73 Int32 m_my_rank = 0;
74 Int32 m_sizeof_type = 0;
76
79
80 Ref<UniqueArray<Int32>> m_target_segments;
81 SmallSpan<Int32> m_target_segments_span;
82
83 IThreadBarrier* m_barrier = nullptr;
84};
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89} // namespace Arcane::MessagePassing
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94#endif
Declarations of Arcane's general types.
Constant view of an array of type T.
Class allowing the creation of memory windows for a computing node.
void add(Span< const std::byte > elem) override
Method to add elements into our segment.
Span< std::byte > segmentView() override
Method to get a view of our segment.
ConstArrayView< Int32 > machineRanks() const override
Method to get the ranks that possess a segment in the window.
Int32 sizeofOneElem() const override
Method to get the size of an element in the window.
void barrier() const override
Method to wait until all processes/threads of the node call this method to continue execution.
void shrink() override
Method to reduce the reserved memory space for the segments to the minimum necessary.
Span< const std::byte > segmentConstView() const override
Method to get a view of our segment.
void reserve(Int64 new_capacity) override
Method to reserve memory space in our segment.
void addToAnotherSegment(Int32 rank, Span< const std::byte > elem) override
Method to add elements into the segment of another subdomain.
Reference to an instance.
View of an array of elements of type T.
Definition Span.h:805
View of an array of elements of type T.
Definition Span.h:635
1D data vector with value semantics (STL style).
Declarations of types and methods used by message exchange mechanisms.
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.