Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MachineShMemWinVariable.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MachineShMemWinVariable.h (C) 2000-2026 */
9/* */
10/* Classes allowing the use of the MachineShMemWinVariable object pointed */
11/* to by the shared memory variable memory area. */
12/*---------------------------------------------------------------------------*/
13
14#ifndef ARCANE_CORE_MACHINESHMEMWINVARIABLE_H
15#define ARCANE_CORE_MACHINESHMEMWINVARIABLE_H
16
17/*---------------------------------------------------------------------------*/
18/*---------------------------------------------------------------------------*/
19
21
22#include "arcane/utils/Ref.h"
23#include "arcane/utils/NumArray.h"
24
25#include "arcane/core/MeshMDVariableRef.h"
26
27#include "arccore/base/FixedArray.h"
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
54class ARCANE_CORE_EXPORT MachineShMemWinVariableCommon
55{
56
57 protected:
58
64
65 public:
66
68
69 public:
70
80
85 void barrier() const;
86
87 protected:
88
90};
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
95/*---------------------------------------------------------------------------*/
96/*---------------------------------------------------------------------------*/
97
110template <class DataType>
113{
114
115 public:
116
121 ARCANE_CORE_EXPORT explicit MachineShMemWinVariableArrayT(VariableRefArrayT<DataType> var);
122 ARCANE_CORE_EXPORT ~MachineShMemWinVariableArrayT() override;
123
124 public:
125
137 ARCANE_CORE_EXPORT Span<DataType> view(Int32 rank) const;
138
145 ARCANE_CORE_EXPORT void updateVariable();
146
147 private:
148
150};
151
152/*---------------------------------------------------------------------------*/
153/*---------------------------------------------------------------------------*/
154
155/*---------------------------------------------------------------------------*/
156/*---------------------------------------------------------------------------*/
157
170template <class ItemType, class DataType>
173{
174
175 public:
176
182
183 ARCANE_CORE_EXPORT ~MachineShMemWinMeshVariableScalarT() override;
184
185 public:
186
202 ARCANE_CORE_EXPORT Span<DataType> view(Int32 rank) const;
203
221 ARCANE_CORE_EXPORT DataType operator()(Int32 rank, Int32 notlocal_id);
222
229 ARCANE_CORE_EXPORT void updateVariable();
230
231 private:
232
234};
235
236/*---------------------------------------------------------------------------*/
237/*---------------------------------------------------------------------------*/
238
239/*---------------------------------------------------------------------------*/
240/*---------------------------------------------------------------------------*/
241
254template <class DataType>
256{
257 public:
258
263 ARCANE_CORE_EXPORT explicit MachineShMemWinVariableArray2T(VariableRefArray2T<DataType> var);
264
265 ARCANE_CORE_EXPORT ~MachineShMemWinVariableArray2T();
266
267 public:
268
277 ARCANE_CORE_EXPORT ConstArrayView<Int32> machineRanks() const;
278
283 ARCANE_CORE_EXPORT void barrier() const;
284
285 public:
286
296 ARCANE_CORE_EXPORT Span2<DataType> view(Int32 rank) const;
297
304 ARCANE_CORE_EXPORT void updateVariable();
305
306 private:
307
310};
311
312/*---------------------------------------------------------------------------*/
313/*---------------------------------------------------------------------------*/
314
315/*---------------------------------------------------------------------------*/
316/*---------------------------------------------------------------------------*/
317
330template <class ItemType, class DataType>
332{
333
334 public:
335
341
342 ARCANE_CORE_EXPORT ~MachineShMemWinMeshVariableArrayT();
343
344 public:
345
354 ARCANE_CORE_EXPORT ConstArrayView<Int32> machineRanks() const;
355
360 ARCANE_CORE_EXPORT void barrier() const;
361
362 public:
363
381 ARCANE_CORE_EXPORT Span2<DataType> view(Int32 rank) const;
382
400 ARCANE_CORE_EXPORT Span<DataType> operator()(Int32 rank, Int32 notlocal_id);
401
408 ARCANE_CORE_EXPORT void updateVariable();
409
410 private:
411
414 Int32 m_nb_elem_dim2{};
415};
416
417/*---------------------------------------------------------------------------*/
418/*---------------------------------------------------------------------------*/
419
420/*---------------------------------------------------------------------------*/
421/*---------------------------------------------------------------------------*/
422
436template <class ItemType, class DataType, class Extents>
438{
439
440 protected:
441
447
448 public:
449
450 ARCANE_CORE_EXPORT virtual ~MachineShMemWinMDVariableT();
451
452 public:
453
462 ARCANE_CORE_EXPORT ConstArrayView<Int32> machineRanks() const;
463
468 ARCANE_CORE_EXPORT void barrier() const;
469
470 public:
471
488 ARCANE_CORE_EXPORT MDSpan<DataType, typename MDDimType<Extents::rank() + 1>::DimType> view(Int32 rank) const;
489
507 ARCANE_CORE_EXPORT MDSpan<DataType, Extents> operator()(Int32 rank, Int32 notlocal_id);
508
515 ARCANE_CORE_EXPORT void updateVariable();
516
517 private:
518
521 Int32 m_nb_elem_dim2{};
522 std::array<Int32, Extents::rank()> m_shape_dim2{};
523};
524
525/*---------------------------------------------------------------------------*/
526/*---------------------------------------------------------------------------*/
527
528/*---------------------------------------------------------------------------*/
529/*---------------------------------------------------------------------------*/
530
544template <class ItemType, class DataType, class Extents>
546: public MachineShMemWinMDVariableT<ItemType, DataType, Extents>
547{
548
549 public:
550
556 : MachineShMemWinMDVariableT<ItemType, DataType, Extents>(var.underlyingVariable())
557 {}
558
559 ~MachineShMemWinMeshMDVariableT() override = default;
560};
561
562/*---------------------------------------------------------------------------*/
563/*---------------------------------------------------------------------------*/
564
565/*---------------------------------------------------------------------------*/
566/*---------------------------------------------------------------------------*/
567
581template <class ItemType, class DataType, class Extents>
583: public MachineShMemWinMDVariableT<ItemType, DataType, typename Extents::template AddedFirstExtentsType<DynExtent>>
584{
585 using AddedFirstExtentsType = Extents::template AddedFirstExtentsType<DynExtent>;
586
587 public:
588
593 template <Int32 Size>
595 : MachineShMemWinMDVariableT<ItemType, DataType, AddedFirstExtentsType>(var.underlyingVariable())
596 {}
597
598 ~MachineShMemWinMeshVectorMDVariableT() override = default;
599};
600
601/*---------------------------------------------------------------------------*/
602/*---------------------------------------------------------------------------*/
603
604/*---------------------------------------------------------------------------*/
605/*---------------------------------------------------------------------------*/
606
620template <class ItemType, class DataType, class Extents>
622: public MachineShMemWinMDVariableT<ItemType, DataType, typename Extents::template AddedFirstLastExtentsType<DynExtent, DynExtent>>
623{
624 using AddedFirstLastExtentsType = Extents::template AddedFirstLastExtentsType<DynExtent, DynExtent>;
625
626 public:
627
632 template <Int32 Row, Int32 Column>
634 : MachineShMemWinMDVariableT<ItemType, DataType, AddedFirstLastExtentsType>(var.underlyingVariable())
635 {}
636
637 ~MachineShMemWinMeshMatrixMDVariableT() override = default;
638};
639
640/*---------------------------------------------------------------------------*/
641/*---------------------------------------------------------------------------*/
642
643} // End namespace Arcane
644
645/*---------------------------------------------------------------------------*/
646/*---------------------------------------------------------------------------*/
647
648#endif
Declarations of Arcane's general types.
Constant view of an array of type T.
Interface of a variable.
Definition IVariable.h:40
Base class for multi-dimensional views.
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.
MachineShMemWinMeshMDVariableT(MeshMDVariableRefT< ItemType, DataType, Extents > var)
Constructor.
Class allowing access to shared elements of the variable in shared memory.
MachineShMemWinMeshMatrixMDVariableT(MeshMatrixMDVariableRefT< ItemType, DataType, Row, Column, Extents > var)
Constructor.
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.
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.
MachineShMemWinMeshVectorMDVariableT(MeshVectorMDVariableRefT< ItemType, DataType, Size, Extents > var)
Constructor.
Class allowing access to the shared memory part between sub-domains of the same node of a 2D array va...
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.
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...
Class managing a multi-dimensional variable on a mesh entity.
Class managing a multi-dimensional 'NumMatrix' type variable on a mesh entity.
Array variable on a mesh entity type.
Scalar variable on a mesh entity type.
Class managing a multi-dimensional 'NumVector' type variable on a mesh entity.
Reference to an instance.
View for a 2D array whose size is an 'Int64'.
Definition Span2.h:324
View of an array of elements of type T.
Definition Span.h:635
Two-dimensional array variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.