Skip to content

Commit

Permalink
#2150: Resolve conflicts and compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Oct 6, 2023
1 parent 0dbe9ed commit edd172e
Show file tree
Hide file tree
Showing 26 changed files with 112 additions and 110 deletions.
16 changes: 8 additions & 8 deletions src/vt/elm/elm_lb_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -199,7 +199,7 @@ ElementLBData::getLoad(PhaseType phase, SubphaseType subphase) const {
return total_load;
}

std::vector<TimeType> const& ElementLBData::getSubphaseTimes(PhaseType phase) {
std::vector<LoadType> const& ElementLBData::getSubphaseTimes(PhaseType phase) {
return subphase_timings_[phase];
}

Expand Down
12 changes: 6 additions & 6 deletions src/vt/elm/elm_lb_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<CommMapType> const& getSubphaseComm(PhaseType phase);
std::vector<TimeType> const& getSubphaseTimes(PhaseType phase);
std::vector<LoadType> const& getSubphaseTimes(PhaseType phase);
void setSubPhase(SubphaseType subphase);
SubphaseType getSubPhase() const;

Expand Down Expand Up @@ -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<PhaseType, TimeType> phase_timings_ = {};
std::unordered_map<PhaseType, LoadType> phase_timings_ = {};
std::unordered_map<PhaseType, CommMapType> phase_comm_ = {};

SubphaseType cur_subphase_ = 0;
std::unordered_map<PhaseType, std::vector<TimeType>> subphase_timings_ = {};
std::unordered_map<PhaseType, std::vector<LoadType>> subphase_timings_ = {};
std::unordered_map<PhaseType, std::vector<CommMapType>> subphase_comm_ = {};
};

Expand Down
2 changes: 2 additions & 0 deletions src/vt/vrt/collection/balance/baselb/baselb.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ struct BaseLB {
TransferMsg<ObjLoadListType>* msg
);

LoadType loadMilli(LoadType const& load);

void applyMigrations(
TransferVecType const& transfers, MigrationCountCB migration_count_callback
);
Expand Down
4 changes: 2 additions & 2 deletions src/vt/vrt/collection/balance/baselb/load_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/vt/vrt/collection/balance/greedylb/greedylb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/lb_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ LoadSummary getNodeLoads(std::shared_ptr<LoadModel> 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);
Expand Down
8 changes: 4 additions & 4 deletions src/vt/vrt/collection/balance/lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ std::unique_ptr<nlohmann::json> 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()) {
Expand All @@ -155,7 +155,7 @@ std::unique_ptr<nlohmann::json> 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];
}
}

Expand Down Expand Up @@ -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
Expand All @@ -278,7 +278,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j)

this->node_data_[id][elm].subphase_loads.resize(
static_cast<std::size_t>(sid) + 1);
this->node_data_[id][elm].subphase_loads[sid] = TimeType{stime};
this->node_data_[id][elm].subphase_loads[sid] = stime;
}
}
}
Expand Down
43 changes: 22 additions & 21 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -499,31 +500,31 @@ void LBManager::statsHandler(std::vector<balance::LoadData> 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) {
Expand Down Expand Up @@ -607,7 +608,7 @@ void LBManager::commitPhaseStatistics(PhaseType phase) {
balance::LoadData reduceVec(
lb::Statistic stat, std::vector<balance::LoadData>&& vec
) {
balance::LoadData reduce_ld(stat, TimeType{0.0});
balance::LoadData reduce_ld(stat, 0.0);
if (vec.size() == 0) {
return reduce_ld;
} else {
Expand All @@ -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<balance::LoadData> obj_load_model;
for (auto elm : *model) {
auto work = model->getModeledLoad(elm, when);
Expand Down Expand Up @@ -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<balance::LoadData> obj_strat_specific_load;
for (auto elm : *strategy_specific_model_) {
auto work = strategy_specific_model_->getModeledLoad(elm, when);
Expand Down Expand Up @@ -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_)) {
Expand All @@ -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)
));
Expand Down
4 changes: 2 additions & 2 deletions src/vt/vrt/collection/balance/model/linear_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ LoadType LinearModel::getModeledLoad(ElementIDStruct object, PhaseOffset when) c
for (int i = -1 * static_cast<int>(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
Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/model/load_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/vt/vrt/collection/balance/model/norm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/model/raw_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit edd172e

Please sign in to comment.