Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::MachineShMemWin< Type > Class Template Reference

Class allowing the creation of a shared memory window between sub-domains of the same node. More...

#include <arcane/core/MachineShMemWin.h>

Public Member Functions

 MachineShMemWin (IParallelMng *pm, Int64 nb_elem_segment)
 Constructor.
 MachineShMemWin (IParallelMng *pm)
 Constructor.
ConstArrayView< Int32machineRanks () const
 Method to obtain the ranks that possess a segment in the window.
void barrier () const
 Method to wait until all processes/threads on the node call this method to continue execution.
Span< Type > segmentView ()
 Method to obtain a view of our segment.
Span< Type > segmentView (Int32 rank)
 Method to obtain a view of the segment of another sub-domain on the node.
Span< const Type > segmentConstView () const
 Method to obtain a view of our segment.
Span< const Type > segmentConstView (Int32 rank) const
 Method to obtain a view of the segment of another sub-domain on the node.
void add (Span< const Type > elem)
 Method to add elements to our segment.
void add ()
 Method to be called by the sub-domain(s) that do not wish to add elements to their segment.
void addToAnotherSegment (Int32 rank, Span< const Type > elem)
 Method to add elements to the segment of another sub-domain.
void addToAnotherSegment ()
 Method to be called by the sub-domain(s) that do not wish to add elements to the segment of another sub-domain.
void reserve (Int64 new_capacity)
 Method to reserve memory space in our segment.
void reserve ()
 Method to be called by the sub-domain(s) that do not wish to reserve more memory for their segments.
void resize (Int64 new_nb_elem)
 Method to resize our segment.
void resize ()
 Method to be called by the sub-domain(s) that do not wish to resize their segments.
void shrink ()
 Method to reduce the reserved memory space for the segments to the minimum necessary.

Detailed Description

template<class Type>
class Arcane::MachineShMemWin< Type >

Class allowing the creation of a shared memory window between sub-domains of the same node.

The segments of this window are not contiguous in memory and can be resized.

The add() method allows adding elements iteratively.

Template Parameters
TypeThe type of the window elements.

Definition at line 46 of file MachineShMemWin.h.

Constructor & Destructor Documentation

◆ MachineShMemWin() [1/2]

template<class Type>
Arcane::MachineShMemWin< Type >::MachineShMemWin ( IParallelMng * pm,
Int64 nb_elem_segment )
inline

Constructor.

Parameters
pmThe parallelMng to use.
nb_elem_segmentThe initial number of elements.

Definition at line 56 of file MachineShMemWin.h.

◆ MachineShMemWin() [2/2]

template<class Type>
Arcane::MachineShMemWin< Type >::MachineShMemWin ( IParallelMng * pm)
inlineexplicit

Constructor.

Parameters
pmThe parallelMng to use.

Definition at line 64 of file MachineShMemWin.h.

Member Function Documentation

◆ add() [1/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::add ( )
inline

Method to be called by the sub-domain(s) that do not wish to add elements to their segment.

Collective call.

Note
The methods add(..) and addToAnotherSegment(..) must not be mixed.

See the documentation for add(Span<const std::byte> elem).

Definition at line 173 of file MachineShMemWin.h.

◆ add() [2/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::add ( Span< const Type > elem)
inline

Method to add elements to our segment.

Collective call.

Note
The methods add(..) and addToAnotherSegment(..) must not be mixed.

If the segment is too small, it will be resized.

Sub-domains that do not wish to add elements can call the add() method without parameters or this method with an empty view.

Parameters
elemThe elements to add.

Definition at line 157 of file MachineShMemWin.h.

References Arcane::SpanImpl< T, SizeType, Extent >::data(), and Arcane::SpanImpl< T, SizeType, Extent >::sizeBytes().

◆ addToAnotherSegment() [1/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::addToAnotherSegment ( )
inline

Method to be called by the sub-domain(s) that do not wish to add elements to the segment of another sub-domain.

Collective call.

Note
The methods add(..) and addToAnotherSegment(..) must not be mixed.

See the documentation for addToAnotherSegment(Int32 rank, Span<const Type> elem).

Definition at line 213 of file MachineShMemWin.h.

◆ addToAnotherSegment() [2/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::addToAnotherSegment ( Int32 rank,
Span< const Type > elem )
inline

Method to add elements to the segment of another sub-domain.

Collective call.

Note
The methods add(..) and addToAnotherSegment(..) must not be mixed.

Two sub-domains must not add elements to the same sub-domain segment.

If the target segment is too small, it will be resized.

Sub-domains that do not wish to add elements can call the addToAnotherSegment() method without parameters.

Parameters
rankThe rank of the sub-domain with the segment to modify.
elemThe elements to add.

Definition at line 197 of file MachineShMemWin.h.

References Arcane::SpanImpl< T, SizeType, Extent >::data(), and Arcane::SpanImpl< T, SizeType, Extent >::sizeBytes().

◆ barrier()

template<class Type>
void Arcane::MachineShMemWin< Type >::barrier ( ) const
inline

Method to wait until all processes/threads on the node call this method to continue execution.

Definition at line 87 of file MachineShMemWin.h.

◆ machineRanks()

template<class Type>
ConstArrayView< Int32 > Arcane::MachineShMemWin< Type >::machineRanks ( ) const
inline

Method to obtain the ranks that possess a segment in the window.

Non-collective call.

Returns
A view containing the rank IDs.

Definition at line 78 of file MachineShMemWin.h.

◆ reserve() [1/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::reserve ( )
inline

Method to be called by the sub-domain(s) that do not wish to reserve more memory for their segments.

Collective call.

See the documentation for reserve(Int64 new_capacity).

Definition at line 254 of file MachineShMemWin.h.

◆ reserve() [2/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::reserve ( Int64 new_capacity)
inline

Method to reserve memory space in our segment.

Collective call.

This method does nothing if new_capacity is less than the memory already allocated for the segment. For sub-domains that do not wish to increase the memory space available for their segment, it is possible to set the parameter new_capacity to 0 or use the reserve() method (without arguments).

The reserved space will have a size greater than or equal to new_capacity.

This method does not resize the segment; you must always use the add() method to add elements.

To resize the segment, the resize(Int64 new_size) method is available.

Parameters
new_capacityThe requested new capacity.

Definition at line 241 of file MachineShMemWin.h.

◆ resize() [1/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::resize ( )
inline

Method to be called by the sub-domain(s) that do not wish to resize their segments.

Collective call.

See the documentation for resize(Int64 new_nb_elem).

Definition at line 286 of file MachineShMemWin.h.

◆ resize() [2/2]

template<class Type>
void Arcane::MachineShMemWin< Type >::resize ( Int64 new_nb_elem)
inline

Method to resize our segment.

Collective call.

If the provided size is less than the current size of the segment, elements located after the provided size will be deleted.

For sub-domains that do not wish to resize their segment, it is possible to set the argument new_size to -1 or call the method resize() (without arguments).

Parameters
new_nb_elemThe new size.

Definition at line 273 of file MachineShMemWin.h.

◆ segmentConstView() [1/2]

template<class Type>
Span< const Type > Arcane::MachineShMemWin< Type >::segmentConstView ( ) const
inline

Method to obtain a view of our segment.

Non-collective call.

Returns
A view.

Definition at line 124 of file MachineShMemWin.h.

References Arcane::asSpan().

◆ segmentConstView() [2/2]

template<class Type>
Span< const Type > Arcane::MachineShMemWin< Type >::segmentConstView ( Int32 rank) const
inline

Method to obtain a view of the segment of another sub-domain on the node.

Non-collective call.

Parameters
rankThe rank of the sub-domain.
Returns
A view.

Definition at line 138 of file MachineShMemWin.h.

References Arcane::asSpan().

◆ segmentView() [1/2]

template<class Type>
Span< Type > Arcane::MachineShMemWin< Type >::segmentView ( )
inline

Method to obtain a view of our segment.

Non-collective call.

Returns
A view.

Definition at line 98 of file MachineShMemWin.h.

References Arcane::asSpan().

◆ segmentView() [2/2]

template<class Type>
Span< Type > Arcane::MachineShMemWin< Type >::segmentView ( Int32 rank)
inline

Method to obtain a view of the segment of another sub-domain on the node.

Non-collective call.

Parameters
rankThe rank of the sub-domain.
Returns
A view.

Definition at line 112 of file MachineShMemWin.h.

References Arcane::asSpan().

◆ shrink()

template<class Type>
void Arcane::MachineShMemWin< Type >::shrink ( )
inline

Method to reduce the reserved memory space for the segments to the minimum necessary.

Collective call.

Definition at line 297 of file MachineShMemWin.h.


The documentation for this class was generated from the following file: