1 #ifndef DASH__LOAD_BALANCE_PATTERN_H__INCLUDED 2 #define DASH__LOAD_BALANCE_PATTERN_H__INCLUDED 8 #include <dash/Types.h> 9 #include <dash/Distribution.h> 10 #include <dash/Exception.h> 11 #include <dash/Dimensional.h> 12 #include <dash/Cartesian.h> 13 #include <dash/Team.h> 15 #include <dash/pattern/PatternProperties.h> 16 #include <dash/pattern/internal/PatternArguments.h> 18 #include <dash/util/TeamLocality.h> 19 #include <dash/util/LocalityDomain.h> 21 #include <dash/internal/Math.h> 22 #include <dash/internal/Logging.h> 40 const TeamLocality_t & tloc)
42 std::vector<double> unit_cpu_capacities;
45 for (
auto u : tloc.global_units()) {
46 auto unit_loc = tloc.unit_locality(u);
47 double unit_cpu_cap = unit_loc.num_cores() *
48 unit_loc.num_threads() *
51 unit_cpu_capacities.push_back(unit_cpu_cap);
53 double mean = sum / tloc.global_units().size();
55 unit_cpu_capacities.end(),
56 unit_cpu_capacities.begin(),
58 [&](
double v) {
return v / mean; });
59 return unit_cpu_capacities;
99 const TeamLocality_t & tloc)
101 std::vector<double> unit_mem_perc;
107 std::vector<size_t> unit_mem_capacities;
108 size_t total_mem_capacity = 0;
111 for (
auto u : tloc.units()) {
112 auto & unit_loc = tloc.unit_locality(u);
113 size_t unit_mem_cap = std::max<int>(0, unit_loc.max_shmem_mbps());
114 if (unit_mem_cap > 0) {
115 total_mem_capacity += unit_mem_cap;
117 unit_mem_capacities.push_back(unit_mem_cap);
119 if (total_mem_capacity == 0) {
120 total_mem_capacity = tloc.units().size();
122 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_mem_bandwidth_weights",
124 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_mem_bandwidth_weights",
125 unit_mem_capacities);
127 double avg_mem_capacity =
static_cast<double>(total_mem_capacity) /
131 for (
auto membw = unit_mem_capacities.begin();
132 membw != unit_mem_capacities.end(); ++membw) {
134 *membw = avg_mem_capacity;
139 std::vector<double> unit_bytes_per_cycle;
140 double total_bytes_per_cycle = 0;
143 for (
auto u : tloc.global_units()) {
144 auto unit_loc = tloc.unit_locality(u);
145 double unit_mem_bw = std::max<int>(0, unit_loc.max_shmem_mbps());
146 double unit_core_fq = unit_loc.num_threads() *
148 double unit_bps = unit_mem_bw / unit_core_fq;
149 unit_bytes_per_cycle.push_back(unit_bps);
150 total_bytes_per_cycle += unit_bps;
153 double avg_bytes_per_cycle =
154 static_cast<double>(total_bytes_per_cycle) / tloc.global_units().size();
156 unit_mem_perc.reserve(unit_bytes_per_cycle.size());
157 for (
auto unit_bps : unit_bytes_per_cycle) {
158 unit_mem_perc.push_back(unit_bps / avg_bytes_per_cycle);
160 return unit_mem_perc;
177 MemArrange Arrangement = dash::ROW_MAJOR,
199 typename CompBasedMeasure,
200 typename MemBasedMeasure,
201 MemArrange Arrangement,
204 1, CompBasedMeasure, MemBasedMeasure, Arrangement, IndexType>
207 static const dim_t NumDimensions = 1;
210 static constexpr
char const * PatternName =
"LoadBalancePattern1D";
253 typedef typename std::make_unsigned<IndexType>::type
269 typedef internal::PatternArguments<NumDimensions, IndexType>
277 typedef IndexType index_type;
278 typedef SizeType size_type;
286 std::array<index_type, NumDimensions> coords;
295 const SizeSpec_t & sizespec,
297 TeamLocality_t & team_loc)
298 : _size(sizespec.
size()),
304 initialize_load_weights(
306 _unit_membw_weights)),
308 initialize_local_sizes(
312 initialize_block_offsets(
315 std::array<SizeType, 1> {{ _size }}),
317 initialize_blockspec(
319 _distspec(dash::BLOCKED),
320 _team(&team_loc.team()),
321 _myid(_team->myid()),
323 _nunits(_team->size()),
325 initialize_local_extent(
328 _local_memory_layout(
329 std::array<SizeType, 1> {{ _local_size }}),
331 initialize_local_capacity(
334 DASH_LOG_TRACE(
"LoadBalancePattern()",
"(sizespec, dist, team)");
336 _local_sizes.size(), _nunits,
337 "Number of given local sizes " << _local_sizes.size() <<
" " <<
338 "does not match number of units" << _nunits);
339 initialize_local_range();
340 DASH_LOG_TRACE(
"LoadBalancePattern()",
"LoadBalancePattern initialized");
348 const SizeSpec_t & sizespec,
356 self_t & operator=(
const self_t & other) =
default;
357 self_t & operator=(self_t && other) =
default;
375 const self_t & other)
const 377 if (
this == &other) {
383 _size == other._size &&
384 _local_sizes == other._local_sizes &&
385 _teamspec == other._teamspec
394 const self_t & other)
const 396 return !(*
this == other);
430 const std::array<IndexType, NumDimensions> & coords,
432 const ViewSpec_t & viewspec)
const 434 return unit_at(coords[0] + viewspec.offset(0));
443 const std::array<IndexType, NumDimensions> & g_coords)
const 445 return unit_at(g_coords[0]);
455 IndexType global_pos,
457 const ViewSpec_t & viewspec)
const 459 return unit_at(global_pos + viewspec.offset(0));
469 IndexType g_index)
const 471 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.unit_at()", g_index);
473 for (
team_unit_t unit_idx{0}; unit_idx < _nunits; ++unit_idx) {
474 if (g_index < _local_sizes[unit_idx]) {
475 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.unit_at >", unit_idx);
478 g_index -= _local_sizes[unit_idx];
482 "LoadBalancePattern.unit_at: " <<
483 "global index " << g_index <<
" is out of bounds");
503 "Wrong dimension for Pattern::local_extent. " <<
504 "Expected dimension = 0, got " << dim);
523 "Wrong dimension for Pattern::local_extent. " <<
524 "Expected dimension = 0, got " << dim);
542 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.local_extents()", unit);
543 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.local_extents >",
545 return std::array<SizeType, 1> {{ _local_sizes[unit] }};
560 const std::array<IndexType, NumDimensions> & local_coords,
562 const ViewSpec_t & viewspec)
const 564 return local_coords[0] + viewspec.offset(0);
574 const std::array<IndexType, NumDimensions> & local_coords)
const 576 return local_coords[0];
588 const std::array<IndexType, NumDimensions> & g_coords)
const 590 local_index_t l_index =
local(g_coords[0]);
591 local_coords_t l_coords;
592 l_coords.unit = l_index.unit;
593 l_coords.coords[0] = l_index.index;
605 IndexType g_index)
const 607 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.local()", g_index);
608 local_index_t l_index;
610 for (
team_unit_t unit_idx{0}; unit_idx < _nunits; ++unit_idx) {
611 if (g_index < _local_sizes[unit_idx]) {
612 l_index.unit = unit_idx;
613 l_index.index = g_index;
614 DASH_LOG_TRACE(
"LoadBalancePattern.local >",
615 "unit:", l_index.unit,
616 "index:", l_index.index);
619 g_index -= _local_sizes[unit_idx];
623 "LoadBalancePattern.local: " <<
624 "global index " << g_index <<
" is out of bounds");
634 const std::array<IndexType, NumDimensions> & g_coords)
const 636 local_index_t l_index =
local(g_coords[0]);
637 return std::array<IndexType, 1> {{ l_index.index }};
647 const std::array<IndexType, NumDimensions> & g_coords)
const 649 return local(g_coords[0]);
661 std::array<IndexType, NumDimensions>
global(
663 const std::array<IndexType, NumDimensions> & local_coords)
const 665 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.global()", unit);
666 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.global()", local_coords);
667 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.global", _nunits);
672 index_type glob_index = _block_offsets[unit] + local_coords[0];
673 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.global >", glob_index);
674 return std::array<IndexType, 1> {{ glob_index }};
682 std::array<IndexType, NumDimensions>
global(
683 const std::array<IndexType, NumDimensions> & l_coords)
const 685 return global(_team->myid(), l_coords);
698 IndexType l_index)
const 700 return global(unit, std::array<IndexType, 1> {{ l_index }})[0];
712 IndexType l_index)
const 714 return global(_team->myid(), std::array<IndexType, 1> {{ l_index }})[0];
727 const std::array<IndexType, NumDimensions> & l_coords)
const 729 auto g_index =
global(unit, l_coords[0]);
746 const std::array<IndexType, NumDimensions> & g_coords)
const 748 return local_coords(g_coords)[0];
759 const std::array<IndexType, NumDimensions> & g_coords,
760 const ViewSpec_t & viewspec)
const 762 auto vs_coords = g_coords;
763 vs_coords[0] += viewspec.offset(0);
764 return local_coords(vs_coords)[0];
774 template<
typename ... Values>
775 IndexType
at(IndexType value, Values ... values)
const 778 sizeof...(values) == NumDimensions-1,
779 "Wrong parameter number");
780 std::array<IndexType, NumDimensions> inputindex = {
781 value, (IndexType)values...
783 return at(inputindex);
799 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local()", index);
800 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local()", unit);
801 bool is_loc = index >= _block_offsets[unit] &&
802 (unit == _nunits-1 ||
803 index < _block_offsets[unit+1]);
804 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local >", is_loc);
815 IndexType
index)
const 817 auto unit = team().myid();
818 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local()", index);
819 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local", unit);
820 bool is_loc = index >= _block_offsets[unit] &&
821 (unit == _nunits-1 ||
822 index < _block_offsets[unit+1]);
823 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.is_local >", is_loc);
846 const std::array<index_type, NumDimensions> & g_coords)
const 848 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.block_at()", g_coords);
850 auto block_idx =
static_cast<index_type
>(unit_at(g_coords[0]));
852 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.block_at >", block_idx);
861 index_type g_block_index)
const 863 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.block >", g_block_index);
864 index_type offset = _block_offsets[g_block_index];
865 auto block_size = _local_sizes[g_block_index];
866 std::array<index_type, NumDimensions> offsets = {{ offset }};
867 std::array<size_type, NumDimensions> extents = {{ block_size }};
868 ViewSpec_t block_vs(offsets, extents);
869 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.block >", block_vs);
878 index_type l_block_index)
const 880 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.local_block()", l_block_index);
883 "LoadBalancePattern always assigns exactly 1 block to a single unit");
884 index_type block_offset = _block_offsets[_team->myid()];
885 size_type block_size = _local_sizes[_team->myid()];
886 std::array<index_type, NumDimensions> offsets = {{ block_offset }};
887 std::array<size_type, NumDimensions> extents = {{ block_size }};
888 ViewSpec_t block_vs(offsets, extents);
889 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.local_block >", block_vs);
898 index_type l_block_index)
const 900 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.local_block_local >",
902 size_type block_size = _local_sizes[_team->myid()];
903 std::array<index_type, NumDimensions> offsets = {{ 0 }};
904 std::array<size_type, NumDimensions> extents = {{ block_size }};
905 ViewSpec_t block_vs(offsets, extents);
906 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern<1>.local_block_local >", block_vs);
919 dim_t dimension)
const 921 return _local_capacity;
934 return _local_capacity;
944 return _local_capacity;
963 return _local_sizes[unit];
1020 return SizeSpec_t(std::array<SizeType, 1> {{ _size }});
1028 const std::array<SizeType, NumDimensions> &
extents()
const 1030 return std::array<SizeType, 1> {{ _size }};
1051 IndexType
index)
const 1053 return std::array<IndexType, 1> {{ index }};
1064 const ViewSpec_t & viewspec)
const 1066 return std::array<IndexType, 1> {{ index + viewspec.offset(0) }};
1085 const std::vector<double> & unit_cpu_weights()
const 1087 return _unit_cpu_weights;
1090 const std::vector<double> & unit_membw_weights()
const 1092 return _unit_membw_weights;
1095 const std::vector<double> & unit_load_weights()
const 1097 return _unit_load_weights;
1102 std::vector<double> initialize_load_weights(
1103 const std::vector<double> & cpu_weights,
1104 const std::vector<double> & membw_weights)
const 1106 std::vector<double> load_weights;
1107 if (cpu_weights.size() != membw_weights.size()) {
1110 "Number of CPU weights and SHMEM weights differ");
1118 load_weights.reserve(cpu_weights.size());
1120 membw_weights.begin(),
1121 std::back_inserter(load_weights),
1122 std::multiplies<double>());
1123 dash::math::div_mean(load_weights.begin(), load_weights.end());
1124 return load_weights;
1131 std::vector<size_type> initialize_local_sizes(
1132 size_type total_size,
1133 const TeamLocality_t & locality)
const 1135 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_local_sizes()", total_size);
1136 std::vector<size_type> l_sizes;
1137 auto nunits = locality.team().
size();
1138 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_local_sizes()", nunits);
1140 l_sizes.push_back(total_size);
1146 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_local_sizes",
1147 _unit_load_weights);
1149 double balanced_lsize =
static_cast<double>(total_size) / nunits;
1151 size_t assigned_capacity = 0;
1156 size_t unit_max_cpu_cap = 0;
1158 double weight = _unit_load_weights[u];
1159 size_t unit_capacity = weight > 1
1160 ? std::ceil(weight * balanced_lsize)
1161 : std::floor(weight * balanced_lsize);
1162 if (unit_capacity > unit_max_cpu_cap) {
1163 max_cpu_cap_unit = u;
1164 unit_max_cpu_cap = unit_capacity;
1166 assigned_capacity += unit_capacity;
1167 l_sizes.push_back(unit_capacity);
1171 l_sizes[max_cpu_cap_unit] += (total_size - assigned_capacity);
1173 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_local_sizes >", l_sizes);
1177 BlockSpec_t initialize_blockspec(
1178 const std::vector<size_type> & local_sizes)
const 1180 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_blockspec", local_sizes);
1181 BlockSpec_t blockspec(
1182 std::array<size_type, 1> {{
1183 static_cast<size_type
>(local_sizes.size())
1185 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_blockspec >", blockspec);
1193 std::vector<size_type> initialize_block_offsets(
1194 const std::vector<size_type> & local_sizes)
const 1196 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_block_offsets", local_sizes);
1197 std::vector<size_type> block_offsets;
1198 if (local_sizes.size() > 0) {
1200 block_offsets.push_back(0);
1201 for (size_type unit_idx = 0;
1202 unit_idx < local_sizes.size()-1;
1205 auto block_offset = block_offsets[unit_idx] +
1206 local_sizes[unit_idx];
1207 block_offsets.push_back(block_offset);
1210 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_block_offsets >",
1212 return block_offsets;
1218 SizeType initialize_local_capacity(
1219 const std::vector<size_type> & local_sizes)
const 1221 SizeType l_capacity = 0;
1225 DASH_LOG_TRACE_VAR(
"LoadBalancePattern.init_lcapacity", _nunits);
1229 local_sizes.end()));
1230 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_lcapacity >", l_capacity);
1238 void initialize_local_range()
1240 auto l_size = _local_size;
1241 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_local_range()", l_size);
1251 _lend =
global(l_size - 1) + 1;
1253 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_local_range >", _lbegin);
1254 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_local_range >", _lend);
1260 SizeType initialize_local_extent(
1262 const std::vector<size_type> & local_sizes)
const 1264 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_local_extent()", unit);
1265 if (local_sizes.size() == 0) {
1269 SizeType l_extent = local_sizes[unit];
1270 DASH_LOG_DEBUG_VAR(
"LoadBalancePattern.init_local_extent >", l_extent);
1278 std::vector<double> _unit_cpu_weights;
1281 std::vector<double> _unit_membw_weights;
1283 std::vector<double> _unit_load_weights;
1285 std::vector<size_type> _local_sizes;
1287 std::vector<size_type> _block_offsets;
1289 MemoryLayout_t _memory_layout;
1291 BlockSpec_t _blockspec;
1293 DistributionSpec_t _distspec;
1299 TeamSpec_t _teamspec;
1301 SizeType _nunits = 0;
1303 SizeType _local_size;
1305 LocalMemoryLayout_t _local_memory_layout;
1307 SizeType _local_capacity;
1317 #endif // DASH__LOAD_BALANCE_PATTERN_H__INCLUDED IndexType at(IndexType value, Values ... values) const
Global coordinates to local index.
constexpr team_unit_t UNDEFINED_TEAM_UNIT_ID
Invalid local unit ID.
local_index_t local_index(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit and their respective local index.
All blocks have identical size.
bool is_local(IndexType index) const
Whether the given global index is local to the unit that created this pattern instance.
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
IndexType at(const std::array< IndexType, NumDimensions > &g_coords) const
at
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...
const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped...
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
size_t size()
Return the number of units in the global team.
IndexType local_at(const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
local
index_type block_at(const std::array< index_type, NumDimensions > &g_coords) const
Index of block at given global coordinates.
constexpr auto local(ViewType &v) -> typename std::enable_if<(std::is_pointer< typename ViewType::iterator >::value||(dash::view_traits< ViewValueT >::is_local::value)), ViewType &>::type
This class is a simple memory pool which holds allocates elements of size ValueType.
Local element order corresponds to a logical linearization within single blocks (if blocked) or withi...
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
Specifies cartesian extents in a specific number of dimensions.
std::array< IndexType, NumDimensions > global(const std::array< IndexType, NumDimensions > &l_coords) const
Converts local coordinates of active unit to global coordinates.
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit's respective local coordinates.
Specifies view parameters for implementing submat, rows and cols.
IndexType local_extent(dim_t dim) const
The actual number of elements in this pattern that are local to the calling unit in the given dimensi...
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
bool operator==(const self_t &other) const
Equality comparison operator.
static constexpr MemArrange memory_order()
Memory order followed by the pattern.
local_coords_t local(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit and its respective local coordinates.
team_unit_t unit_at(IndexType global_pos, const ViewSpec_t &viewspec) const
Convert given global linear index to its assigned unit id.
The number of blocks assigned to units may differ.
const DistributionSpec_t & distspec() const
Distribution specification of this pattern.
Minimal number of blocks in every dimension, typically at most one block per unit.
IndexType at(const std::array< IndexType, NumDimensions > &g_coords, const ViewSpec_t &viewspec) const
Global coordinates and viewspec to local index.
Block extents are constant for every dimension.
ViewSpec_t local_block(index_type l_block_index) const
View spec (offset and extents) of block at local linear block index in global cartesian element space...
SizeType max_blocksize() const
Maximum number of elements in a single block in all dimensions.
constexpr std::enable_if< dash::view_traits< ViewType >::is_view::value &&dash::view_traits< ViewType >::is_local::value, const typename ViewType::global_type & >::type global(const ViewType &v)
size_t size() const
The number of units in this team.
static constexpr dim_t ndim()
Number of dimensions of the cartesian space partitioned by the pattern.
Cartesian space defined by extents in n dimensions.
IndexType lbegin() const
Resolves the global index of the first local element in the pattern.
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
A Team instance specifies a subset of all available units.
IndexType global(IndexType l_index) const
Resolve an element's linear global index from the calling unit's local index of that element...
Elements are contiguous in local memory within a single block and thus indexed blockwise.
IndexType size() const
The number of elements arranged in this pattern.
ViewSpec_t local_block_local(index_type l_block_index) const
View spec (offset and extents) of block at local linear block index in local cartesian element space...
Defines a cartesian, totally-ordered index space by mapping linear indices to cartesian coordinates d...
pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linear > layout_properties
Satisfiable properties in pattern property category Layout:
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at
SizeType local_capacity() const
Maximum number of elements assigned to a single unit.
Data range is partitioned dynamically.
IndexType global(team_unit_t unit, IndexType l_index) const
Resolve an element's linear global index from the given unit's local index of that element...
IndexType capacity() const
The maximum number of elements arranged in this pattern.
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &g_coords) const
Convert given coordinate in pattern to its assigned unit id.
LoadBalancePattern(const SizeSpec_t &sizespec, TeamLocality_t &team_loc)
Constructor.
IndexType lend() const
Resolves the global index past the last local element in the pattern.
OutputIt transform(InputIt in_first, InputIt in_last, OutputIt out_first, UnaryOperation unary_op)
Apply a given function to elements in a range and store the result in another range, beginning at out_first.
IndexType local_at(const std::array< IndexType, NumDimensions > &local_coords) const
Convert given local coordinates to linear local offset (index).
Size of blocks may differ.
Irregular dynamic pattern.
Hierarchical locality domains of a specified team.
SizeType blocksize(dim_t dimension) const
Maximum number of elements in a single block in the given dimension.
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Wrapper of a single dart_domain_locality_t object.
std::array< IndexType, NumDimensions > coords(IndexType index, const ViewSpec_t &viewspec) const
Convert given global linear offset (index) to global cartesian coordinates using viewspec.
IndexType num_units() const
The number of units to which this pattern's elements are mapped.
bool is_local(IndexType index, team_unit_t unit) const
is_local
GlobIter max_element(const GlobIter &first, const GlobIter &last, Compare compare=Compare())
Finds an iterator pointing to the element with the greatest value in the range [first,last).
pattern_partitioning_properties< pattern_partitioning_tag::minimal, pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balanced, pattern_partitioning_tag::unbalanced, pattern_partitioning_tag::dynamic > partitioning_properties
Satisfiable properties in pattern property category Partitioning:
ViewSpec_t block(index_type g_block_index) const
View spec (offset and extents) of block at global linear block index in cartesian element space...
IndexType global_index(team_unit_t unit, const std::array< IndexType, NumDimensions > &l_coords) const
Resolve an element's linear global index from a given unit's local coordinates of that element...
dash::Team & team() const
The Team containing the units to which this pattern's elements are mapped.
local_index_t local(IndexType g_index) const
Converts global index to its associated unit and respective local index.
std::array< SizeType, NumDimensions > local_extents(team_unit_t unit) const
The actual number of elements in this pattern that are local to the given unit, by dimension...
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.
LoadBalancePattern(self_t &other)
Copy constructor using non-const lvalue reference parameter.
static Team & All()
The invariant Team instance containing all available units.
static std::vector< double > unit_weights(const TeamLocality_t &tloc)
Returns unit CPU capacities as percentage of the team's total CPU capacity average, e.g.
see https://en.cppreference.com/w/cpp/feature_test for recommended feature tests
static std::vector< double > unit_weights(const TeamLocality_t &tloc)
Shared memory bandwidth capacities of every unit factored by the mean memory bandwidth capacity of al...
const BlockSpec_t & blockspec() const
block
pattern_mapping_properties< pattern_mapping_tag::unbalanced > mapping_properties
Satisfiable properties in pattern property category Mapping:
DistributionSpec describes distribution patterns of all dimensions,.
IndexType extent(dim_t dim) const
extent
bool operator!=(const self_t &other) const
Inquality comparison operator.
Generic type of mapping properties of a model satisfying the Pattern concept.
LoadBalancePattern(const SizeSpec_t &sizespec, dash::Team &team=dash::Team::All())
Constructor.
team_unit_t unit_at(IndexType g_index) const
Convert given global linear index to its assigned unit id.