14#include "arcane/core/MachineShMemWinVariable.h"
16#include "arcane/utils/NumericTypes.h"
17#include "arcane/utils/MDSpan.h"
19#include "arcane/core/VariableRefArray.h"
20#include "arcane/core/VariableRefArray2.h"
21#include "arcane/core/MeshVariable.h"
22#include "arcane/core/IVariable.h"
23#include "arcane/core/MeshVariableScalarRef.h"
24#include "arcane/core/internal/MachineShMemWinVariableBase.h"
27#include "arccore/base/MDIndex.h"
46MachineShMemWinVariableCommon::
47~MachineShMemWinVariableCommon() =
default;
55 return m_base->machineRanks();
73template <
class DataType>
85template <
class DataType>
92template <
class DataType>
102template <
class DataType>
106 m_base->updateVariable(m_vart.asArray().size(),
sizeof(DataType));
115template <
class ItemType,
class DataType>
127template <
class ItemType,
class DataType>
134template <
class ItemType,
class DataType>
144template <
class ItemType,
class DataType>
148 return this->
view(rank)[notlocal_id];
154template <
class ItemType,
class DataType>
158 m_base->updateVariable(m_vart.asArray().size(),
sizeof(DataType));
167template <
class DataType>
179template <
class DataType>
186template <
class DataType>
190 return m_base->machineRanks();
196template <
class DataType>
206template <
class DataType>
211 return { span1.
data(), m_base->nbElemDim1(rank), m_base->nbElemDim2(rank) };
217template <
class DataType>
221 Int64 size_dim1 = m_vart.dim1Size();
222 Int64 size_dim2 = m_vart.dim2Size();
224 m_base->updateVariable(size_dim1, size_dim2,
sizeof(DataType));
233template <
class ItemType,
class DataType>
245template <
class ItemType,
class DataType>
252template <
class ItemType,
class DataType>
256 return m_base->machineRanks();
262template <
class ItemType,
class DataType>
272template <
class ItemType,
class DataType>
277 return { span1.
data(), m_base->nbElemDim1(rank), m_nb_elem_dim2 };
283template <
class ItemType,
class DataType>
290 return span2[notlocal_id];
296template <
class ItemType,
class DataType>
300 Int64 size_dim1 = m_vart.asArray().dim1Size();
301 m_nb_elem_dim2 = m_vart.asArray().dim2Size();
303 m_base->updateVariable(size_dim1, m_nb_elem_dim2,
sizeof(DataType));
312template <
class ItemType,
class DataType,
class Extents>
324template <
class ItemType,
class DataType,
class Extents>
331template <
class ItemType,
class DataType,
class Extents>
335 return m_base->machineRanks();
341template <
class ItemType,
class DataType,
class Extents>
351template <
class ItemType,
class DataType,
class Extents>
357 if constexpr (Extents::rank() == 1) {
358 std::array<Int32, 2> nb_elem_mdim{
static_cast<Int32>(m_base->nbElemDim1(rank)), m_shape_dim2[0] };
362 else if constexpr (Extents::rank() == 2) {
363 std::array<Int32, 3> nb_elem_mdim{
static_cast<Int32>(m_base->nbElemDim1(rank)), m_shape_dim2[0], m_shape_dim2[1] };
367 else if constexpr (Extents::rank() == 3) {
368 std::array<Int32, 4> nb_elem_mdim{
static_cast<Int32>(m_base->nbElemDim1(rank)), m_shape_dim2[0], m_shape_dim2[1], m_shape_dim2[2] };
378template <
class ItemType,
class DataType,
class Extents>
392template <
class ItemType,
class DataType,
class Extents>
396 Int64 nb_elem_dim1 = m_vart.asArray().dim1Size();
397 Int32 nb_elem_dim2 = m_vart.asArray().dim2Size();
399 m_base->updateVariable(nb_elem_dim1, nb_elem_dim2,
sizeof(DataType));
402 shape_dim2_view.
copy(m_base->arrayShape().dimensions());
404 m_nb_elem_dim2 = nb_elem_dim2;
414#define ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, item) \
415 template class ARCANE_TEMPLATE_EXPORT class_name<item, Real>; \
416 template class ARCANE_TEMPLATE_EXPORT class_name<item, Real3>; \
417 template class ARCANE_TEMPLATE_EXPORT class_name<item, Real3x3>; \
418 template class ARCANE_TEMPLATE_EXPORT class_name<item, Real2>; \
419 template class ARCANE_TEMPLATE_EXPORT class_name<item, Real2x2>; \
420 template class ARCANE_TEMPLATE_EXPORT class_name<item, Int8>; \
421 template class ARCANE_TEMPLATE_EXPORT class_name<item, Int16>; \
422 template class ARCANE_TEMPLATE_EXPORT class_name<item, Int32>; \
423 template class ARCANE_TEMPLATE_EXPORT class_name<item, Int64>;
425#define ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM(class_name) \
426 ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, Node) \
427 ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, Face) \
428 ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, Cell) \
429 ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, Particle) \
430 ARCANE_INTERNAL_INSTANTIATE_TEMPLATE_FOR_NUMERIC_DATATYPE_WITH_ITEM1(class_name, DoF)
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Types and functions associated with the classes Span2Impl, Small2Span and Span2.
Constant view of an array of type T.
Base class for multi-dimensional views.
Class allowing access to shared elements of the variable in shared memory.
MachineShMemWinMDVariableT(MeshVariableArrayRefT< ItemType, DataType > var)
Constructor.
MDSpan< DataType, Extents > operator()(Int32 rank, Int32 notlocal_id)
Method to get the multi-dimensional array of an item from another subdomain.
ConstArrayView< Int32 > machineRanks() const
Method to get the ranks that possess a segment in the window.
MDSpan< DataType, typename MDDimType< Extents::rank()+1 >::DimType > view(Int32 rank) const
Method to get a view of the variable from another subdomain on the node.
void updateVariable()
Method to update this object after a change in the mesh and/or after a resizing of the variable.
void barrier() const
Method to wait until all processes/threads on the node call this method to continue execution.
Class allowing access to shared elements of the variable in shared memory.
Class allowing access to shared elements of the variable in shared memory.
Class allowing access to the shared elements of the variable in shared memory.
void updateVariable()
Method to update this object after a change in the mesh and/or after a resizing of the variable.
Span2< DataType > view(Int32 rank) const
Method to get a view of the variable from another subdomain on the node.
void barrier() const
Method to wait until all processes/threads on the node call this method to continue execution.
Span< DataType > operator()(Int32 rank, Int32 notlocal_id)
Method to get the array of an item from another subdomain.
MachineShMemWinMeshVariableArrayT(MeshVariableArrayRefT< ItemType, DataType > var)
Constructor.
ConstArrayView< Int32 > machineRanks() const
Method to get the ranks that possess a segment in the window.
Class allowing access to the shared elements of the variable in shared memory.
void updateVariable()
Method allowing updating this object after a change in the mesh.
DataType operator()(Int32 rank, Int32 notlocal_id)
Method allowing retrieval of an element of the variable from another subdomain.
Span< DataType > view(Int32 rank) const
Method allowing retrieval of a view on the variable of another subdomain on the node.
MachineShMemWinMeshVariableScalarT(MeshVariableScalarRefT< ItemType, DataType > var)
Constructor.
Class allowing access to shared elements of the variable in shared memory.
Class allowing access to the shared memory part between sub-domains of the same node of a 2D array va...
Class allowing access to the shared elements of the variable in shared memory.
ConstArrayView< Int32 > machineRanks() const
Method allowing retrieval of ranks that possess a segment in the window.
Span2< DataType > view(Int32 rank) const
Method allowing retrieval of a view on the array of another subdomain on the node.
MachineShMemWinVariableArray2T(VariableRefArray2T< DataType > var)
Constructor.
void barrier() const
Method allowing waiting until all processes/threads on the node call this method to continue executio...
void updateVariable()
Method allowing updating this object after a resizing of the variable.
Class allowing access to the shared elements of the variable in shared memory.
MachineShMemWinVariableArrayT(VariableRefArrayT< DataType > var)
Constructor.
Span< DataType > view(Int32 rank) const
Method allowing retrieval of a view on the array of another subdomain on the node.
void updateVariable()
Method allowing updating this object after a resizing of the variable.
Class allowing access to the shared memory part between sub-domains of the same node of a variable.
void barrier() const
Method allowing waiting until all processes/threads on the node call this method to continue executio...
ConstArrayView< Int32 > machineRanks() const
Method allowing retrieval of ranks that possess a segment in the window.
MachineShMemWinVariableCommon(IVariable *var)
Constructor.
Class allowing access to the shared memory part between sub-domains of the same node of a 2D array va...
Array variable on a mesh entity type.
Scalar variable on a mesh entity type.
View of an array of elements of type T.
View for a 2D array whose size is an 'Int64'.
__host__ __device__ void copy(const U ©_array)
Copies the array copy_array into the instance.
constexpr __host__ __device__ pointer data() const noexcept
Pointer to the start of the view.
View of an array of elements of type T.
Two-dimensional array variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Span< DataType > asSpan(Span< std::byte, Extent > bytes)
Converts a Span<std::byte> into a Span<DataType>.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
std::int32_t Int32
Signed integer type of 32 bits.