Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
HybridMachineShMemWinBaseInternal.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/* HybridMachineShMemWinBaseInternal.h (C) 2000-2026 */
9/* */
10/* Class enabling the creation of memory windows for all subdomains in the */
11/* shared memory of processes on the same node. */
12/* The segments of these windows are not contiguous in memory and can */
13/* be resized. */
14/*---------------------------------------------------------------------------*/
15
16#ifndef ARCANE_PARALLEL_MPITHREAD_INTERNAL_HYBRIDMACHINESHMEMWINBASEINTERNAL_H
17#define ARCANE_PARALLEL_MPITHREAD_INTERNAL_HYBRIDMACHINESHMEMWINBASEINTERNAL_H
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22#include "arcane/utils/Ref.h"
23
24#include "arccore/message_passing/internal/IMachineShMemWinBaseInternal.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
30{
31namespace Mpi
32{
34}
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39class HybridMachineShMemWinBaseInternal
41{
42 public:
43
44 HybridMachineShMemWinBaseInternal(Int32 my_rank_mpi, Int32 my_rank_local_proc, Int32 nb_rank_local_proc, ConstArrayView<Int32> ranks, Int32 sizeof_type, Ref<Mpi::MpiMultiMachineShMemWinBaseInternal> mpi_windows, IThreadBarrier* barrier);
45
46 ~HybridMachineShMemWinBaseInternal() override = default;
47
48 public:
49
50 Int32 sizeofOneElem() const override;
51 ConstArrayView<Int32> machineRanks() const override;
52 void barrier() const override;
53
55 Span<std::byte> segmentView(Int32 rank) override;
56
58 Span<const std::byte> segmentConstView(Int32 rank) const override;
59
60 void add(Span<const std::byte> elem) override;
61 void add() override;
62
63 void addToAnotherSegment(Int32 rank, Span<const std::byte> elem) override;
64 void addToAnotherSegment() override;
65
66 void reserve(Int64 new_capacity) override;
67 void reserve() override;
68
69 void resize(Int64 new_size) override;
70 void resize() override;
71
72 void shrink() override;
73
74 private:
75
76 Int32 m_my_rank_local_proc = 0;
77 Int32 m_nb_rank_local_proc = 0;
78 Int32 m_my_rank_mpi = 0;
79
80 ConstArrayView<Int32> m_machine_ranks;
81
82 Int32 m_sizeof_type = 0;
84
85 IThreadBarrier* m_thread_barrier = nullptr;
86};
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
90
91} // namespace Arcane::MessagePassing
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96#endif
Constant view of an array of type T.
void shrink() override
Method to reduce the reserved memory space for the segments to the minimum necessary.
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.
void barrier() const override
Method to wait until all processes/threads of the node call this method to continue execution.
Int32 sizeofOneElem() const override
Method to get the size of an element in the window.
Span< const std::byte > segmentConstView() const override
Method to get a view of our segment.
Class allowing the creation of memory windows for a computing node.
Class based on MpiMachineShMemWinBaseInternal but capable of managing multiple segments per process.
Reference to an instance.
View of an array of elements of type T.
Definition Span.h:635
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.