From 6ffda7b87438da391c304833e3b1f6d91d86555b Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Tue, 26 Sep 2023 19:00:01 +0200 Subject: [PATCH] #2150: Resolve conflicts and compile issues --- src/vt/elm/elm_lb_data.cc | 16 +++--- src/vt/elm/elm_lb_data.h | 12 ++--- src/vt/vrt/collection/balance/baselb/baselb.h | 2 + .../collection/balance/baselb/load_sampler.cc | 4 +- .../collection/balance/greedylb/greedylb.cc | 4 +- .../balance/hierarchicallb/hierlb.cc | 4 +- src/vt/vrt/collection/balance/lb_common.cc | 2 +- .../vrt/collection/balance/lb_data_holder.cc | 8 +-- .../balance/lb_invoke/lb_manager.cc | 43 ++++++++-------- .../collection/balance/model/linear_model.cc | 4 +- .../vrt/collection/balance/model/load_model.h | 2 +- src/vt/vrt/collection/balance/model/norm.cc | 8 +-- .../vrt/collection/balance/model/raw_data.cc | 2 +- .../model/weighted_communication_volume.cc | 2 +- src/vt/vrt/collection/balance/stats_msg.h | 28 +++++------ .../balance/temperedlb/temperedlb.cc | 50 +++++++++---------- .../balance/temperedlb/temperedlb.h | 3 +- .../collection/balance/zoltanlb/zoltanlb.cc | 5 +- tests/unit/collection/test_lb.extended.cc | 2 +- tests/unit/collection/test_lb_data_holder.cc | 2 +- .../test_model_comm_overhead.nompi.cc | 4 +- .../unit/collection/test_model_norm.nompi.cc | 2 +- .../test_model_weighted_messages.nompi.cc | 4 +- tests/unit/lb/test_offlinelb.cc | 2 +- tests/unit/lb/test_temperedlb.nompi.cc | 4 +- .../unit/scheduler/test_scheduler_timings.cc | 2 +- 26 files changed, 112 insertions(+), 109 deletions(-) diff --git a/src/vt/elm/elm_lb_data.cc b/src/vt/elm/elm_lb_data.cc index 75b3864f13..b35d8ebd5e 100644 --- a/src/vt/elm/elm_lb_data.cc +++ b/src/vt/elm/elm_lb_data.cc @@ -69,7 +69,7 @@ void ElementLBData::stop(TimeType time) { auto const started = cur_time_started_; if (started) { cur_time_started_ = false; - addTime(total_time); + addTime(total_time.seconds()); } vt_debug_print( @@ -124,11 +124,11 @@ void ElementLBData::recvToNode( recvComm(key, bytes); } -void ElementLBData::addTime(TimeType const& time) { - phase_timings_[cur_phase_] += time; +void ElementLBData::addTime(LoadType const timeLoad) { + phase_timings_[cur_phase_] += timeLoad; subphase_timings_[cur_phase_].resize(cur_subphase_ + 1); - subphase_timings_[cur_phase_].at(cur_subphase_) += time; + subphase_timings_[cur_phase_].at(cur_subphase_) += timeLoad; vt_debug_print( verbose,lb, @@ -163,7 +163,7 @@ PhaseType ElementLBData::getPhase() const { return cur_phase_; } -TimeType ElementLBData::getLoad(PhaseType const& phase) const { +LoadType ElementLBData::getLoad(PhaseType const& phase) const { auto iter = phase_timings_.find(phase); if (iter != phase_timings_.end()) { auto const total_load = phase_timings_.at(phase); @@ -176,11 +176,11 @@ TimeType ElementLBData::getLoad(PhaseType const& phase) const { return total_load; } else { - return TimeType{0.0}; + return 0.0; } } -TimeType +LoadType ElementLBData::getLoad(PhaseType phase, SubphaseType subphase) const { if (subphase == no_subphase) return getLoad(phase); @@ -199,7 +199,7 @@ ElementLBData::getLoad(PhaseType phase, SubphaseType subphase) const { return total_load; } -std::vector const& ElementLBData::getSubphaseTimes(PhaseType phase) { +std::vector const& ElementLBData::getSubphaseTimes(PhaseType phase) { return subphase_timings_[phase]; } diff --git a/src/vt/elm/elm_lb_data.h b/src/vt/elm/elm_lb_data.h index 3e245e4337..de96110b80 100644 --- a/src/vt/elm/elm_lb_data.h +++ b/src/vt/elm/elm_lb_data.h @@ -63,7 +63,7 @@ struct ElementLBData { void start(TimeType time); void stop(TimeType time); - void addTime(TimeType const& time); + void addTime(LoadType const timeLoad); void sendToEntity(ElementIDStruct to, ElementIDStruct from, double bytes); void sendComm(elm::CommKey key, double bytes); @@ -84,12 +84,12 @@ struct ElementLBData { void updatePhase(PhaseType const& inc = 1); void resetPhase(); PhaseType getPhase() const; - TimeType getLoad(PhaseType const& phase) const; - TimeType getLoad(PhaseType phase, SubphaseType subphase) const; + LoadType getLoad(PhaseType const& phase) const; + LoadType getLoad(PhaseType phase, SubphaseType subphase) const; CommMapType const& getComm(PhaseType const& phase); std::vector const& getSubphaseComm(PhaseType phase); - std::vector const& getSubphaseTimes(PhaseType phase); + std::vector const& getSubphaseTimes(PhaseType phase); void setSubPhase(SubphaseType subphase); SubphaseType getSubPhase() const; @@ -126,11 +126,11 @@ struct ElementLBData { bool cur_time_started_ = false; TimeType cur_time_ = TimeType{0.0}; PhaseType cur_phase_ = fst_lb_phase; - std::unordered_map phase_timings_ = {}; + std::unordered_map phase_timings_ = {}; std::unordered_map phase_comm_ = {}; SubphaseType cur_subphase_ = 0; - std::unordered_map> subphase_timings_ = {}; + std::unordered_map> subphase_timings_ = {}; std::unordered_map> subphase_comm_ = {}; }; diff --git a/src/vt/vrt/collection/balance/baselb/baselb.h b/src/vt/vrt/collection/balance/baselb/baselb.h index 37045caab1..01cc200efc 100644 --- a/src/vt/vrt/collection/balance/baselb/baselb.h +++ b/src/vt/vrt/collection/balance/baselb/baselb.h @@ -141,6 +141,8 @@ struct BaseLB { TransferMsg* msg ); + LoadType loadMilli(LoadType const& load); + void applyMigrations( TransferVecType const& transfers, MigrationCountCB migration_count_callback ); diff --git a/src/vt/vrt/collection/balance/baselb/load_sampler.cc b/src/vt/vrt/collection/balance/baselb/load_sampler.cc index 10b3b989f1..3c4b47fff1 100644 --- a/src/vt/vrt/collection/balance/baselb/load_sampler.cc +++ b/src/vt/vrt/collection/balance/baselb/load_sampler.cc @@ -49,10 +49,10 @@ namespace vt { namespace vrt { namespace collection { namespace lb { void LoadSamplerBaseLB::buildHistogram() { for (auto obj : *load_model_) { - TimeType load = load_model_->getModeledLoad( + auto load = load_model_->getModeledLoad( obj, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE} ); - auto const& load_milli = load.milliseconds(); + auto const& load_milli = loadMilli(load); auto const& bin = histogramSample(load_milli); if (obj.isMigratable()) { obj_sample[bin].push_back(obj); diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.cc b/src/vt/vrt/collection/balance/greedylb/greedylb.cc index 5069e71e04..a53d11b949 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.cc +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.cc @@ -412,9 +412,9 @@ void GreedyLB::loadOverBin(ObjBinType bin, ObjBinListType& bin_list) { load_over[bin].push_back(obj_id); bin_list.pop_back(); - auto const& obj_time_milli = load_model_->getModeledLoad( + auto const& obj_time_milli = loadMilli(load_model_->getModeledLoad( obj_id, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE} - ).milliseconds(); + )); this_load -= obj_time_milli; diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc index 458b2e87a1..3252e65d6b 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc @@ -312,9 +312,9 @@ void HierarchicalLB::loadOverBin(ObjBinType bin, ObjBinListType& bin_list) { load_over[bin].push_back(obj_id); bin_list.pop_back(); - auto const& obj_time_milli = load_model_->getModeledLoad(obj_id, + auto const& obj_time_milli = loadMilli(load_model_->getModeledLoad(obj_id, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE} - ).milliseconds(); + )); this_load -= obj_time_milli; diff --git a/src/vt/vrt/collection/balance/lb_common.cc b/src/vt/vrt/collection/balance/lb_common.cc index 43aba1de7b..2a52049170 100644 --- a/src/vt/vrt/collection/balance/lb_common.cc +++ b/src/vt/vrt/collection/balance/lb_common.cc @@ -102,7 +102,7 @@ LoadSummary getNodeLoads(std::shared_ptr model, PhaseOffset when) LoadSummary ret; auto subphases = model->getNumSubphases(); - ret.subphase_loads.resize(subphases, TimeType{0.0}); + ret.subphase_loads.resize(subphases, 0.0); for (auto obj : *model) { ret += getObjectLoads(model, obj, when); diff --git a/src/vt/vrt/collection/balance/lb_data_holder.cc b/src/vt/vrt/collection/balance/lb_data_holder.cc index d3fb5ea066..3f0da67f2a 100644 --- a/src/vt/vrt/collection/balance/lb_data_holder.cc +++ b/src/vt/vrt/collection/balance/lb_data_holder.cc @@ -138,7 +138,7 @@ std::unique_ptr LBDataHolder::toJson(PhaseType phase) const { LoadType time = elm.second.whole_phase_load; j["tasks"][i]["resource"] = "cpu"; j["tasks"][i]["node"] = id.getCurrNode(); - j["tasks"][i]["time"] = time.seconds(); + j["tasks"][i]["time"] = time; if (user_defined_json_.find(phase) != user_defined_json_.end()) { auto &user_def_this_phase = user_defined_json_.at(phase); if (user_def_this_phase.find(id) != user_def_this_phase.end()) { @@ -155,7 +155,7 @@ std::unique_ptr LBDataHolder::toJson(PhaseType phase) const { if (subphases != 0) { for (std::size_t s = 0; s < subphases; s++) { j["tasks"][i]["subphases"][s]["id"] = s; - j["tasks"][i]["subphases"][s]["time"] = subphase_times[s].seconds(); + j["tasks"][i]["subphases"][s]["time"] = subphase_times[s]; } } @@ -251,7 +251,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) vtAssertExpr(object.is_number()); auto elm = ElementIDStruct{object, node}; - this->node_data_[id][elm].whole_phase_load = TimeType{time}; + this->node_data_[id][elm].whole_phase_load = time; if ( task["entity"].find("collection_id") != task["entity"].end() and @@ -278,7 +278,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) this->node_data_[id][elm].subphase_loads.resize( static_cast(sid) + 1); - this->node_data_[id][elm].subphase_loads[sid] = TimeType{stime}; + this->node_data_[id][elm].subphase_loads[sid] = stime; } } } diff --git a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc index 413149e785..2f05551bfe 100644 --- a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc +++ b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc @@ -43,6 +43,7 @@ #include "vt/config.h" #include "vt/configs/arguments/app_config.h" +#include "vt/configs/types/types_type.h" #include "vt/context/context.h" #include "vt/phase/phase_hook_enum.h" #include "vt/vrt/collection/balance/baselb/baselb.h" @@ -499,31 +500,31 @@ void LBManager::statsHandler(std::vector const& in_stat_vec) auto skew = st.skew(); auto krte = st.krte(); - stats[stat][lb::StatisticQuantity::max] = max.seconds(); - stats[stat][lb::StatisticQuantity::min] = min.seconds(); - stats[stat][lb::StatisticQuantity::avg] = avg.seconds(); - stats[stat][lb::StatisticQuantity::sum] = sum.seconds(); + stats[stat][lb::StatisticQuantity::max] = max; + stats[stat][lb::StatisticQuantity::min] = min; + stats[stat][lb::StatisticQuantity::avg] = avg; + stats[stat][lb::StatisticQuantity::sum] = sum; stats[stat][lb::StatisticQuantity::npr] = npr; stats[stat][lb::StatisticQuantity::car] = car; - stats[stat][lb::StatisticQuantity::var] = var.seconds(); + stats[stat][lb::StatisticQuantity::var] = var; stats[stat][lb::StatisticQuantity::npr] = npr; - stats[stat][lb::StatisticQuantity::imb] = imb.seconds(); - stats[stat][lb::StatisticQuantity::std] = stdv.seconds(); - stats[stat][lb::StatisticQuantity::skw] = skew.seconds(); - stats[stat][lb::StatisticQuantity::kur] = krte.seconds(); + stats[stat][lb::StatisticQuantity::imb] = imb; + stats[stat][lb::StatisticQuantity::std] = stdv; + stats[stat][lb::StatisticQuantity::skw] = skew; + stats[stat][lb::StatisticQuantity::kur] = krte; if (stat == rank_statistic) { if (before_lb_stats_) { - last_phase_info_->max_load = max.seconds(); - last_phase_info_->avg_load = avg.seconds(); - last_phase_info_->imb_load = imb.seconds(); + last_phase_info_->max_load = max; + last_phase_info_->avg_load = avg; + last_phase_info_->imb_load = imb; } else { - last_phase_info_->max_load_post_lb = max.seconds(); - last_phase_info_->avg_load_post_lb = avg.seconds(); - last_phase_info_->imb_load_post_lb = imb.seconds(); + last_phase_info_->max_load_post_lb = max; + last_phase_info_->avg_load_post_lb = avg; + last_phase_info_->imb_load_post_lb = imb; } } else if (stat == obj_statistic and before_lb_stats_) { - last_phase_info_->max_obj = max.seconds(); + last_phase_info_->max_obj = max; } if (theContext()->getNode() == 0) { @@ -607,7 +608,7 @@ void LBManager::commitPhaseStatistics(PhaseType phase) { balance::LoadData reduceVec( lb::Statistic stat, std::vector&& vec ) { - balance::LoadData reduce_ld(stat, TimeType{0.0}); + balance::LoadData reduce_ld(stat, 0.0); if (vec.size() == 0) { return reduce_ld; } else { @@ -631,7 +632,7 @@ void LBManager::computeStatistics( balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE }; - total_load_from_model = TimeType{0.}; + total_load_from_model = 0.; std::vector obj_load_model; for (auto elm : *model) { auto work = model->getModeledLoad(elm, when); @@ -669,7 +670,7 @@ void LBManager::computeStatistics( )); if (strategy_specific_model_) { - TimeType rank_strat_specific_load = TimeType{0.}; + LoadType rank_strat_specific_load = 0.; std::vector obj_strat_specific_load; for (auto elm : *strategy_specific_model_) { auto work = strategy_specific_model_->getModeledLoad(elm, when); @@ -703,7 +704,7 @@ void LBManager::computeStatistics( for (auto&& elm : *comm_data) { // Only count object-to-object direct edges in the Object_comm statistics if (elm.first.cat_ == elm::CommCategory::SendRecv and not elm.first.selfEdge()) { - obj_comm.emplace_back(LoadData{lb::Statistic::Object_comm, TimeType{elm.second.bytes}}); + obj_comm.emplace_back(LoadData{lb::Statistic::Object_comm, elm.second.bytes}); } if (not comm_collectives and isCollectiveComm(elm.first.cat_)) { @@ -716,7 +717,7 @@ void LBManager::computeStatistics( comm_load += elm.second.bytes; } - lstats.emplace_back(LoadData{lb::Statistic::Rank_comm, TimeType{comm_load}}); + lstats.emplace_back(LoadData{lb::Statistic::Rank_comm, comm_load}); lstats.emplace_back(reduceVec( lb::Statistic::Object_comm, std::move(obj_comm) )); diff --git a/src/vt/vrt/collection/balance/model/linear_model.cc b/src/vt/vrt/collection/balance/model/linear_model.cc index 8e21f000b7..41a48546ec 100644 --- a/src/vt/vrt/collection/balance/model/linear_model.cc +++ b/src/vt/vrt/collection/balance/model/linear_model.cc @@ -65,12 +65,12 @@ LoadType LinearModel::getModeledLoad(ElementIDStruct object, PhaseOffset when) c for (int i = -1 * static_cast(phases); i < 0; i++) { x.emplace_back(i); past_phase.phases = i; - y.emplace_back(ComposedModel::getModeledLoad(object, past_phase).seconds()); + y.emplace_back(ComposedModel::getModeledLoad(object, past_phase)); } // should we re-create this every time? LinearRegression regression{x, y}; - return TimeType{regression.predict(when.phases)}; + return regression.predict(when.phases); } unsigned int LinearModel::getNumPastPhasesNeeded(unsigned int look_back) const diff --git a/src/vt/vrt/collection/balance/model/load_model.h b/src/vt/vrt/collection/balance/model/load_model.h index 8bb048a075..b57c44f1ac 100644 --- a/src/vt/vrt/collection/balance/model/load_model.h +++ b/src/vt/vrt/collection/balance/model/load_model.h @@ -244,7 +244,7 @@ struct LoadModel vtAbort( "LoadModel::getRawLoad() called on a model that does not implement it" ); - return TimeType{0.0}; + return 0.0; }; /** diff --git a/src/vt/vrt/collection/balance/model/norm.cc b/src/vt/vrt/collection/balance/model/norm.cc index 1862008be2..7eff1fa9bd 100644 --- a/src/vt/vrt/collection/balance/model/norm.cc +++ b/src/vt/vrt/collection/balance/model/norm.cc @@ -64,22 +64,22 @@ LoadType Norm::getModeledLoad(ElementIDStruct object, PhaseOffset offset) const for (int i = 0; i < getNumSubphases(); ++i) { offset.subphase = i; - auto t = ComposedModel::getModeledLoad(object, offset).seconds(); + auto t = ComposedModel::getModeledLoad(object, offset); sum += std::pow(t, power_); } - return TimeType{std::pow(sum, 1.0/power_)}; + return std::pow(sum, 1.0/power_); } else { // l-infinity implies a max norm double max = 0.0; for (int i = 0; i < getNumSubphases(); ++i) { offset.subphase = i; - auto t = ComposedModel::getModeledLoad(object, offset).seconds(); + auto t = ComposedModel::getModeledLoad(object, offset); max = std::max(max, t); } - return TimeType{max}; + return max; } } diff --git a/src/vt/vrt/collection/balance/model/raw_data.cc b/src/vt/vrt/collection/balance/model/raw_data.cc index 6019a5b9bc..7eaf3d8661 100644 --- a/src/vt/vrt/collection/balance/model/raw_data.cc +++ b/src/vt/vrt/collection/balance/model/raw_data.cc @@ -107,7 +107,7 @@ LoadType RawData::getRawLoad(ElementIDStruct object, PhaseOffset offset) const { if (phase_data.find(object) != phase_data.end()) { return phase_data.at(object).get(offset); } else { - return TimeType{0.0}; + return 0.0; } } diff --git a/src/vt/vrt/collection/balance/model/weighted_communication_volume.cc b/src/vt/vrt/collection/balance/model/weighted_communication_volume.cc index 621547904b..458892786a 100644 --- a/src/vt/vrt/collection/balance/model/weighted_communication_volume.cc +++ b/src/vt/vrt/collection/balance/model/weighted_communication_volume.cc @@ -50,7 +50,7 @@ LoadType WeightedCommunicationVolume::getModeledLoad( ElementIDStruct object, PhaseOffset when ) const { return alpha_ * ComposedModel::getModeledLoad(object, when) + - beta_ * ComposedModel::getModeledComm(object, when) + TimeType{gamma_}; + beta_ * ComposedModel::getModeledComm(object, when) + gamma_; } }}}} // namespace vt::vrt::collection::balance diff --git a/src/vt/vrt/collection/balance/stats_msg.h b/src/vt/vrt/collection/balance/stats_msg.h index aabdf89c48..6f5c8336a8 100644 --- a/src/vt/vrt/collection/balance/stats_msg.h +++ b/src/vt/vrt/collection/balance/stats_msg.h @@ -85,18 +85,18 @@ struct LoadData { ); int32_t N = a1.N_ + a2.N_; - TimeType delta = a2.avg_ - a1.avg_; - TimeType delta_sur_N = delta / static_cast(N); - TimeType delta2_sur_N2 = delta_sur_N * delta_sur_N; + auto delta = a2.avg_ - a1.avg_; + auto delta_sur_N = delta / static_cast(N); + auto delta2_sur_N2 = delta_sur_N * delta_sur_N; int32_t n2 = a1.N_ * a1.N_; int32_t n_c2 = a2.N_ * a2.N_; int32_t prod_n = a1.N_ * a2.N_; int32_t n_c = a2.N_; int32_t n = a1.N_; - TimeType M2 = a1.M2_; - TimeType M2_c = a2.M2_; - TimeType M3 = a1.M3_; - TimeType M3_c = a2.M3_; + auto M2 = a1.M2_; + auto M2_c = a2.M2_; + auto M3 = a1.M3_; + auto M3_c = a2.M3_; a1.M4_ += a2.M4_ + prod_n * ( n2 - prod_n + n_c2 ) * delta * delta_sur_N * delta2_sur_N2 @@ -127,13 +127,13 @@ struct LoadData { LoadType skew() const { static const double min_sqrt = std::sqrt(std::numeric_limits::min()); if (N_ == 1 or M2_ < min_sqrt) { // 1.e-150 - return TimeType{0.0}; + return 0.0; } else { double nm1 = N_ - 1; double inv_n = 1. / N_; - TimeType var_inv = nm1 / M2_; - TimeType nvar_inv = var_inv * inv_n; - return nvar_inv * std::sqrt( var_inv.seconds() ) * M3_; + auto var_inv = nm1 / M2_; + auto nvar_inv = var_inv * inv_n; + return nvar_inv * std::sqrt( var_inv ) * M3_; } } LoadType krte() const { @@ -142,9 +142,9 @@ struct LoadData { } else { double nm1 = N_ - 1; double inv_n = 1. / N_; - TimeType var_inv = nm1 / M2_; - TimeType nvar_inv = var_inv * inv_n; - return nvar_inv * var_inv * M4_ - TimeType{3.}; + auto var_inv = nm1 / M2_; + auto nvar_inv = var_inv * inv_n; + return nvar_inv * var_inv * M4_ - 3.; } } LoadType I() const { return avg() > 0.0 ? (max() / avg()) - 1.0f : 0.0; } diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc index d98352118a..5ae5ce94e4 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc @@ -69,11 +69,11 @@ void TemperedLB::init(objgroup::proxy::Proxy in_proxy) { } bool TemperedLB::isUnderloaded(LoadType load) const { - return load < target_max_load_.seconds() * temperedlb_load_threshold; + return load < target_max_load_ * temperedlb_load_threshold; } bool TemperedLB::isOverloaded(LoadType load) const { - return load > target_max_load_.seconds() * temperedlb_load_threshold; + return load > target_max_load_ * temperedlb_load_threshold; } /*static*/ std::unordered_map @@ -423,7 +423,7 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) { void TemperedLB::runLB(LoadType total_load) { bool should_lb = false; - this_load = total_load.seconds(); + this_load = total_load; stats = *getStats(); auto const avg = stats.at(lb::Statistic::Rank_load_modeled).at( @@ -444,13 +444,13 @@ void TemperedLB::runLB(LoadType total_load) { // we can't get the processor max lower than the max object load, so // modify the algorithm to define overloaded as exceeding the max // object load instead of the processor average load - target_max_load_ = TimeType{(pole > avg ? pole : avg)}; + target_max_load_ = (pole > avg ? pole : avg); } else { - target_max_load_ = TimeType{avg}; + target_max_load_ = avg; } if (avg > 0.0000000001) { - should_lb = max > (run_temperedlb_tolerance + 1.0) * target_max_load_.seconds(); + should_lb = max > (run_temperedlb_tolerance + 1.0) * target_max_load_; } if (theContext()->getNode() == 0) { @@ -470,7 +470,7 @@ void TemperedLB::runLB(LoadType total_load) { } if (should_lb) { - doLBStages(TimeType{imb}); + doLBStages(imb); } } @@ -551,7 +551,7 @@ void TemperedLB::doLBStages(LoadType start_imb) { // Perform the reduction for Rank_load_modeled -> processor load only proxy_.allreduce<&TemperedLB::loadStatsHandler, collective::PlusOp>( std::vector{ - {balance::LoadData{Statistic::Rank_load_modeled, TimeType{this_new_load_}}} + {balance::LoadData{Statistic::Rank_load_modeled, this_new_load_}} } ); }); @@ -910,7 +910,7 @@ std::vector TemperedLB::createCMF(NodeSetType const& under) { switch (cmf_type_) { case CMFTypeEnum::Original: - factor = 1.0 / target_max_load_.seconds(); + factor = 1.0 / target_max_load_; break; case CMFTypeEnum::NormBySelf: factor = 1.0 / this_new_load_; @@ -927,7 +927,7 @@ std::vector TemperedLB::createCMF(NodeSetType const& under) { l_max = load; } } - factor = 1.0 / (l_max > target_max_load_.seconds() ? l_max : target_max_load_.seconds()); + factor = 1.0 / (l_max > target_max_load_ ? l_max : target_max_load_); } break; default: @@ -998,7 +998,7 @@ std::vector TemperedLB::makeSufficientlyUnderloaded( std::vector sufficiently_under = {}; for (auto&& elm : load_info_) { bool eval = Criterion(criterion_)( - this_new_load_, elm.second, load_to_accommodate.seconds(), target_max_load_.seconds() + this_new_load_, elm.second, load_to_accommodate, target_max_load_ ); if (eval) { sufficiently_under.push_back(elm.first); @@ -1052,12 +1052,12 @@ std::vector TemperedLB::orderObjects( { // first find the load of the smallest single object that, if migrated // away, could bring this processor's load below the target load - auto over_avg = this_new_load - target_max_load.seconds(); + auto over_avg = this_new_load - target_max_load; // if no objects are larger than over_avg, then single_obj_load will still // (incorrectly) reflect the total load, which will not be a problem auto single_obj_load = this_new_load; for (auto &obj : cur_objs) { - auto obj_load = obj.second.seconds(); + auto obj_load = obj.second; if (obj_load > over_avg && obj_load < single_obj_load) { single_obj_load = obj_load; } @@ -1069,8 +1069,8 @@ std::vector TemperedLB::orderObjects( [&cur_objs, single_obj_load]( const ObjIDType &left, const ObjIDType &right ) { - auto left_load = cur_objs[left].seconds(); - auto right_load = cur_objs[right].seconds(); + auto left_load = cur_objs[left]; + auto right_load = cur_objs[right]; if (left_load <= single_obj_load && right_load <= single_obj_load) { // we're in the sort load descending regime (first section) return left_load > right_load; @@ -1101,7 +1101,7 @@ std::vector TemperedLB::orderObjects( // first find the smallest object that, if migrated away along with all // smaller objects, could bring this processor's load below the target // load - auto over_avg = this_new_load - target_max_load.seconds(); + auto over_avg = this_new_load - target_max_load; std::sort( ordered_obj_ids.begin(), ordered_obj_ids.end(), [&cur_objs](const ObjIDType &left, const ObjIDType &right) { @@ -1112,9 +1112,9 @@ std::vector TemperedLB::orderObjects( } ); auto cum_obj_load = this_new_load; - auto single_obj_load = cur_objs[ordered_obj_ids[0]].seconds(); + auto single_obj_load = cur_objs[ordered_obj_ids[0]]; for (auto obj_id : ordered_obj_ids) { - auto this_obj_load = cur_objs[obj_id].seconds(); + auto this_obj_load = cur_objs[obj_id]; if (cum_obj_load - this_obj_load < over_avg) { single_obj_load = this_obj_load; break; @@ -1130,8 +1130,8 @@ std::vector TemperedLB::orderObjects( [&cur_objs, single_obj_load]( const ObjIDType &left, const ObjIDType &right ) { - auto left_load = cur_objs[left].seconds(); - auto right_load = cur_objs[right].seconds(); + auto left_load = cur_objs[left]; + auto right_load = cur_objs[right]; if (left_load <= single_obj_load && right_load <= single_obj_load) { // we're in the sort load descending regime (first section) return left_load > right_load; @@ -1234,7 +1234,7 @@ void TemperedLB::decide() { auto& selected_load = load_iter->second; bool eval = Criterion(criterion_)( - this_new_load_, selected_load, obj_load.seconds(), target_max_load_.seconds() + this_new_load_, selected_load, obj_load, target_max_load_ ); vt_debug_print( @@ -1260,10 +1260,10 @@ void TemperedLB::decide() { ++n_transfers; // transfer the object load in seconds // to match the object load units on the receiving end - migrate_objs[selected_node][obj_id] = obj_load.seconds(); + migrate_objs[selected_node][obj_id] = obj_load; - this_new_load_ -= obj_load.seconds(); - selected_load += obj_load.seconds(); + this_new_load_ -= obj_load; + selected_load += obj_load; iter = ordered_obj_ids.erase(iter); cur_objs_.erase(obj_id); @@ -1272,7 +1272,7 @@ void TemperedLB::decide() { iter++; } - if (not (this_new_load_ > target_max_load_.seconds())) { + if (not (this_new_load_ > target_max_load_)) { break; } } diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h index b689507556..30b6247ed2 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h @@ -41,6 +41,7 @@ //@HEADER */ +#include "vt/configs/types/types_type.h" #if !defined INCLUDED_VT_VRT_COLLECTION_BALANCE_TEMPEREDLB_TEMPEREDLB_H #define INCLUDED_VT_VRT_COLLECTION_BALANCE_TEMPEREDLB_TEMPEREDLB_H @@ -104,7 +105,7 @@ struct TemperedLB : BaseLB { NodeType sampleFromCMF(NodeSetType const& under, std::vector const& cmf); std::vector makeUnderloaded() const; std::vector makeSufficientlyUnderloaded( - TimeType load_to_accommodate + LoadType load_to_accommodate ) const; ElementLoadType::iterator selectObject( LoadType size, ElementLoadType& load, std::set const& available diff --git a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc index cc7416e9ab..e457270424 100644 --- a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc +++ b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc @@ -131,7 +131,7 @@ void ZoltanLB::inputParams(balance::ConfigEntry* config) { void ZoltanLB::runLB(LoadType total_load) { auto const& this_node = theContext()->getNode(); - this_load = total_load.milliseconds(); + this_load = total_load; if (this_node == 0) { vt_debug_print(terse, lb, "ZoltanLB: runLB: edges={}\n", do_edges_); @@ -485,8 +485,7 @@ std::unique_ptr ZoltanLB::makeGraph() { obj, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE} ); - auto time = load.milliseconds(); - graph->vertex_weight[idx++] = time; + graph->vertex_weight[idx++] = loadMilli(load); } } diff --git a/tests/unit/collection/test_lb.extended.cc b/tests/unit/collection/test_lb.extended.cc index b9012b9d5c..0d01f82dca 100644 --- a/tests/unit/collection/test_lb.extended.cc +++ b/tests/unit/collection/test_lb.extended.cc @@ -736,7 +736,7 @@ TEST_P(TestDumpUserdefinedData, test_dump_userdefined_json) { lbdh.user_defined_json_[phase][elm_id] = std::make_shared( elm_ptr->toJson() ); - lbdh.node_data_[phase][elm_id].whole_phase_load = TimeType{1.0}; + lbdh.node_data_[phase][elm_id].whole_phase_load = 1.0; } } diff --git a/tests/unit/collection/test_lb_data_holder.cc b/tests/unit/collection/test_lb_data_holder.cc index e61c55d954..a5f9cb2c88 100644 --- a/tests/unit/collection/test_lb_data_holder.cc +++ b/tests/unit/collection/test_lb_data_holder.cc @@ -76,7 +76,7 @@ void addPhasesDataToJson(nlohmann::json& json, PhaseType amountOfPhasesToAdd, st LBDataHolder dh; for (unsigned i = 0; i < amountOfPhasesToAdd; i++) { for (auto&& elm : ids[i]) { - dh.node_data_[i][elm] = LoadSummary{TimeType{3.}}; + dh.node_data_[i][elm] = LoadSummary{3.}; } } diff --git a/tests/unit/collection/test_model_comm_overhead.nompi.cc b/tests/unit/collection/test_model_comm_overhead.nompi.cc index a74a17723c..e0a41aefcc 100644 --- a/tests/unit/collection/test_model_comm_overhead.nompi.cc +++ b/tests/unit/collection/test_model_comm_overhead.nompi.cc @@ -147,8 +147,8 @@ TEST_F(TestModelCommOverhead, test_model_comm_overhead_1) { } }; - constexpr auto per_msg_weight = TimeType{3.0}; - constexpr auto per_byte_weight = TimeType{5.0}; + constexpr auto per_msg_weight = 3.0; + constexpr auto per_byte_weight = 5.0; auto test_model = std::make_shared( std::make_shared(), per_msg_weight, per_byte_weight diff --git a/tests/unit/collection/test_model_norm.nompi.cc b/tests/unit/collection/test_model_norm.nompi.cc index 85711b7aa6..46e0e4f9ad 100644 --- a/tests/unit/collection/test_model_norm.nompi.cc +++ b/tests/unit/collection/test_model_norm.nompi.cc @@ -156,7 +156,7 @@ TEST_F(TestModelNorm, test_model_norm_2) { auto work_val = test_model->getModeledLoad(obj, PhaseOffset{0, PhaseOffset::WHOLE_PHASE}); - EXPECT_NEAR(work_val.seconds(), expected_norms[obj.id - 1].seconds(), 0.001); + EXPECT_NEAR(work_val, expected_norms[obj.id - 1], 0.001); } EXPECT_EQ(objects_seen, 2); diff --git a/tests/unit/collection/test_model_weighted_messages.nompi.cc b/tests/unit/collection/test_model_weighted_messages.nompi.cc index 5e8949990e..a674f6ec3a 100644 --- a/tests/unit/collection/test_model_weighted_messages.nompi.cc +++ b/tests/unit/collection/test_model_weighted_messages.nompi.cc @@ -141,8 +141,8 @@ TEST_F(TestModelWeightedMessages, test_model) { } }; - constexpr auto per_msg_weight = TimeType{3.0}; - constexpr auto per_byte_weight = TimeType{5.0}; + constexpr auto per_msg_weight = 3.0; + constexpr auto per_byte_weight = 5.0; auto test_model = std::make_shared( std::make_shared(), per_msg_weight, per_byte_weight diff --git a/tests/unit/lb/test_offlinelb.cc b/tests/unit/lb/test_offlinelb.cc index e0f6dda52f..981e09d801 100644 --- a/tests/unit/lb/test_offlinelb.cc +++ b/tests/unit/lb/test_offlinelb.cc @@ -112,7 +112,7 @@ TEST_F(TestOfflineLB, test_offlinelb_1) { LBDataHolder dh; for (PhaseType i = 0; i < num_phases; i++) { for (auto&& elm : ids[i]) { - dh.node_data_[i][elm] = LoadSummary{TimeType{3}}; + dh.node_data_[i][elm] = LoadSummary{3}; } } diff --git a/tests/unit/lb/test_temperedlb.nompi.cc b/tests/unit/lb/test_temperedlb.nompi.cc index 9f3cfeac57..a2140ae2b4 100644 --- a/tests/unit/lb/test_temperedlb.nompi.cc +++ b/tests/unit/lb/test_temperedlb.nompi.cc @@ -82,9 +82,9 @@ void orderAndVerify( // have TemperedLB order the objects auto ordered_objs = use_tempered_wmin ? vt::vrt::collection::lb::TemperedWMin::orderObjects( - order, cur_objs, my_load.seconds(), target_load) : + order, cur_objs, my_load, target_load) : vt::vrt::collection::lb::TemperedLB::orderObjects( - order, cur_objs, my_load.seconds(), target_load); + order, cur_objs, my_load, target_load); // verify correctness of the returned ordering int i = 0; diff --git a/tests/unit/scheduler/test_scheduler_timings.cc b/tests/unit/scheduler/test_scheduler_timings.cc index 15c76c9246..2d61d49cce 100644 --- a/tests/unit/scheduler/test_scheduler_timings.cc +++ b/tests/unit/scheduler/test_scheduler_timings.cc @@ -101,7 +101,7 @@ void myHandler(MyMsg* msg) { auto load = 1000.0* data->getLoad(0); fmt::print("expected time={}, observed time={}\n", time, load); double margin = 30+ time*0.20; - if ((time - load.seconds())< margin) { num_pass++; } + if ((time - load)< margin) { num_pass++; } } EXPECT_GT (num_pass, num_iter - num_pass);