Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MpiMachineShMemWinBaseInternal.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/* MpiMachineShMemWinBaseInternal.h (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#ifndef ARCCORE_MESSAGEPASSINGMPI_INTERNAL_MPIMACHINESHMEMWINBASEINTERNAL_H
15#define ARCCORE_MESSAGEPASSINGMPI_INTERNAL_MPIMACHINESHMEMWINBASEINTERNAL_H
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19#include "arccore/collections/Array.h"
20#include "arccore/message_passing/internal/IMachineShMemWinBaseInternal.h"
21
22#include "arccore/message_passing_mpi/MessagePassingMpiGlobal.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::MessagePassing::Mpi
28{
29
30class ARCCORE_MESSAGEPASSINGMPI_EXPORT MpiMachineShMemWinBaseInternal
32{
33 public:
34
35 explicit MpiMachineShMemWinBaseInternal(Int64 sizeof_segment, Int32 sizeof_type, const MPI_Comm& comm_machine, Int32 comm_machine_rank, Int32 comm_machine_size, ConstArrayView<Int32> machine_ranks);
36
37 ~MpiMachineShMemWinBaseInternal() override;
38
39 public:
40
41 Int32 sizeofOneElem() const override;
42 ConstArrayView<Int32> machineRanks() const override;
43 void barrier() const override;
44
46 Span<std::byte> segmentView(Int32 rank) override;
47
49 Span<const std::byte> segmentConstView(Int32 rank) const override;
50
51 void add(Span<const std::byte> elem) override;
52 void add() override;
53
54 void addToAnotherSegment(Int32 rank, Span<const std::byte> elem) override;
55 void addToAnotherSegment() override;
56
57 void reserve(Int64 new_capacity) override;
58 void reserve() override;
59
60 void resize(Int64 new_size) override;
61 void resize() override;
62
63 void shrink() override;
64
65 private:
66
67 void _reallocBarrier(Int64 new_sizeof);
68 void _reallocBarrier(Int32 machine_rank, Int64 new_sizeof);
69 void _reallocBarrier();
70 void _reallocCollective();
71
72 Int32 _worldToMachine(Int32 world) const;
73 Int32 _machineToWorld(Int32 machine) const;
74
75 private:
76
84
91
96
109
110 MPI_Comm m_comm_machine;
111 Int32 m_comm_machine_size = 0;
112 Int32 m_comm_machine_rank = 0;
113
114 Int32 m_sizeof_type = 0;
115
116 ConstArrayView<Int32> m_machine_ranks;
117};
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122} // namespace Arcane::MessagePassing::Mpi
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127#endif
Constant view of an array of type T.
Class allowing the creation of memory windows for a computing node.
void reserve(Int64 new_capacity) override
Method to reserve memory space in our segment.
ConstArrayView< Int32 > machineRanks() const override
Method to get the ranks that possess a segment in the window.
Span< Int64 > m_sizeof_used_part
Global view on contiguous window with the size of the primary windows.
Int32 sizeofOneElem() const override
Method to get the size of an element in the window.
MPI_Win m_win_actual_sizeof
Contiguous window with the size of the primary windows.
void shrink() override
Method to reduce the reserved memory space for the segments to the minimum necessary.
void addToAnotherSegment(Int32 rank, Span< const std::byte > elem) override
Method to add elements into the segment of another subdomain.
void resize(Int64 new_size) override
Method to resize our segment.
void barrier() const override
Method to wait until all processes/threads of the node call this method to continue execution.
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.
Span< const std::byte > segmentConstView() const override
Method to get a view of our segment.
View of an array of elements of type T.
Definition Span.h:635
1D data vector with value semantics (STL style).
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.