15#include "arcane/core/internal/MachineShMemWinVariableBase.h"
17#include "arcane/utils/FatalErrorException.h"
18#include "arcane/utils/ITraceMng.h"
19#include "arcane/utils/ArrayShape.h"
21#include "arcane/core/ContigMachineShMemWin.h"
22#include "arcane/core/IMesh.h"
23#include "arcane/core/ISubDomain.h"
24#include "arcane/core/MeshHandle.h"
25#include "arcane/core/IData.h"
26#include "arcane/core/IParallelMng.h"
27#include "arcane/core/IVariable.h"
29#include "arcane/core/internal/MachineShMemWinMemoryAllocator.h"
30#include "arcane/core/internal/IDataInternal.h"
31#include "arcane/core/internal/IParallelMngInternal.h"
33#include "arccore/common/AllocatedMemoryInfo.h"
34#include "arccore/base/MemoryView.h"
50 ARCANE_FATAL(
"The variable has not PInShMem property");
52 if (m_var->meshHandle().hasMesh()) {
53 m_pm = m_var->meshHandle().mesh()->parallelMng();
56 m_pm = m_var->subDomain()->parallelMng();
58 m_machine_ranks = m_pm->_internalApi()->machineRanks();
59 m_sizeof_var.reserve(m_machine_ranks.size());
68 return m_machine_ranks;
77 return m_pm->_internalApi()->machineBarrier();
86 const AllocatedMemoryInfo data(m_var->data()->_commonInternal()->numericData()->memoryView().data());
89 ARCANE_FATAL(
"Variable not initialised yet. Call var.resize() method before.");
92 return MachineShMemWinMemoryAllocator::segmentView(data, rank).subSpan(0, m_sizeof_var.at(rank));
103 all_size.
segmentView()[0] = nb_elem_dim1 * sizeof_elem;
107 m_sizeof_var[m_machine_ranks[machine_rank]] = size;
122 m_nb_elem_dim1.reserve(m_machine_ranks.size());
123 m_nb_elem_dim2.reserve(m_machine_ranks.size());
139 Int64 sizeof_elem2 = sizeof_elem * sizeof_elem;
141 for (
Int32 machine_rank = 0;
const Int32 world_rank : m_machine_ranks) {
142 const Int32 pos = machine_rank * 2;
146 m_nb_elem_dim1[world_rank] = nb_elem_dim1_i;
147 m_nb_elem_dim2[world_rank] = nb_elem_dim2_i;
148 m_sizeof_var[world_rank] = nb_elem_dim1_i * nb_elem_dim2_i * sizeof_elem2;
163 m_nb_elem_dim1.reserve(m_machine_ranks.size());
178 Int64 mult = nb_elem_dim2 * sizeof_elem * sizeof_elem;
181 const Int32 world_rank = m_machine_ranks[machine_rank];
182 m_nb_elem_dim1[world_rank] = nb_elem;
183 m_sizeof_var[world_rank] = nb_elem * mult;
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Information about an allocated memory region.
void * baseAddress() const
Address of the start of the allocated region.
Constant view of an array of type T.
Class allowing the creation of a shared memory window between the subdomains of the same node....
void barrier() const
Method allowing waiting until all processes/threads of the node call this method to continue executio...
Span< Type > segmentView()
Method allowing retrieval of a view on our window segment memory.
Span< const Type > windowConstView() const
Method allowing retrieval of a constant view on the entire window memory.
virtual ArrayShape shape() const =0
Array shape for a 1D or 2D data item.
@ PInShMem
Indicates that the variable must be allocated in shared memory.
virtual IData * data()=0
Data associated with the variable.
MachineShMemWinVariable2DBase(IVariable *var)
Constructor.
void updateVariable(Int64 nb_elem_dim1, Int64 nb_elem_dim2, Int64 sizeof_elem)
Span< std::byte > segmentView(Int32 rank) const
Method allowing retrieval of a view on the segment of another sub-domain of the node.
MachineShMemWinVariableBase(IVariable *var)
Constructor.
void barrier() const
Method allowing waiting until all processes/threads of the node call this method to continue executio...
ConstArrayView< Int32 > machineRanks() const
Method allowing retrieval of the ranks that possess a segment in the window.
void updateVariable(Int64 nb_elem_dim1, Int64 sizeof_elem)
void updateVariable(Int64 nb_elem_dim1, Int32 nb_elem_dim2, Int64 sizeof_elem)
MachineShMemWinVariableMDBase(IVariable *var)
Constructor.
View of an array of elements of type T.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.