DASH  0.3.0
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType > Class Template Reference

Defines how a list of global indices is mapped to single units within a Team. More...

#include <ShiftTilePattern.h>

Classes

struct  local_coords_t
 
struct  local_index_t
 

Public Types

typedef pattern_partitioning_properties< pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balancedpartitioning_properties
 Satisfiable properties in pattern property category Partitioning: More...
 
typedef pattern_mapping_properties< pattern_mapping_tag::balanced, pattern_mapping_tag::unbalanced, pattern_mapping_tag::diagonalmapping_properties
 Satisfiable properties in pattern property category Mapping: More...
 
typedef pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linearlayout_properties
 Satisfiable properties in pattern property category Layout: More...
 
typedef IndexType index_type
 
typedef SizeType size_type
 
typedef ViewSpec_t viewspec_type
 

Public Member Functions

template<typename ... Args>
 ShiftTilePattern (SizeType arg, Args &&... args)
 Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types. More...
 
 ShiftTilePattern (const SizeSpec_t &sizespec, DistributionSpec_t dist, TeamSpec_t teamspec, dash::Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team. More...
 
 ShiftTilePattern (const SizeSpec_t &sizespec, DistributionSpec_t dist=DistributionSpec_t(), Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and a Team. More...
 
 ShiftTilePattern (const self_t &other)
 Copy constructor. More...
 
 ShiftTilePattern (self_t &other)
 Copy constructor using non-const lvalue reference parameter. More...
 
bool operator== (const self_t &other) const
 Equality comparison operator. More...
 
bool operator!= (const self_t &other) const
 Inquality comparison operator. More...
 
ShiftTilePatternoperator= (const ShiftTilePattern &other)
 Assignment operator. More...
 
IndexType lbegin () const
 Resolves the global index of the first local element in the pattern. More...
 
IndexType lend () const
 Resolves the global index past the last local element in the pattern. More...
 
team_unit_t unit_at (const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
 unit_at More...
 
team_unit_t unit_at (const std::array< IndexType, NumDimensions > &coords) const
 Convert given coordinate in pattern to its assigned unit id. More...
 
team_unit_t unit_at (IndexType global_pos, const ViewSpec_t &viewspec) const
 Convert given global linear index to its assigned unit id. More...
 
team_unit_t unit_at (IndexType global_pos) const
 Convert given global linear index to its assigned unit id. More...
 
SizeType extent (dim_t dim) const
 extent More...
 
SizeType local_extent (dim_t dim) const
 The actual number of elements in this pattern that are local to the calling unit in the given dimension. More...
 
std::array< SizeType, NumDimensions > local_extents () const
 The actual number of elements in this pattern that are local to the given unit, by dimension. More...
 
IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
 local More...
 
IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords) const
 Convert given local coordinates to linear local offset (index). More...
 
local_coords_t local (const std::array< IndexType, NumDimensions > &global_coords) const
 Converts global coordinates to their associated unit and its respective local coordinates. More...
 
local_index_t local (IndexType g_index) const
 Converts global index to its associated unit and respective local index. More...
 
std::array< IndexType, NumDimensions > local_coords (const std::array< IndexType, NumDimensions > &global_coords) const
 Converts global coordinates to their associated unit's respective local coordinates. More...
 
local_index_t local_index (const std::array< IndexType, NumDimensions > &global_coords) const
 Resolves the unit and the local index from global coordinates. More...
 
std::array< IndexType, NumDimensions > global (team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
 global More...
 
std::array< IndexType, NumDimensions > global (const std::array< IndexType, NumDimensions > &local_coords) const
 Converts local coordinates of a active unit to global coordinates. More...
 
IndexType global (IndexType local_index) const
 Resolve an element's linear global index from the calling unit's local index of that element. More...
 
IndexType global_index (team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
 Resolve an element's linear global index from a given unit's local coordinates of that element. More...
 
IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
 Global coordinates and viewspec to global position in the pattern's iteration order. More...
 
IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords) const
 Global coordinates to global position in the pattern's iteration order. More...
 
IndexType at (const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
 at More...
 
IndexType at (std::array< IndexType, NumDimensions > global_coords) const
 Global coordinates to local index. More...
 
template<typename ... Values>
IndexType at (Values ... values) const
 Global coordinates to local index. More...
 
bool has_local_elements (dim_t dim, IndexType dim_offset, team_unit_t unit, const ViewSpec_t &viewspec) const
 is_local More...
 
bool is_local (IndexType index, team_unit_t unit) const
 Whether the given global index is local to the specified unit. More...
 
bool is_local (IndexType index) const
 Whether the given global index is local to the unit that created this pattern instance. More...
 
index_type block_at (const std::array< index_type, NumDimensions > &g_coords) const
 block More...
 
local_index_t local_block_at (const std::array< index_type, NumDimensions > &g_coords) const
 Unit and local block index at given global coordinates. More...
 
ViewSpec_t block (index_type global_block_index) const
 View spec (offset and extents) of block at global linear block index in global cartesian element space. More...
 
ViewSpec_t local_block (index_type local_block_index) const
 View spec (offset and extents) of block at local linear block index in global cartesian element space. More...
 
ViewSpec_t local_block_local (index_type local_block_index) const
 View spec (offset and extents) of block at local linear block index in local cartesian element space. More...
 
const BlockSpec_tblockspec () const
 Cartesian arrangement of pattern blocks. More...
 
const BlockSpec_tlocal_blockspec () const
 Cartesian arrangement of pattern blocks. More...
 
SizeType blocksize (dim_t dimension) const
 Maximum number of elements in a single block in the given dimension. More...
 
SizeType max_blocksize () const
 Maximum number of elements in a single block in all dimensions. More...
 
SizeType local_capacity () const
 Maximum number of elements assigned to a single unit in total, equivalent to the local capacity of every unit in this pattern. More...
 
SizeType local_size (team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
 The actual number of elements in this pattern that are local to the calling unit in total. More...
 
IndexType num_units () const
 The number of units to which this pattern's elements are mapped. More...
 
IndexType capacity () const
 The maximum number of elements arranged in this pattern. More...
 
IndexType size () const
 The number of elements arranged in this pattern. More...
 
dash::Teamteam () const
 The Team containing the units to which this pattern's elements are mapped. More...
 
const DistributionSpec_tdistspec () const
 Distribution specification of this pattern. More...
 
SizeSpec_t sizespec () const
 Size specification of the index space mapped by this pattern. More...
 
const std::array< SizeType, NumDimensions > & extents () const
 Size specification of the index space mapped by this pattern. More...
 
const TeamSpec_tteamspec () const
 Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped. More...
 
std::array< IndexType, NumDimensions > coords (IndexType index) const
 Convert given global linear offset (index) to global cartesian coordinates. More...
 
std::array< IndexType, NumDimensions > coords (IndexType index, const ViewSpec_t &viewspec) const
 Convert given global linear offset (index) to global cartesian coordinates using viewspec. More...
 

Static Public Member Functions

static constexpr MemArrange memory_order ()
 Memory order followed by the pattern. More...
 
static constexpr dim_t ndim ()
 Number of dimensions of the cartesian space partitioned by the pattern. More...
 

Static Public Attributes

static constexpr char const * PatternName = "ShiftTilePattern"
 

Detailed Description

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
class dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >

Defines how a list of global indices is mapped to single units within a Team.

Expects extent[d] to be a multiple of (blocksize[d] * nunits[d]) to ensure the balanced property.

Template Parameters
NumDimensionsThe number of dimensions of the pattern
ArrangementThe memory order of the pattern (ROW_MAJOR or COL_MAJOR), defaults to ROW_MAJOR. Memory order defines how elements in the pattern will be iterated predominantly
See also
MemArrange
Implemented concept:
Pattern Concept
Examples:
ex.06.pattern-block-visualizer/main.cpp.

Definition at line 46 of file ShiftTilePattern.h.

Member Typedef Documentation

◆ layout_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linear > dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::layout_properties

Satisfiable properties in pattern property category Layout:

Definition at line 75 of file ShiftTilePattern.h.

◆ mapping_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_mapping_properties< pattern_mapping_tag::balanced, pattern_mapping_tag::unbalanced, pattern_mapping_tag::diagonal > dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::mapping_properties

Satisfiable properties in pattern property category Mapping:

Definition at line 67 of file ShiftTilePattern.h.

◆ partitioning_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_partitioning_properties< pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balanced > dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::partitioning_properties

Satisfiable properties in pattern property category Partitioning:

Definition at line 58 of file ShiftTilePattern.h.

Constructor & Destructor Documentation

◆ ShiftTilePattern() [1/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
template<typename ... Args>
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ShiftTilePattern ( SizeType  arg,
Args &&...  args 
)
inline

Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
ShiftTilePattern p1(10,20);
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
Parameters
argArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.
argsArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.

Definition at line 189 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

198  : ShiftTilePattern(PatternArguments_t(arg, args...)) {
199  DASH_LOG_TRACE("ShiftTilePattern()", "Constructor with Argument list");
200  initialize_local_range();
201  }
ShiftTilePattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...

◆ ShiftTilePattern() [2/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ShiftTilePattern ( const SizeSpec_t sizespec,
DistributionSpec_t  dist,
TeamSpec_t  teamspec,
dash::Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team.

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
ShiftTilePattern p1(10,20);
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
Parameters
sizespecShiftTilePattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of all dimensions.
teamspecCartesian arrangement of units within the team
teamTeam containing units to which this pattern maps its elements

Definition at line 236 of file ShiftTilePattern.h.

247  : _distspec(std::move(dist))
248  , _team(&team)
249  ,
250  // Degrading to 1-dimensional team spec for now:
251  // _teamspec(_distspec, *_team),
252  // _teamspec(
253  // teamspec,
254  // _distspec,
255  // *_team),
256  _teamspec(std::move(teamspec))
257  , _memory_layout(sizespec.extents())
258  , _nunits(_teamspec.size())
259  , _major_tiled_dim(initialize_major_tiled_dim(_distspec))
260  , _minor_tiled_dim((_major_tiled_dim + 1) % NumDimensions)
261  , _blocksize_spec(
262  initialize_blocksizespec(sizespec, _distspec, _teamspec))
263  , _blockspec(initialize_blockspec(sizespec, _blocksize_spec, _teamspec))
264  , _local_blockspec(
265  initialize_local_blockspec(_blockspec, _major_tiled_dim, _nunits))
266  , _local_memory_layout(initialize_local_extents(_team->myid()))
267  , _local_capacity(initialize_local_capacity())
268  {
269  DASH_LOG_TRACE("ShiftTilePattern()", "(sizespec, dist, teamspec, team)");
270  initialize_local_range();
271  }
const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:171

◆ ShiftTilePattern() [3/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ShiftTilePattern ( const SizeSpec_t sizespec,
DistributionSpec_t  dist = DistributionSpec_t(),
Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and a Team.

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
ShiftTilePattern p1(10,20);
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
ShiftTilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
Parameters
sizespecShiftTilePattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of all dimensions. Defaults to BLOCKED in first, and NONE in higher dimensions
teamTeam containing units to which this pattern maps its elements

Definition at line 306 of file ShiftTilePattern.h.

316  : _distspec(std::move(dist))
317  , _team(&team)
318  , _teamspec(_distspec, *_team)
319  , _memory_layout(sizespec.extents())
320  , _nunits(_teamspec.size())
321  , _major_tiled_dim(initialize_major_tiled_dim(_distspec))
322  , _minor_tiled_dim((_major_tiled_dim + 1) % NumDimensions)
323  , _blocksize_spec(
324  initialize_blocksizespec(sizespec, _distspec, _teamspec))
325  , _blockspec(initialize_blockspec(sizespec, _blocksize_spec, _teamspec))
326  , _local_blockspec(
327  initialize_local_blockspec(_blockspec, _major_tiled_dim, _nunits))
328  , _local_memory_layout(initialize_local_extents(_team->myid()))
329  , _local_capacity(initialize_local_capacity())
330  {
331  DASH_LOG_TRACE("ShiftTilePattern()", "(sizespec, dist, team)");
332  initialize_local_range();
333  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:171

◆ ShiftTilePattern() [4/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ShiftTilePattern ( const self_t other)
inline

Copy constructor.

Definition at line 338 of file ShiftTilePattern.h.

339  : _distspec(other._distspec),
340  _team(other._team),
341  _teamspec(other._teamspec),
342  _memory_layout(other._memory_layout),
343  _nunits(other._nunits),
344  _major_tiled_dim(other._major_tiled_dim),
345  _minor_tiled_dim(other._minor_tiled_dim),
346  _blocksize_spec(other._blocksize_spec),
347  _blockspec(other._blockspec),
348  _local_blockspec(other._local_blockspec),
349  _local_memory_layout(other._local_memory_layout),
350  _local_capacity(other._local_capacity),
351  _lbegin(other._lbegin),
352  _lend(other._lend) {
353  }

◆ ShiftTilePattern() [5/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ShiftTilePattern ( self_t other)
inline

Copy constructor using non-const lvalue reference parameter.

Introduced so variadic constructor is not a better match for copy-construction.

Definition at line 361 of file ShiftTilePattern.h.

362  : ShiftTilePattern(static_cast<const self_t &>(other)) {
363  }
ShiftTilePattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...

Member Function Documentation

◆ at() [1/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::at ( const std::array< IndexType, NumDimensions > &  global_coords,
const ViewSpec_t viewspec 
) const
inline

at

Global coordinates and viewspec to local index.

NOTE: Expects extent[d] to be a multiple of blocksize[d] * nunits[d] to ensure the balanced property.

See also
global_at
Pattern Concept

Definition at line 954 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::at().

957  {
958  DASH_LOG_TRACE("ShiftTilePattern.at()",
959  "gcoords:", global_coords,
960  "viewspec:", viewspec);
961  // Phase coordinates of element:
962  std::array<IndexType, NumDimensions> phase_coords;
963  // Coordinates of the block containing the element:
964  std::array<IndexType, NumDimensions> block_coords;
965  for (auto d = 0; d < NumDimensions; ++d) {
966  auto vs_coord = global_coords[d] + viewspec.offset(d);
967  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
968  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
969  }
970  DASH_LOG_TRACE("ShiftTilePattern.at",
971  "block_coords:", block_coords,
972  "phase_coords:", phase_coords);
973  // Number of blocks preceeding the coordinates' block, equivalent
974  // to linear global block offset divided by team size:
975  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", _blockspec.extents());
976  auto block_index = _blockspec.at(block_coords);
977  auto block_index_l = block_index / _nunits;
978  DASH_LOG_TRACE("ShiftTilePattern.at",
979  "global block index:",block_index,
980  "nunits:", _nunits,
981  "local block index:", block_index_l);
982  auto offset = block_index_l * _blocksize_spec.size() + // preceed. blocks
983  _blocksize_spec.at(phase_coords); // element phase
984  DASH_LOG_TRACE_VAR("ShiftTilePattern.at >", offset);
985  return offset;
986  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ at() [2/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::at ( std::array< IndexType, NumDimensions >  global_coords) const
inline

Global coordinates to local index.

Convert given global coordinates in pattern to their respective linear local index.

See also
Pattern Concept

Definition at line 996 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

998  {
999  // Note:
1000  // Expects extent[d] to be a multiple of blocksize[d] * nunits[d]
1001  // to ensure the balanced property.
1002  DASH_LOG_TRACE_VAR("ShiftTilePattern.at()", global_coords);
1003  // Phase coordinates of element:
1004  std::array<IndexType, NumDimensions> phase_coords{};
1005  // Coordinates of the block containing the element:
1006  std::array<IndexType, NumDimensions> block_coords{};
1007  for (auto d = 0; d < NumDimensions; ++d) {
1008  auto coord = global_coords[d];
1009  phase_coords[d] = coord % _blocksize_spec.extent(d);
1010  block_coords[d] = coord / _blocksize_spec.extent(d);
1011  }
1012  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", block_coords);
1013  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", phase_coords);
1014  // Number of blocks preceeding the coordinates' block, equivalent
1015  // to linear global block offset divided by team size:
1016  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", _blockspec.extents());
1017  auto block_offset = _blockspec.at(block_coords);
1018  auto block_offset_l = block_offset / _nunits;
1019  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", block_offset);
1020  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", _nunits);
1021  DASH_LOG_TRACE_VAR("ShiftTilePattern.at", block_offset_l);
1022  return block_offset_l * _blocksize_spec.size() + // preceeding blocks
1023  _blocksize_spec.at(phase_coords); // element phase
1024  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ at() [3/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
template<typename ... Values>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::at ( Values ...  values) const
inline

Global coordinates to local index.

Convert given coordinate in pattern to its linear local index.

See also
Pattern Concept

Definition at line 1034 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::at().

1035  {
1036  static_assert(
1037  sizeof...(values) == NumDimensions,
1038  "Wrong parameter number");
1039  std::array<IndexType, NumDimensions> inputindex = {
1040  (IndexType)values...
1041  };
1042  return at(inputindex);
1043  }
IndexType at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
at

◆ block()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::block ( index_type  global_block_index) const
inline

View spec (offset and extents) of block at global linear block index in global cartesian element space.

Definition at line 1156 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::extents().

1158  {
1159  DASH_LOG_TRACE_VAR("ShiftTilePattern.block()", global_block_index);
1160  // block index -> block coords -> offset
1161  auto block_coords = _blockspec.coords(global_block_index);
1162  DASH_LOG_TRACE_VAR("ShiftTilePattern.block", block_coords);
1163  DASH_LOG_TRACE_VAR("ShiftTilePattern.block", _blocksize_spec.extents());
1164  std::array<index_type, NumDimensions> offsets{};
1165  std::array<size_type, NumDimensions> extents{};
1166  for (auto d = 0; d < NumDimensions; ++d) {
1167  extents[d] = _blocksize_spec.extent(d);
1168  offsets[d] = block_coords[d] * extents[d];
1169  }
1170  DASH_LOG_TRACE("ShiftTilePattern.block",
1171  "offsets:", offsets,
1172  "extents:", extents);
1173  auto block_vs = ViewSpec_t(offsets, extents);
1174  DASH_LOG_TRACE_VAR("ShiftTilePattern.block >", block_vs);
1175  return block_vs;
1176  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ block_at()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
index_type dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

block

Index of block at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 1121 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

1124  {
1125  std::array<index_type, NumDimensions> block_coords;
1126  // Coord to block coord to unit coord:
1127  for (auto d = 0; d < NumDimensions; ++d) {
1128  block_coords[d] = g_coords[d] / _blocksize_spec.extent(d);
1129  }
1130  // Block coord to block index:
1131  auto block_idx = _blockspec.at(block_coords);
1132  DASH_LOG_TRACE("ShiftTilePattern.block_at",
1133  "coords", g_coords,
1134  "> block index", block_idx);
1135  return block_idx;
1136  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429

◆ blocksize()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::blocksize ( dim_t  dimension) const
inline

Maximum number of elements in a single block in the given dimension.

Returns
The blocksize in the given dimension
See also
Pattern Concept
Parameters
dimensionThe dimension in the pattern

Definition at line 1272 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

1274  {
1275  return _blocksize_spec.extent(dimension);
1276  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ blockspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
const BlockSpec_t& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::blockspec ( ) const
inline

Cartesian arrangement of pattern blocks.

Definition at line 1252 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

1253  {
1254  return _blockspec;
1255  }

◆ capacity()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::capacity ( ) const
inline

The maximum number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1332 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1332  {
1333  return _memory_layout.size();
1334  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ coords() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::coords ( IndexType  index) const
inline

Convert given global linear offset (index) to global cartesian coordinates.

See also
Pattern Concept
Parameters
indexGlobal index (offset) to convert

Definition at line 1394 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local().

1396  {
1397 
1398  ::std::array<IndexType, NumDimensions> pos{};
1399  auto block_coords = _blockspec.coords(index / _blocksize_spec.size());
1400  auto phase_coords = _blocksize_spec.coords(index % _blocksize_spec.size());
1401  for (auto d = 0; d < NumDimensions; ++d) {
1402  pos[d] = block_coords[d]*_blocksize_spec.extent(d) + phase_coords[d];
1403  }
1404  return pos;
1405  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ coords() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::coords ( IndexType  index,
const ViewSpec_t viewspec 
) const
inline

Convert given global linear offset (index) to global cartesian coordinates using viewspec.

See also
Pattern Concept
Parameters
indexGlobal index (offset) to convert
viewspecView specification (offsets) to apply on coords

Definition at line 1413 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1417  {
1418 
1419  ::std::array<IndexType, NumDimensions> pos;
1420  auto block_coords = _blockspec.coords(index / _blocksize_spec.size(),
1421  viewspec);
1422  auto phase_coords = _blocksize_spec.coords(index % _blocksize_spec.size(),
1423  viewspec);
1424  for (auto d = 0; d < NumDimensions; ++d) {
1425  pos[d] = block_coords[d]*_blocksize_spec.extent(d) + phase_coords[d];
1426  }
1427  return pos;
1428  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ distspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
const DistributionSpec_t& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::distspec ( ) const
inline

Distribution specification of this pattern.

Definition at line 1356 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

1356  {
1357  return _distspec;
1358  }

◆ extent()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::extent ( dim_t  dim) const
inline

extent

The number of elements in this pattern in the given dimension.

See also
blocksize()
local_size()
local_extent()
Pattern Concept

Definition at line 535 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

535  {
536  if (dim >= NumDimensions || dim < 0) {
537  DASH_THROW(
539  "Wrong dimension for ShiftTilePattern::local_extent. "
540  << "Expected dimension between 0 and " << NumDimensions-1 << ", "
541  << "got " << dim);
542  }
543  return _memory_layout.extent(dim);
544  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ extents()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
const std::array<SizeType, NumDimensions>& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::extents ( ) const
inline

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1374 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::block(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block_local().

1374  {
1375  return _memory_layout.extents();
1376  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ global() [1/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global ( team_unit_t  unit,
const std::array< IndexType, NumDimensions > &  local_coords 
) const
inline

global

Converts local coordinates of a given unit to global coordinates.

See also
Pattern Concept

Definition at line 747 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

749  {
750  DASH_LOG_DEBUG("ShiftTilePattern.global()",
751  "unit:", unit,
752  "lcoords:", local_coords);
753  // Global coordinate of local element:
754  std::array<IndexType, NumDimensions> global_coords = local_coords;
755  // Local block coordinate of local element:
756  auto blocksize_maj = _blocksize_spec.extent(_major_tiled_dim);
757  auto blocksize_min = _blocksize_spec.extent(_minor_tiled_dim);
758  auto l_block_coord_maj = local_coords[_major_tiled_dim] /
759  blocksize_maj;
760  auto l_block_coord_min = (NumDimensions > 1)
761  ? local_coords[_minor_tiled_dim] /
762  blocksize_min
763  : 0;
764  DASH_LOG_TRACE("ShiftTilePattern.global",
765  "minor tiled dim:", _minor_tiled_dim,
766  "major tiled dim:", _major_tiled_dim,
767  "l_block_coord_min:", l_block_coord_min,
768  "l_block_coord_maj:", l_block_coord_maj);
769  // Apply diagonal shift in major tiled dimension:
770  auto num_shift_blocks = (_nunits + unit -
771  (l_block_coord_min % _nunits))
772  % _nunits;
773  num_shift_blocks += _nunits * l_block_coord_maj;
774  DASH_LOG_TRACE("ShiftTilePattern.global",
775  "num_shift_blocks:", num_shift_blocks,
776  "blocksize_maj:", blocksize_maj);
777  global_coords[_major_tiled_dim] =
778  (num_shift_blocks * blocksize_maj) +
779  local_coords[_major_tiled_dim] % blocksize_maj;
780  DASH_LOG_DEBUG_VAR("ShiftTilePattern.global >", global_coords);
781  return global_coords;
782  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ global() [2/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global ( const std::array< IndexType, NumDimensions > &  local_coords) const
inline

Converts local coordinates of a active unit to global coordinates.

See also
Pattern Concept

Definition at line 789 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_coords().

791  {
792  return global(_team->myid(), local_coords);
793  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ global() [3/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global ( IndexType  local_index) const
inline

Resolve an element's linear global index from the calling unit's local index of that element.

See also
at Inverse of global()
Pattern Concept

Definition at line 803 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global_at(), dash::myid(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::team().

805  {
806  DASH_LOG_TRACE("ShiftTilePattern.global()",
807  "local_index:", local_index,
808  "unit:", team().myid());
809  auto block_size = _blocksize_spec.size();
810  auto phase = local_index % block_size;
811  auto l_block_index = local_index / block_size;
812  // Block coordinate in local memory:
813  auto l_block_coord = _local_blockspec.coords(l_block_index);
814  // Coordinate of element in block:
815  auto phase_coord = _blocksize_spec.coords(phase);
816  DASH_LOG_TRACE("ShiftTilePattern.global",
817  "local block index:", l_block_index,
818  "local block coords:", l_block_coord,
819  "phase coords:", phase_coord);
820  // Coordinate of element in local memory:
821  std::array<IndexType, NumDimensions> l_coords{};
822  for (auto d = 0; d < NumDimensions; ++d) {
823  l_coords[d] = l_block_coord[d] * _blocksize_spec.extent(d) +
824  phase_coord[d];
825  }
826  std::array<IndexType, NumDimensions> g_coords =
827  global(team().myid(), l_coords);
828  auto offset = global_at(g_coords);
829  DASH_LOG_TRACE_VAR("ShiftTilePattern.global >", offset);
830  return offset;
831  }
IndexType global_at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
Global coordinates and viewspec to global position in the pattern&#39;s iteration order.
global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.

◆ global_at() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords,
const ViewSpec_t viewspec 
) const
inline

Global coordinates and viewspec to global position in the pattern's iteration order.

NOTE: Expects extent[d] to be a multiple of blocksize[d] * nunits[d] to ensure the balanced property.

See also
at
local_at
Pattern Concept

Definition at line 869 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global().

872  {
873  DASH_LOG_TRACE("ShiftTilePattern.global_at()",
874  "gcoords:", global_coords,
875  "viewspec:", viewspec);
876  // Phase coordinates of element:
877  std::array<IndexType, NumDimensions> phase_coords{};
878  // Coordinates of the block containing the element:
879  std::array<IndexType, NumDimensions> block_coords{};
880  for (auto d = 0; d < NumDimensions; ++d) {
881  auto vs_coord = global_coords[d] + viewspec.offset(d);
882  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
883  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
884  }
885  DASH_LOG_TRACE("ShiftTilePattern.global_at",
886  "block coords:", block_coords,
887  "phase coords:", phase_coords);
888  // Number of blocks preceeding the coordinates' block, equivalent
889  // to linear global block offset:
890  auto block_index = _blockspec.at(block_coords);
891  DASH_LOG_TRACE("ShiftTilePattern.global_at",
892  "block index:", block_index);
893  auto offset = block_index * _blocksize_spec.size() + // preceed. blocks
894  _blocksize_spec.at(phase_coords); // element phase
895  DASH_LOG_TRACE_VAR("ShiftTilePattern.global_at >", offset);
896  return offset;
897  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ global_at() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Global coordinates to global position in the pattern's iteration order.

NOTE: Expects extent[d] to be a multiple of blocksize[d] * nunits[d] to ensure the balanced property.

See also
at
local_at
Pattern Concept

Definition at line 911 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

913  {
914  DASH_LOG_TRACE("ShiftTilePattern.global_at()",
915  "gcoords:", global_coords);
916  // Phase coordinates of element:
917  std::array<IndexType, NumDimensions> phase_coords;
918  // Coordinates of the block containing the element:
919  std::array<IndexType, NumDimensions> block_coords;
920  for (auto d = 0; d < NumDimensions; ++d) {
921  auto vs_coord = global_coords[d];
922  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
923  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
924  }
925  DASH_LOG_TRACE("ShiftTilePattern.global_at",
926  "block coords:", block_coords,
927  "phase coords:", phase_coords);
928  // Number of blocks preceeding the coordinates' block, equivalent
929  // to linear global block offset:
930  auto block_index = _blockspec.at(block_coords);
931  DASH_LOG_TRACE("ShiftTilePattern.global_at",
932  "block index:", block_index);
933  auto offset = block_index * _blocksize_spec.size() + // preceed. blocks
934  _blocksize_spec.at(phase_coords); // element phase
935  DASH_LOG_TRACE_VAR("ShiftTilePattern.global_at >", offset);
936  return offset;
937  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ global_index()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global_index ( team_unit_t  unit,
const std::array< IndexType, NumDimensions > &  local_coords 
) const
inline

Resolve an element's linear global index from a given unit's local coordinates of that element.

See also
at
global_at
Pattern Concept

Definition at line 842 of file ShiftTilePattern.h.

845  {
846  DASH_LOG_TRACE("ShiftTilePattern.global_index()",
847  "unit:", unit,
848  "local_coords:", local_coords);
849  std::array<IndexType, NumDimensions> global_coords =
850  global(unit, local_coords);
851  auto g_index = global_at(global_coords);
852  DASH_LOG_TRACE_VAR("ShiftTilePattern.global_index >", g_index);
853  return g_index;
854  }
IndexType global_at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
Global coordinates and viewspec to global position in the pattern&#39;s iteration order.
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ has_local_elements()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::has_local_elements ( dim_t  dim,
IndexType  dim_offset,
team_unit_t  unit,
const ViewSpec_t viewspec 
) const
inline

is_local

Whether there are local elements in a dimension at a given offset, e.g. in a specific row or column.

See also
Pattern Concept
Parameters
dimDimension to check
dim_offsetOffset in dimension
unitteam-local id of the unit
viewspecViewspec to apply

Definition at line 1055 of file ShiftTilePattern.h.

1064  {
1065  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements()", dim);
1066  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements()", dim_offset);
1067  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements()", unit);
1068  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements()", viewspec);
1069  // Apply viewspec offset in dimension to given position
1070  dim_offset += viewspec.offset(dim);
1071  // Offset to block offset
1072  IndexType block_coord_d = dim_offset / _blocksize_spec.extent(dim);
1073  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements", block_coord_d);
1074  // Coordinate of unit in team spec in given dimension
1075  IndexType teamspec_coord_d = block_coord_d % _teamspec.extent(dim);
1076  DASH_LOG_TRACE_VAR("ShiftTilePattern.has_local_elements",
1077  teamspec_coord_d);
1078  // Check if unit id lies in cartesian sub-space of team spec
1079  return _teamspec.includes_index(
1080  teamspec_coord_d,
1081  dim,
1082  dim_offset);
1083  }
bool includes_index(IndexType index, dim_t dimension, IndexType dim_offset) const
Whether the given index lies in the cartesian sub-space specified by a dimension and offset in the di...
Definition: TeamSpec.h:385
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ is_local() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::is_local ( IndexType  index,
team_unit_t  unit 
) const
inline

Whether the given global index is local to the specified unit.

See also
Pattern Concept

Definition at line 1090 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::is_local().

1093  {
1094  auto glob_coords = coords(index);
1095  auto coords_unit = unit_at(glob_coords);
1096  DASH_LOG_TRACE_VAR("ShiftTilePattern.is_local >", (coords_unit == unit));
1097  return coords_unit == unit;
1098  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ is_local() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::is_local ( IndexType  index) const
inline

Whether the given global index is local to the unit that created this pattern instance.

See also
Pattern Concept

Definition at line 1106 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::is_local(), dash::myid(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::team().

1108  {
1109  return is_local(index, team().myid());
1110  }
global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
bool is_local(IndexType index, team_unit_t unit) const
Whether the given global index is local to the specified unit.
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.

◆ lbegin()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::lbegin ( ) const
inline

Resolves the global index of the first local element in the pattern.

See also
Pattern Concept

Definition at line 425 of file ShiftTilePattern.h.

425  {
426  return _lbegin;
427  }

◆ lend()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::lend ( ) const
inline

Resolves the global index past the last local element in the pattern.

See also
Pattern Concept

Definition at line 434 of file ShiftTilePattern.h.

434  {
435  return _lend;
436  }

◆ local() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_coords_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Converts global coordinates to their associated unit and its respective local coordinates.

TODO: Unoptimized

See also
Pattern Concept

Definition at line 667 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_coords(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

669  {
670  local_coords_t l_coords;
671  l_coords.coords = local_coords(global_coords);
672  l_coords.unit = unit_at(global_coords);
673  return l_coords;
674  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ local() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_index_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local ( IndexType  g_index) const
inline

Converts global index to its associated unit and respective local index.

TODO: Unoptimized

See also
Pattern Concept

Definition at line 683 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::coords(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_index().

685  {
686  DASH_LOG_TRACE_VAR("ShiftTilePattern.local()", g_index);
687  // TODO: Implement dedicated method for this, conversion to/from
688  // global coordinates is expensive.
689  auto g_coords = coords(g_index);
690  return local_index(g_coords);
691  }
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.

◆ local_at() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_at ( const std::array< IndexType, NumDimensions > &  local_coords,
const ViewSpec_t viewspec 
) const
inline

local

Convert given local coordinates and viewspec to linear local offset (index).

See also
Pattern Concept
Parameters
local_coordsPoint in local memory
viewspecView specification (local offsets) to apply on local_coords

Definition at line 594 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_index(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

599  {
600  DASH_LOG_TRACE("ShiftTilePattern.local_at()", local_coords,
601  "view:", viewspec,
602  "local blocks:", _local_blockspec.extents());
603  // Phase coordinates of element:
604  std::array<IndexType, NumDimensions> phase_coords{};
605  // Coordinates of the local block containing the element:
606  std::array<IndexType, NumDimensions> block_coords_l{};
607  for (auto d = 0; d < NumDimensions; ++d) {
608  auto vs_offset_d = viewspec.offset(d);
609  auto vs_coord_d = local_coords[d] + vs_offset_d;
610  auto block_size_d = _blocksize_spec.extent(d);
611  phase_coords[d] = vs_coord_d % block_size_d;
612  block_coords_l[d] = vs_coord_d / block_size_d;
613  }
614  DASH_LOG_TRACE("ShiftTilePattern.local_at",
615  "local block coords:", block_coords_l,
616  "phase coords:", phase_coords);
617  // Number of blocks preceeding the coordinates' block:
618  auto block_offset_l = _local_blockspec.at(block_coords_l);
619  auto local_index =
620  block_offset_l * _blocksize_spec.size() + // preceeding blocks
621  _blocksize_spec.at(phase_coords); // element phase
622  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_at >", local_index);
623  return local_index;
624  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.

◆ local_at() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_at ( const std::array< IndexType, NumDimensions > &  local_coords) const
inline

Convert given local coordinates to linear local offset (index).

See also
Pattern Concept
Parameters
local_coordsPoint in local memory

Definition at line 631 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_index(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

634  {
635  DASH_LOG_TRACE("ShiftTilePattern.local_at()", local_coords,
636  "local blocks:", _local_blockspec.extents());
637  // Phase coordinates of element:
638  std::array<IndexType, NumDimensions> phase_coords{};
639  // Coordinates of the local block containing the element:
640  std::array<IndexType, NumDimensions> block_coords_l{};
641  for (auto d = 0; d < NumDimensions; ++d) {
642  auto vs_coord_d = local_coords[d];
643  auto block_size_d = _blocksize_spec.extent(d);
644  phase_coords[d] = vs_coord_d % block_size_d;
645  block_coords_l[d] = vs_coord_d / block_size_d;
646  }
647  DASH_LOG_TRACE("ShiftTilePattern.local_at",
648  "local block coords:", block_coords_l,
649  "phase coords:", phase_coords);
650  // Number of blocks preceeding the coordinates' block:
651  auto block_offset_l = _local_blockspec.at(block_coords_l);
652  auto local_index =
653  block_offset_l * _blocksize_spec.size() + // preceeding blocks
654  _blocksize_spec.at(phase_coords); // element phase
655  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_at >", local_index);
656  return local_index;
657  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.

◆ local_block()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block ( index_type  local_block_index) const
inline

View spec (offset and extents) of block at local linear block index in global cartesian element space.

Definition at line 1182 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::extents(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global().

1183  {
1184  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block()", local_block_index);
1185  // Local block index to local block coords:
1186  auto l_block_coords = _local_blockspec.coords(local_block_index);
1187  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block()", l_block_coords);
1188  std::array<index_type, NumDimensions> l_elem_coords{};
1189  // TODO: This is convenient but less efficient:
1190  // Translate local coordinates of first element in local block to global
1191  // coordinates:
1192  for (auto d = 0; d < NumDimensions; ++d) {
1193  auto blocksize_d = _blocksize_spec.extent(d);
1194  l_elem_coords[d] = static_cast<index_type>(
1195  l_block_coords[d] * blocksize_d);
1196  }
1197  // Global coordinates of first element in block:
1198  auto g_elem_coords = global(l_elem_coords);
1199  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block()", g_elem_coords);
1200  std::array<index_type, NumDimensions> offsets{};
1201  std::array<size_type, NumDimensions> extents{};
1202  for (auto d = 0; d < NumDimensions; ++d) {
1203  offsets[d] = g_elem_coords[d];
1204  extents[d] = _blocksize_spec.extent(d);
1205  }
1206  ViewSpec_t block_vs(offsets, extents);
1207  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block >", block_vs);
1208 #ifdef __TODO__
1209  // Coordinates of the unit within the team spec:
1210  std::array<IndexType, NumDimensions> unit_ts_coord =
1211  _teamspec.coords(unit);
1212  for (auto d = 0; d < NumDimensions; ++d) {
1213  const Distribution & dist = _distspec[d];
1214  auto blocksize_d = block_vs[d].extent;
1215  auto num_units_d = _teamspec.extent(d);
1216  auto num_blocks_d = _blockspec.extent(d);
1217  // Local to global block coords:
1218  auto g_block_coord_d = (l_block_coords[d] + _myid) *
1219  _teamspec.extent(d);
1220  block_vs[d].offset = g_block_coord_d * blocksize_d;
1221  }
1222 #endif
1223  return block_vs;
1224  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ local_block_at()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_index_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

Unit and local block index at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 1143 of file ShiftTilePattern.h.

1146  {
1147  DASH_THROW(
1149  "ShiftTilePattern.local_block_at is not implemented");
1150  }

◆ local_block_local()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_block_local ( index_type  local_block_index) const
inline

View spec (offset and extents) of block at local linear block index in local cartesian element space.

Definition at line 1230 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::extents().

1231  {
1232  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block_local()", local_block_index);
1233  // Initialize viewspec result with block extents:
1234  std::array<index_type, NumDimensions> offsets{};
1235  std::array<size_type, NumDimensions> extents =
1236  _blocksize_spec.extents();
1237  // Local block index to local block coords:
1238  auto l_block_coords = _local_blockspec.coords(local_block_index);
1239  // Local block coords to local element offset:
1240  for (auto d = 0; d < NumDimensions; ++d) {
1241  auto blocksize_d = extents[d];
1242  offsets[d] = l_block_coords[d] * blocksize_d;
1243  }
1244  ViewSpec_t block_vs(offsets, extents);
1245  DASH_LOG_TRACE_VAR("ShiftTilePattern.local_block >", block_vs);
1246  return block_vs;
1247  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ local_blockspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
const BlockSpec_t& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_blockspec ( ) const
inline

Cartesian arrangement of pattern blocks.

Definition at line 1260 of file ShiftTilePattern.h.

1261  {
1262  return _local_blockspec;
1263  }

◆ local_capacity()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_capacity ( ) const
inline

Maximum number of elements assigned to a single unit in total, equivalent to the local capacity of every unit in this pattern.

See also
Pattern Concept

Definition at line 1296 of file ShiftTilePattern.h.

References dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_size().

1296  {
1297  // Balanced pattern, local capacity identical for every unit and
1298  // same as local size.
1299  return local_size();
1300  }
SizeType local_size(team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
The actual number of elements in this pattern that are local to the calling unit in total...

◆ local_coords()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_coords ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Converts global coordinates to their associated unit's respective local coordinates.

See also
Pattern Concept

Definition at line 699 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local().

701  {
702  std::array<IndexType, NumDimensions> local_coords = global_coords;
703  auto blocksize_d = _blocksize_spec.extent(_major_tiled_dim);
704  auto coord_d = global_coords[_major_tiled_dim];
705  local_coords[_major_tiled_dim] =
706  // Local block offset
707  (coord_d / (blocksize_d * _nunits)) * blocksize_d +
708  // Phase
709  (coord_d % blocksize_d);
710  return local_coords;
711  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ local_extent()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_extent ( dim_t  dim) const
inline

The actual number of elements in this pattern that are local to the calling unit in the given dimension.

See also
local_extents()
blocksize()
local_size()
extent()
Pattern Concept

Definition at line 557 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

557  {
558  if (dim >= NumDimensions || dim < 0) {
559  DASH_THROW(
561  "Wrong dimension for ShiftTilePattern::local_extent. "
562  << "Expected dimension between 0 and " << NumDimensions-1 << ", "
563  << "got " << dim);
564  }
565  return _local_memory_layout.extent(dim);
566  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ local_extents()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<SizeType, NumDimensions> dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_extents ( ) const
inline

The actual number of elements in this pattern that are local to the given unit, by dimension.

See also
local_extent()
blocksize()
local_size()
extent()
Pattern Concept

Definition at line 579 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

579  {
580  // Same local memory layout for all units:
581  return _local_memory_layout.extents();
582  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ local_index()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_index_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_index ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Resolves the unit and the local index from global coordinates.

See also
Pattern Concept

Definition at line 718 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_at().

720  {
721  DASH_LOG_TRACE_VAR("Pattern.local_index()", global_coords);
722  // Local offset of the element within all of the unit's local
723  // elements:
724  auto unit = unit_at(global_coords);
725 #ifdef __OLD__
726  // Global coords to local coords:
727  std::array<IndexType, NumDimensions> l_coords =
728  local_coords(global_coords);
729  // Local coords to local offset:
730  auto l_index = local_at(l_coords);
731 #endif
732  auto l_index = at(global_coords);
733  DASH_LOG_TRACE_VAR("Pattern.local_index >", l_index);
734 
735  return local_index_t { team_unit_t(unit), l_index };
736  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
IndexType local_at(const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
local
IndexType at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
at
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ local_size()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_size ( team_unit_t  unit = UNDEFINED_TEAM_UNIT_ID) const
inline

The actual number of elements in this pattern that are local to the calling unit in total.

See also
blocksize()
local_extent()
local_capacity()
Pattern Concept

Definition at line 1312 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local_capacity(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

1314  {
1315  return _local_memory_layout.size();
1316  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ max_blocksize()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::max_blocksize ( ) const
inline

Maximum number of elements in a single block in all dimensions.

Returns
The maximum number of elements in a single block assigned to a unit.
See also
Pattern Concept

Definition at line 1286 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1286  {
1287  return _blocksize_spec.size();
1288  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ memory_order()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
static constexpr MemArrange dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::memory_order ( )
inlinestatic

Memory order followed by the pattern.

Definition at line 1433 of file ShiftTilePattern.h.

1433  {
1434  return Arrangement;
1435  }

◆ ndim()

◆ num_units()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::num_units ( ) const
inline

The number of units to which this pattern's elements are mapped.

See also
Pattern Concept

Definition at line 1323 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1323  {
1324  return _teamspec.size();
1325  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ operator!=()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::operator!= ( const self_t other) const
inline

Inquality comparison operator.

Parameters
otherShiftTilePattern instance to compare for inequality

Definition at line 390 of file ShiftTilePattern.h.

393  {
394  return !(*this == other);
395  }

◆ operator=()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ShiftTilePattern& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::operator= ( const ShiftTilePattern< NumDimensions, Arrangement, IndexType > &  other)
inline

Assignment operator.

Definition at line 400 of file ShiftTilePattern.h.

400  {
401  if (this != &other) {
402  _distspec = other._distspec;
403  _team = other._team;
404  _teamspec = other._teamspec;
405  _memory_layout = other._memory_layout;
406  _local_memory_layout = other._local_memory_layout;
407  _blocksize_spec = other._blocksize_spec;
408  _blockspec = other._blockspec;
409  _local_blockspec = other._local_blockspec;
410  _local_capacity = other._local_capacity;
411  _nunits = other._nunits;
412  _minor_tiled_dim = other._minor_tiled_dim;
413  _major_tiled_dim = other._major_tiled_dim;
414  _lbegin = other._lbegin;
415  _lend = other._lend;
416  }
417  return *this;
418  }

◆ operator==()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::operator== ( const self_t other) const
inline

Equality comparison operator.

Parameters
otherShiftTilePattern instance to compare for equality

Definition at line 368 of file ShiftTilePattern.h.

371  {
372  if (this == &other) {
373  return true;
374  }
375  // no need to compare all members as most are derived from
376  // constructor arguments.
377  return(
378  _distspec == other._distspec &&
379  _teamspec == other._teamspec &&
380  _memory_layout == other._memory_layout &&
381  _blockspec == other._blockspec &&
382  _blocksize_spec == other._blocksize_spec &&
383  _nunits == other._nunits
384  );
385  }

◆ size()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::size ( ) const
inline

The number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1341 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::ndim().

1341  {
1342  return _memory_layout.size();
1343  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ sizespec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeSpec_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::sizespec ( ) const
inline

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1365 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

1365  {
1366  return SizeSpec_t(_memory_layout.extents());
1367  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ team()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::Team& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::team ( ) const
inline

The Team containing the units to which this pattern's elements are mapped.

Definition at line 1349 of file ShiftTilePattern.h.

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::global(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::is_local().

1349  {
1350  return *_team;
1351  }

◆ teamspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
const TeamSpec_t& dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::teamspec ( ) const
inline

Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped.

See also
Pattern Concept

Definition at line 1384 of file ShiftTilePattern.h.

1384  {
1385  return _teamspec;
1386  }

◆ unit_at() [1/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( const std::array< IndexType, NumDimensions > &  coords,
const ViewSpec_t viewspec 
) const
inline

unit_at

Convert given point in pattern to its assigned unit id.

See also
Pattern Concept
Parameters
coordsAbsolute coordinates of the point relative to the given view.
viewspecView specification (offsets) of the coordinates.

Definition at line 447 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

Referenced by dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::local(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

452  {
453  DASH_LOG_TRACE("ShiftTilePattern.unit_at()",
454  "coords:", coords,
455  "viewspec:", viewspec);
456  // Unit id from diagonals in cartesian index space,
457  // e.g (x + y + z) % nunits
458  team_unit_t unit_id{0};
459  for (auto d = 0; d < NumDimensions; ++d) {
460  auto vs_coord = coords[d] + viewspec.offset(d);
461  // Global block coordinate:
462  auto block_coord = vs_coord / _blocksize_spec.extent(d);
463  unit_id += block_coord;
464  }
465  unit_id %= _nunits;
466  DASH_LOG_TRACE_VAR("ShiftTilePattern.unit_at >", unit_id);
467  return unit_id;
468  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.

◆ unit_at() [2/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( const std::array< IndexType, NumDimensions > &  coords) const
inline

Convert given coordinate in pattern to its assigned unit id.

See also
Pattern Concept

Definition at line 475 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

477  {
478  DASH_LOG_TRACE("ShiftTilePattern.unit_at()",
479  "coords:", coords,
480  "blocksize:", _blocksize_spec.extents());
481  // Unit id from diagonals in cartesian index space,
482  // e.g (x + y + z) % nunits
483  team_unit_t unit_id{0};
484  for (auto d = 0; d < NumDimensions; ++d) {
485  // Global block coordinate:
486  auto block_coord = coords[d] / _blocksize_spec.extent(d);
487  unit_id += block_coord;
488  }
489  unit_id %= _nunits;
490  DASH_LOG_TRACE_VAR("ShiftTilePattern.unit_at >", unit_id);
491  return unit_id;
492  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.

◆ unit_at() [3/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( IndexType  global_pos,
const ViewSpec_t viewspec 
) const
inline

Convert given global linear index to its assigned unit id.

See also
Pattern Concept
Parameters
global_posGlobal linear element offset
viewspecView to apply global position

Definition at line 499 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

504  {
505  auto global_coords = _memory_layout.coords(global_pos);
506  return unit_at(global_coords, viewspec);
507  }
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ unit_at() [4/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( IndexType  global_pos) const
inline

Convert given global linear index to its assigned unit id.

See also
Pattern Concept
Parameters
global_posGlobal linear element offset

Definition at line 514 of file ShiftTilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), and dash::ShiftTilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

517  {
518  auto global_coords = _memory_layout.coords(global_pos);
519  return unit_at(global_coords);
520  }
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

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