14#include "arcane/parallel/thread/internal/SharedMemoryMachineMemoryWindowBaseInternal.h"
16#include "arcane/utils/FatalErrorException.h"
18#include "arccore/concurrency/IThreadBarrier.h"
29SharedMemoryMachineMemoryWindowBaseInternal::
30SharedMemoryMachineMemoryWindowBaseInternal(
Int32 my_rank,
Int32 nb_rank, ConstArrayView<Int32> ranks,
Int32 sizeof_type, Ref<UniqueArray<std::byte>> window, Ref<UniqueArray<Int64>> sizeof_segments, Ref<UniqueArray<Int64>> sum_sizeof_segments,
Int64 sizeof_window, IThreadBarrier* barrier)
33, m_sizeof_type(sizeof_type)
34, m_actual_sizeof_win(sizeof_window)
35, m_max_sizeof_win(sizeof_window)
37, m_window_span(window->span())
39, m_sizeof_segments(sizeof_segments)
40, m_sizeof_segments_span(sizeof_segments->smallSpan())
41, m_sum_sizeof_segments(sum_sizeof_segments)
42, m_sum_sizeof_segments_span(sum_sizeof_segments->smallSpan())
49Int32 SharedMemoryMachineMemoryWindowBaseInternal::
61 const Int64 begin_segment = m_sum_sizeof_segments_span[m_my_rank];
62 const Int64 size_segment = m_sizeof_segments_span[m_my_rank];
64 return m_window_span.subSpan(begin_segment, size_segment);
71segmentView(
Int32 rank)
73 const Int64 begin_segment = m_sum_sizeof_segments_span[rank];
74 const Int64 size_segment = m_sizeof_segments_span[rank];
76 return m_window_span.subSpan(begin_segment, size_segment);
92segmentConstView()
const
94 const Int64 begin_segment = m_sum_sizeof_segments_span[m_my_rank];
95 const Int64 size_segment = m_sizeof_segments_span[m_my_rank];
97 return m_window_span.subSpan(begin_segment, size_segment);
104segmentConstView(
Int32 rank)
const
106 const Int64 begin_segment = m_sum_sizeof_segments_span[rank];
107 const Int64 size_segment = m_sizeof_segments_span[rank];
109 return m_window_span.subSpan(begin_segment, size_segment);
116windowConstView()
const
118 return m_window_span;
124void SharedMemoryMachineMemoryWindowBaseInternal::
125resizeSegment(
Int64 new_sizeof_segment)
127 m_sizeof_segments_span[m_my_rank] = new_sizeof_segment;
131 if (m_my_rank == 0) {
133 for (
Int32 i = 0; i < m_nb_rank; ++i) {
134 m_sum_sizeof_segments_span[i] = sum;
135 sum += m_sizeof_segments_span[i];
137 if (sum > m_max_sizeof_win) {
138 ARCANE_FATAL(
"New size of window (sum of size of all segments) is superior than the old size");
140 m_actual_sizeof_win = sum;
144 for (
Int32 i = 0; i < m_nb_rank; ++i) {
145 sum += m_sizeof_segments_span[i];
147 if (sum > m_max_sizeof_win) {
148 ARCANE_FATAL(
"New size of window (sum of size of all segments) is superior than the old size");
150 m_actual_sizeof_win = sum;
153 m_window_span =
Span<std::byte>{ m_window_span.data(), m_actual_sizeof_win };
170void SharedMemoryMachineMemoryWindowBaseInternal::
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Vue constante d'un tableau de type T.
Vue d'un tableau d'éléments de type T.
Déclarations des types et méthodes utilisés par les mécanismes d'échange de messages.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.