16#include "arcane/parallel/thread/internal/SharedMemoryMachineShMemWinBaseInternal.h"
18#include "arcane/utils/FatalErrorException.h"
20#include "arccore/concurrency/IThreadBarrier.h"
31SharedMemoryMachineShMemWinBaseInternal::
32SharedMemoryMachineShMemWinBaseInternal(
Int32 my_rank, ConstArrayView<Int32> ranks,
Int32 sizeof_type, Ref<UniqueArray<UniqueArray<std::byte>>> windows, Ref<UniqueArray<Int32>> target_segments, IThreadBarrier* barrier)
34, m_sizeof_type(sizeof_type)
37, m_windows_span(windows->smallSpan())
38, m_target_segments(target_segments)
39, m_target_segments_span(target_segments->smallSpan())
46Int32 SharedMemoryMachineShMemWinBaseInternal::
64void SharedMemoryMachineShMemWinBaseInternal::
76 return m_windows_span[m_my_rank];
83segmentView(
Int32 rank)
85 return m_windows_span[rank];
92segmentConstView()
const
94 return m_windows_span[m_my_rank];
101segmentConstView(
Int32 rank)
const
103 return m_windows_span[rank];
109void SharedMemoryMachineShMemWinBaseInternal::
113 if (elem.
size() % m_sizeof_type != 0) {
116 m_windows_span[m_my_rank].addRange(elem);
123void SharedMemoryMachineShMemWinBaseInternal::
133void SharedMemoryMachineShMemWinBaseInternal::
136 if (elem.
size() % m_sizeof_type != 0) {
140 m_target_segments_span[m_my_rank] = rank;
143 bool is_found =
false;
144 for (
const Int32 rank_asked : m_target_segments_span) {
145 if (rank_asked == rank) {
150 ARCANE_FATAL(
"Two subdomains ask same rank for addToAnotherSegment()");
155 m_windows_span[rank].addRange(elem);
157 m_target_segments_span[m_my_rank] = -1;
163void SharedMemoryMachineShMemWinBaseInternal::
173void SharedMemoryMachineShMemWinBaseInternal::
174reserve(
Int64 new_capacity)
177 m_windows_span[m_my_rank].reserve(new_capacity);
184void SharedMemoryMachineShMemWinBaseInternal::
194void SharedMemoryMachineShMemWinBaseInternal::
195resize(
Int64 new_size)
198 m_windows_span[m_my_rank].resize(new_size);
205void SharedMemoryMachineShMemWinBaseInternal::
215void SharedMemoryMachineShMemWinBaseInternal::
219 m_windows_span[m_my_rank].shrink();
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
Constant view of an array of type T.
constexpr __host__ __device__ SizeType size() const noexcept
Returns the size of the array.
View of an array of elements of type T.
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.