Template Numerical Library version\ main:40802e2e
Loading...
Searching...
No Matches
N-dimensional arrays

Namespaces

namespace  TNL::Containers::NDArraySyncPatterns
 Namespace where synchronization patterns for distributed N-dimensional arrays are defined.
 

Classes

class  TNL::Containers::DistributedNDArray< NDArray >
 Distributed N-dimensional array. More...
 
class  TNL::Containers::DistributedNDArraySynchronizer< DistributedNDArray >
 Synchronizer for DistributedNDArray. More...
 
class  TNL::Containers::DistributedNDArrayView< NDArrayView >
 Distributed N-dimensional array view. More...
 
class  TNL::Containers::NDArray< Value, SizesHolder, Permutation, Device, Index, Overlaps, Allocator >
 Dynamic N-dimensional array. More...
 
class  TNL::Containers::NDArrayIndexer< SizesHolder, Permutation, Base, StridesHolder, Overlaps >
 Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension. More...
 
class  TNL::Containers::NDArrayStorage< Array, Indexer, Device >
 Base storage class for NDArray, StaticNDArray and SlicedNDArray. More...
 
class  TNL::Containers::NDArrayView< Value, Device, Indexer >
 Simple data structure which provides a non-owning encapsulation of N-dimensional array data. More...
 
class  TNL::Containers::SizesHolder< Index, sizes >
 Holds static and dynamic sizes of an N-dimensional array. More...
 
class  TNL::Containers::SlicedNDArray< Value, SizesHolder, Permutation, SliceInfo, Device, Index, Overlaps, Allocator >
 Dynamic N-dimensional array with configurable slicing/tiling. More...
 
struct  TNL::Containers::SliceInfo< slicedDimension, sliceSize >
 Describes slicing configuration for SlicedNDArray. More...
 
class  TNL::Containers::StaticNDArray< Value, SizesHolder, Permutation, Index >
 Static N-dimensional array. More...
 
class  TNL::Containers::StaticSizesHolder< Index, sizes >
 Holds static sizes of an N-dimensional array. More...
 

Enumerations

enum class  TNL::Containers::SyncDirection : std::uint8_t {
  TNL::Containers::SyncDirection::All = 0xff , TNL::Containers::SyncDirection::None = 0 , TNL::Containers::SyncDirection::Right = 1 << 0 , TNL::Containers::SyncDirection::Left = 1 << 1 ,
  TNL::Containers::SyncDirection::Top = 1 << 2 , TNL::Containers::SyncDirection::Bottom = 1 << 3 , TNL::Containers::SyncDirection::Front = 1 << 4 , TNL::Containers::SyncDirection::Back = 1 << 5 ,
  TNL::Containers::SyncDirection::TopRight = Top | Right , TNL::Containers::SyncDirection::TopLeft = Top | Left , TNL::Containers::SyncDirection::BottomRight = Bottom | Right , TNL::Containers::SyncDirection::BottomLeft = Bottom | Left ,
  TNL::Containers::SyncDirection::BackRight = Back | Right , TNL::Containers::SyncDirection::BackLeft = Back | Left , TNL::Containers::SyncDirection::FrontRight = Front | Right , TNL::Containers::SyncDirection::FrontLeft = Front | Left ,
  TNL::Containers::SyncDirection::BackTop = Back | Top , TNL::Containers::SyncDirection::BackBottom = Back | Bottom , TNL::Containers::SyncDirection::FrontTop = Front | Top , TNL::Containers::SyncDirection::FrontBottom = Front | Bottom ,
  TNL::Containers::SyncDirection::BackTopRight = Back | Top | Right , TNL::Containers::SyncDirection::BackTopLeft = Back | Top | Left , TNL::Containers::SyncDirection::BackBottomRight = Back | Bottom | Right , TNL::Containers::SyncDirection::BackBottomLeft = Back | Bottom | Left ,
  TNL::Containers::SyncDirection::FrontTopRight = Front | Top | Right , TNL::Containers::SyncDirection::FrontTopLeft = Front | Top | Left , TNL::Containers::SyncDirection::FrontBottomRight = Front | Bottom | Right , TNL::Containers::SyncDirection::FrontBottomLeft = Front | Bottom | Left
}
 Directions for data synchronization in a distributed N-dimensional array. More...
 

Functions

SyncDirection TNL::Containers::operator& (SyncDirection a, SyncDirection b)
 Bitwise AND operator for SyncDirection.
 
template<typename Index , std::size_t... sizes, typename OtherHolder >
SizesHolder< Index, sizes... > TNL::Containers::operator+ (const SizesHolder< Index, sizes... > &lhs, const OtherHolder &rhs)
 Combines the sizes of two instance of SizesHolder with the operator +.
 
template<typename Index , std::size_t... sizes, typename OtherHolder >
SizesHolder< Index, sizes... > TNL::Containers::operator- (const SizesHolder< Index, sizes... > &lhs, const OtherHolder &rhs)
 Combines the sizes of two instance of SizesHolder with the operator -.
 
SyncDirectionTNL::Containers::operator-= (SyncDirection &a, SyncDirection b)
 Bitwise operator which clears all bits from b in a.
 
template<typename Index , std::size_t... sizes>
std::ostreamTNL::Containers::operator<< (std::ostream &str, const SizesHolder< Index, sizes... > &holder)
 Prints the sizes contained in an instance of SizesHolder to the given output stream.
 
SyncDirection TNL::Containers::operator| (SyncDirection a, SyncDirection b)
 Bitwise OR operator for SyncDirection.
 
template<typename DistributedNDArray , std::size_t Q, typename BlockType >
void TNL::Containers::setNeighbors (DistributedNDArraySynchronizer< DistributedNDArray > &synchronizer, const std::array< SyncDirection, Q > &pattern, int rank, const std::vector< BlockType > &decomposition, const BlockType &global)
 Set neighbors for a synchronizer according to given synchronization pattern and decomposition of a global block.
 

Detailed Description

This group includes several classes for the representation of N-dimensional arrays and some helper classes. See the Users' Guide for showing how these data structures can be used.

Enumeration Type Documentation

◆ SyncDirection

Directions for data synchronization in a distributed N-dimensional array.

It is treated as bitfield, i.e. the elementary enumerators represent individual bits and compound enumerators are obtained by combining bits from relevant elementary enumerators.

Enumerator
All 

special value – synchronize in all directions

None 

special value – no synchronization

Right 

synchronization from left to right (N >= 1, positive x-axis)

Left 

synchronization from right to left (N >= 1, negative x-axis)

Top 

synchronization from bottom to top (N >= 2, positive y-axis)

Bottom 

synchronization from top to bottom (N >= 2, negative y-axis)

Front 

synchronization from back to front (N >= 3, positive z-axis)

Back 

synchronization from front to back (N >= 3, negative z-axis)

TopRight 

synchronization in the top-right direction

TopLeft 

synchronization in the top-left direction

BottomRight 

synchronization in the bottom-right direction

BottomLeft 

synchronization in the bottom-left direction

BackRight 

synchronization in the back-right direction

BackLeft 

synchronization in the back-left direction

FrontRight 

synchronization in the front-right direction

FrontLeft 

synchronization in the front-left direction

BackTop 

synchronization in the back-top direction

BackBottom 

synchronization in the back-bottom direction

FrontTop 

synchronization in the front-top direction

FrontBottom 

synchronization in the front-bottom direction

BackTopRight 

synchronization in the back-top-right direction

BackTopLeft 

synchronization in the back-top-left direction

BackBottomRight 

synchronization in the back-bottom-right direction

BackBottomLeft 

synchronization in the back-bottom-left direction

FrontTopRight 

synchronization in the front-top-right direction

FrontTopLeft 

synchronization in the front-top-left direction

FrontBottomRight 

synchronization in the front-bottom-right direction

FrontBottomLeft 

synchronization in the front-bottom-left direction

Function Documentation

◆ operator-=()

SyncDirection & TNL::Containers::operator-= ( SyncDirection & a,
SyncDirection b )
inlinenodiscard

Bitwise operator which clears all bits from b in a.

This operator makes a -= b equivalent to a &= ~b, i.e. it clears all bits from b in a.

Returns
reference to a

◆ setNeighbors()

template<typename DistributedNDArray , std::size_t Q, typename BlockType >
void TNL::Containers::setNeighbors ( DistributedNDArraySynchronizer< DistributedNDArray > & synchronizer,
const std::array< SyncDirection, Q > & pattern,
int rank,
const std::vector< BlockType > & decomposition,
const BlockType & global )

Set neighbors for a synchronizer according to given synchronization pattern and decomposition of a global block.

Template Parameters
Qis the number of elements in pattern.
Parameters
synchronizeris an instance of DistributedNDArraySynchronizer.
patternis the synchronization pattern (array of directions in which the data will be sent). It must be consistent with the partitioning of the distributed array.
rankis the ID of the current MPI rank and also an index of the corresponding block in decomposition.
decompositionis a vector of blocks forming a decomposition of the global block. Its size must be equal to the size of the MPI communicator and indices of the blocks in the vector determine the rank IDs of the neighbors.
globalis the global block (used for setting neighbors over the periodic boundary).