14#include "arcane/core/internal/MachineShMemWinVariableBase.h"
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/ITraceMng.h"
18#include "arcane/utils/ArrayShape.h"
20#include "arcane/core/ContigMachineShMemWin.h"
21#include "arcane/core/IMesh.h"
22#include "arcane/core/ISubDomain.h"
23#include "arcane/core/MeshHandle.h"
24#include "arcane/core/IData.h"
25#include "arcane/core/IParallelMng.h"
26#include "arcane/core/IVariable.h"
28#include "arcane/core/internal/MachineShMemWinMemoryAllocator.h"
29#include "arcane/core/internal/IDataInternal.h"
30#include "arcane/core/internal/IParallelMngInternal.h"
32#include "arccore/common/AllocatedMemoryInfo.h"
33#include "arccore/base/MemoryView.h"
49 ARCANE_FATAL(
"The variable has not PInShMem property");
51 if (m_var->meshHandle().hasMesh()) {
52 m_pm = m_var->meshHandle().mesh()->parallelMng();
55 m_pm = m_var->subDomain()->parallelMng();
57 m_sizeof_var.resize(m_pm->commSize(), 0);
66 return m_pm->_internalApi()->machineRanks();
75 return m_pm->_internalApi()->machineBarrier();
84 const AllocatedMemoryInfo data(m_var->data()->_commonInternal()->numericData()->memoryView().data());
87 ARCANE_FATAL(
"Variable not initialised yet. Call var.resize() method before.");
90 return MachineShMemWinMemoryAllocator::segmentView(data, rank).subSpan(0, m_sizeof_var[rank]);
101 all_size.
segmentView()[0] = nb_elem_dim1 * sizeof_elem;
115, m_nb_elem_dim1(m_pm->commSize(), 0)
116, m_nb_elem_dim2(m_pm->commSize(), 0)
132 Int64 sizeof_elem2 = sizeof_elem * sizeof_elem;
134 for (
Int32 i = 0; i < m_pm->commSize(); ++i) {
135 const Int32 i2 = i * 2;
138 m_sizeof_var[i] = m_nb_elem_dim1[i] * m_nb_elem_dim2[i] * sizeof_elem2;
148 return m_nb_elem_dim1;
154ArrayView<Int64> MachineShMemWinVariable2DBase::
157 return m_nb_elem_dim2;
169, m_nb_elem_dim1(m_pm->commSize(), 0)
186 Int64 mult = nb_elem_dim2 * sizeof_elem * sizeof_elem;
188 for (
Integer i = 0; i < m_pm->commSize(); ++i) {
189 m_sizeof_var[i] = m_nb_elem_dim1[i] * mult;
199 return m_nb_elem_dim1;
205ArrayShape MachineShMemWinVariableMDBase::
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Informations sur une zone mémoire allouée.
void * baseAddress() const
Adresse du début de la zone allouée.
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
Classe permettant de créer une fenêtre mémoire partagée entre les sous-domaines d'un même noeud....
void barrier() const
Méthode permettant d'attendre que tous les processus/threads du noeud appellent cette méthode pour co...
Span< Type > segmentView()
Méthode permettant d'obtenir une vue sur notre segment de fenêtre mémoire.
Span< const Type > windowConstView() const
Méthode permettant d'obtenir une vue constante sur toute la fenêtre mémoire.
virtual ArrayShape shape() const =0
Forme du tableau pour une donnée 1D ou 2D.
Interface d'une variable.
@ PInShMem
Indique que la variable doit être alloué en mémoire partagée.
virtual IData * data()=0
Données associées à la variable.
MachineShMemWinVariable2DBase(IVariable *var)
Constructeur.
void updateVariable(Int64 nb_elem_dim1, Int64 nb_elem_dim2, Int64 sizeof_elem)
Span< std::byte > segmentView(Int32 rank) const
Méthode permettant d'obtenir une vue sur le segment d'un autre sous-domaine du noeud.
MachineShMemWinVariableBase(IVariable *var)
Constructeur.
void barrier() const
Méthode permettant d'attendre que tous les processus/threads du noeud appellent cette méthode pour co...
ConstArrayView< Int32 > machineRanks() const
Méthode permettant d'obtenir les rangs qui possèdent un segment dans la fenêtre.
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)
Constructeur.
Vue d'un tableau d'éléments de type T.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
std::int32_t Int32
Type entier signé sur 32 bits.