DASH  0.3.0
dash::UnitClockFreqMeasure Class Reference

Static Public Member Functions

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. More...
 

Detailed Description

Definition at line 27 of file LoadBalancePattern.h.

Member Function Documentation

◆ unit_weights()

static std::vector<double> dash::UnitClockFreqMeasure::unit_weights ( const TeamLocality_t tloc)
inlinestatic

Returns unit CPU capacities as percentage of the team's total CPU capacity average, e.g.

vector of 1's if all units have identical CPU capacity.

Definition at line 39 of file LoadBalancePattern.h.

References dash::transform().

41  {
42  std::vector<double> unit_cpu_capacities;
43  double sum = 0;
44 
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() *
49  unit_loc.cpu_mhz();
50  sum += unit_cpu_cap;
51  unit_cpu_capacities.push_back(unit_cpu_cap);
52  }
53  double mean = sum / tloc.global_units().size();
54  std::transform(unit_cpu_capacities.begin(),
55  unit_cpu_capacities.end(),
56  unit_cpu_capacities.begin(),
57 
58  [&](double v) { return v / mean; });
59  return unit_cpu_capacities;
60  }
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.

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