Skip to content

Commit edd172e

Browse files
committed
#2150: Resolve conflicts and compile issues
1 parent 0dbe9ed commit edd172e

26 files changed

+112
-110
lines changed

src/vt/elm/elm_lb_data.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void ElementLBData::stop(TimeType time) {
6969
auto const started = cur_time_started_;
7070
if (started) {
7171
cur_time_started_ = false;
72-
addTime(total_time);
72+
addTime(total_time.seconds());
7373
}
7474

7575
vt_debug_print(
@@ -124,11 +124,11 @@ void ElementLBData::recvToNode(
124124
recvComm(key, bytes);
125125
}
126126

127-
void ElementLBData::addTime(TimeType const& time) {
128-
phase_timings_[cur_phase_] += time;
127+
void ElementLBData::addTime(LoadType const timeLoad) {
128+
phase_timings_[cur_phase_] += timeLoad;
129129

130130
subphase_timings_[cur_phase_].resize(cur_subphase_ + 1);
131-
subphase_timings_[cur_phase_].at(cur_subphase_) += time;
131+
subphase_timings_[cur_phase_].at(cur_subphase_) += timeLoad;
132132

133133
vt_debug_print(
134134
verbose,lb,
@@ -163,7 +163,7 @@ PhaseType ElementLBData::getPhase() const {
163163
return cur_phase_;
164164
}
165165

166-
TimeType ElementLBData::getLoad(PhaseType const& phase) const {
166+
LoadType ElementLBData::getLoad(PhaseType const& phase) const {
167167
auto iter = phase_timings_.find(phase);
168168
if (iter != phase_timings_.end()) {
169169
auto const total_load = phase_timings_.at(phase);
@@ -176,11 +176,11 @@ TimeType ElementLBData::getLoad(PhaseType const& phase) const {
176176

177177
return total_load;
178178
} else {
179-
return TimeType{0.0};
179+
return 0.0;
180180
}
181181
}
182182

183-
TimeType
183+
LoadType
184184
ElementLBData::getLoad(PhaseType phase, SubphaseType subphase) const {
185185
if (subphase == no_subphase)
186186
return getLoad(phase);
@@ -199,7 +199,7 @@ ElementLBData::getLoad(PhaseType phase, SubphaseType subphase) const {
199199
return total_load;
200200
}
201201

202-
std::vector<TimeType> const& ElementLBData::getSubphaseTimes(PhaseType phase) {
202+
std::vector<LoadType> const& ElementLBData::getSubphaseTimes(PhaseType phase) {
203203
return subphase_timings_[phase];
204204
}
205205

src/vt/elm/elm_lb_data.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct ElementLBData {
6363

6464
void start(TimeType time);
6565
void stop(TimeType time);
66-
void addTime(TimeType const& time);
66+
void addTime(LoadType const timeLoad);
6767

6868
void sendToEntity(ElementIDStruct to, ElementIDStruct from, double bytes);
6969
void sendComm(elm::CommKey key, double bytes);
@@ -84,12 +84,12 @@ struct ElementLBData {
8484
void updatePhase(PhaseType const& inc = 1);
8585
void resetPhase();
8686
PhaseType getPhase() const;
87-
TimeType getLoad(PhaseType const& phase) const;
88-
TimeType getLoad(PhaseType phase, SubphaseType subphase) const;
87+
LoadType getLoad(PhaseType const& phase) const;
88+
LoadType getLoad(PhaseType phase, SubphaseType subphase) const;
8989

9090
CommMapType const& getComm(PhaseType const& phase);
9191
std::vector<CommMapType> const& getSubphaseComm(PhaseType phase);
92-
std::vector<TimeType> const& getSubphaseTimes(PhaseType phase);
92+
std::vector<LoadType> const& getSubphaseTimes(PhaseType phase);
9393
void setSubPhase(SubphaseType subphase);
9494
SubphaseType getSubPhase() const;
9595

@@ -126,11 +126,11 @@ struct ElementLBData {
126126
bool cur_time_started_ = false;
127127
TimeType cur_time_ = TimeType{0.0};
128128
PhaseType cur_phase_ = fst_lb_phase;
129-
std::unordered_map<PhaseType, TimeType> phase_timings_ = {};
129+
std::unordered_map<PhaseType, LoadType> phase_timings_ = {};
130130
std::unordered_map<PhaseType, CommMapType> phase_comm_ = {};
131131

132132
SubphaseType cur_subphase_ = 0;
133-
std::unordered_map<PhaseType, std::vector<TimeType>> subphase_timings_ = {};
133+
std::unordered_map<PhaseType, std::vector<LoadType>> subphase_timings_ = {};
134134
std::unordered_map<PhaseType, std::vector<CommMapType>> subphase_comm_ = {};
135135
};
136136

src/vt/vrt/collection/balance/baselb/baselb.h

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ struct BaseLB {
141141
TransferMsg<ObjLoadListType>* msg
142142
);
143143

144+
LoadType loadMilli(LoadType const& load);
145+
144146
void applyMigrations(
145147
TransferVecType const& transfers, MigrationCountCB migration_count_callback
146148
);

src/vt/vrt/collection/balance/baselb/load_sampler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ namespace vt { namespace vrt { namespace collection { namespace lb {
4949

5050
void LoadSamplerBaseLB::buildHistogram() {
5151
for (auto obj : *load_model_) {
52-
TimeType load = load_model_->getModeledLoad(
52+
auto load = load_model_->getModeledLoad(
5353
obj, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE}
5454
);
55-
auto const& load_milli = load.milliseconds();
55+
auto const& load_milli = loadMilli(load);
5656
auto const& bin = histogramSample(load_milli);
5757
if (obj.isMigratable()) {
5858
obj_sample[bin].push_back(obj);

src/vt/vrt/collection/balance/greedylb/greedylb.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ void GreedyLB::loadOverBin(ObjBinType bin, ObjBinListType& bin_list) {
412412
load_over[bin].push_back(obj_id);
413413
bin_list.pop_back();
414414

415-
auto const& obj_time_milli = load_model_->getModeledLoad(
415+
auto const& obj_time_milli = loadMilli(load_model_->getModeledLoad(
416416
obj_id, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE}
417-
).milliseconds();
417+
));
418418

419419
this_load -= obj_time_milli;
420420

src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ void HierarchicalLB::loadOverBin(ObjBinType bin, ObjBinListType& bin_list) {
312312
load_over[bin].push_back(obj_id);
313313
bin_list.pop_back();
314314

315-
auto const& obj_time_milli = load_model_->getModeledLoad(obj_id,
315+
auto const& obj_time_milli = loadMilli(load_model_->getModeledLoad(obj_id,
316316
{balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE}
317-
).milliseconds();
317+
));
318318

319319
this_load -= obj_time_milli;
320320

src/vt/vrt/collection/balance/lb_common.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ LoadSummary getNodeLoads(std::shared_ptr<LoadModel> model, PhaseOffset when)
102102
LoadSummary ret;
103103

104104
auto subphases = model->getNumSubphases();
105-
ret.subphase_loads.resize(subphases, TimeType{0.0});
105+
ret.subphase_loads.resize(subphases, 0.0);
106106

107107
for (auto obj : *model) {
108108
ret += getObjectLoads(model, obj, when);

src/vt/vrt/collection/balance/lb_data_holder.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ std::unique_ptr<nlohmann::json> LBDataHolder::toJson(PhaseType phase) const {
138138
LoadType time = elm.second.whole_phase_load;
139139
j["tasks"][i]["resource"] = "cpu";
140140
j["tasks"][i]["node"] = id.getCurrNode();
141-
j["tasks"][i]["time"] = time.seconds();
141+
j["tasks"][i]["time"] = time;
142142
if (user_defined_json_.find(phase) != user_defined_json_.end()) {
143143
auto &user_def_this_phase = user_defined_json_.at(phase);
144144
if (user_def_this_phase.find(id) != user_def_this_phase.end()) {
@@ -155,7 +155,7 @@ std::unique_ptr<nlohmann::json> LBDataHolder::toJson(PhaseType phase) const {
155155
if (subphases != 0) {
156156
for (std::size_t s = 0; s < subphases; s++) {
157157
j["tasks"][i]["subphases"][s]["id"] = s;
158-
j["tasks"][i]["subphases"][s]["time"] = subphase_times[s].seconds();
158+
j["tasks"][i]["subphases"][s]["time"] = subphase_times[s];
159159
}
160160
}
161161

@@ -251,7 +251,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j)
251251
vtAssertExpr(object.is_number());
252252

253253
auto elm = ElementIDStruct{object, node};
254-
this->node_data_[id][elm].whole_phase_load = TimeType{time};
254+
this->node_data_[id][elm].whole_phase_load = time;
255255

256256
if (
257257
task["entity"].find("collection_id") != task["entity"].end() and
@@ -278,7 +278,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j)
278278

279279
this->node_data_[id][elm].subphase_loads.resize(
280280
static_cast<std::size_t>(sid) + 1);
281-
this->node_data_[id][elm].subphase_loads[sid] = TimeType{stime};
281+
this->node_data_[id][elm].subphase_loads[sid] = stime;
282282
}
283283
}
284284
}

src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc

+22-21
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
#include "vt/config.h"
4545
#include "vt/configs/arguments/app_config.h"
46+
#include "vt/configs/types/types_type.h"
4647
#include "vt/context/context.h"
4748
#include "vt/phase/phase_hook_enum.h"
4849
#include "vt/vrt/collection/balance/baselb/baselb.h"
@@ -499,31 +500,31 @@ void LBManager::statsHandler(std::vector<balance::LoadData> const& in_stat_vec)
499500
auto skew = st.skew();
500501
auto krte = st.krte();
501502

502-
stats[stat][lb::StatisticQuantity::max] = max.seconds();
503-
stats[stat][lb::StatisticQuantity::min] = min.seconds();
504-
stats[stat][lb::StatisticQuantity::avg] = avg.seconds();
505-
stats[stat][lb::StatisticQuantity::sum] = sum.seconds();
503+
stats[stat][lb::StatisticQuantity::max] = max;
504+
stats[stat][lb::StatisticQuantity::min] = min;
505+
stats[stat][lb::StatisticQuantity::avg] = avg;
506+
stats[stat][lb::StatisticQuantity::sum] = sum;
506507
stats[stat][lb::StatisticQuantity::npr] = npr;
507508
stats[stat][lb::StatisticQuantity::car] = car;
508-
stats[stat][lb::StatisticQuantity::var] = var.seconds();
509+
stats[stat][lb::StatisticQuantity::var] = var;
509510
stats[stat][lb::StatisticQuantity::npr] = npr;
510-
stats[stat][lb::StatisticQuantity::imb] = imb.seconds();
511-
stats[stat][lb::StatisticQuantity::std] = stdv.seconds();
512-
stats[stat][lb::StatisticQuantity::skw] = skew.seconds();
513-
stats[stat][lb::StatisticQuantity::kur] = krte.seconds();
511+
stats[stat][lb::StatisticQuantity::imb] = imb;
512+
stats[stat][lb::StatisticQuantity::std] = stdv;
513+
stats[stat][lb::StatisticQuantity::skw] = skew;
514+
stats[stat][lb::StatisticQuantity::kur] = krte;
514515

515516
if (stat == rank_statistic) {
516517
if (before_lb_stats_) {
517-
last_phase_info_->max_load = max.seconds();
518-
last_phase_info_->avg_load = avg.seconds();
519-
last_phase_info_->imb_load = imb.seconds();
518+
last_phase_info_->max_load = max;
519+
last_phase_info_->avg_load = avg;
520+
last_phase_info_->imb_load = imb;
520521
} else {
521-
last_phase_info_->max_load_post_lb = max.seconds();
522-
last_phase_info_->avg_load_post_lb = avg.seconds();
523-
last_phase_info_->imb_load_post_lb = imb.seconds();
522+
last_phase_info_->max_load_post_lb = max;
523+
last_phase_info_->avg_load_post_lb = avg;
524+
last_phase_info_->imb_load_post_lb = imb;
524525
}
525526
} else if (stat == obj_statistic and before_lb_stats_) {
526-
last_phase_info_->max_obj = max.seconds();
527+
last_phase_info_->max_obj = max;
527528
}
528529

529530
if (theContext()->getNode() == 0) {
@@ -607,7 +608,7 @@ void LBManager::commitPhaseStatistics(PhaseType phase) {
607608
balance::LoadData reduceVec(
608609
lb::Statistic stat, std::vector<balance::LoadData>&& vec
609610
) {
610-
balance::LoadData reduce_ld(stat, TimeType{0.0});
611+
balance::LoadData reduce_ld(stat, 0.0);
611612
if (vec.size() == 0) {
612613
return reduce_ld;
613614
} else {
@@ -631,7 +632,7 @@ void LBManager::computeStatistics(
631632
balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE
632633
};
633634

634-
total_load_from_model = TimeType{0.};
635+
total_load_from_model = 0.;
635636
std::vector<balance::LoadData> obj_load_model;
636637
for (auto elm : *model) {
637638
auto work = model->getModeledLoad(elm, when);
@@ -669,7 +670,7 @@ void LBManager::computeStatistics(
669670
));
670671

671672
if (strategy_specific_model_) {
672-
TimeType rank_strat_specific_load = TimeType{0.};
673+
LoadType rank_strat_specific_load = 0.;
673674
std::vector<balance::LoadData> obj_strat_specific_load;
674675
for (auto elm : *strategy_specific_model_) {
675676
auto work = strategy_specific_model_->getModeledLoad(elm, when);
@@ -703,7 +704,7 @@ void LBManager::computeStatistics(
703704
for (auto&& elm : *comm_data) {
704705
// Only count object-to-object direct edges in the Object_comm statistics
705706
if (elm.first.cat_ == elm::CommCategory::SendRecv and not elm.first.selfEdge()) {
706-
obj_comm.emplace_back(LoadData{lb::Statistic::Object_comm, TimeType{elm.second.bytes}});
707+
obj_comm.emplace_back(LoadData{lb::Statistic::Object_comm, elm.second.bytes});
707708
}
708709

709710
if (not comm_collectives and isCollectiveComm(elm.first.cat_)) {
@@ -716,7 +717,7 @@ void LBManager::computeStatistics(
716717
comm_load += elm.second.bytes;
717718
}
718719

719-
lstats.emplace_back(LoadData{lb::Statistic::Rank_comm, TimeType{comm_load}});
720+
lstats.emplace_back(LoadData{lb::Statistic::Rank_comm, comm_load});
720721
lstats.emplace_back(reduceVec(
721722
lb::Statistic::Object_comm, std::move(obj_comm)
722723
));

src/vt/vrt/collection/balance/model/linear_model.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ LoadType LinearModel::getModeledLoad(ElementIDStruct object, PhaseOffset when) c
6565
for (int i = -1 * static_cast<int>(phases); i < 0; i++) {
6666
x.emplace_back(i);
6767
past_phase.phases = i;
68-
y.emplace_back(ComposedModel::getModeledLoad(object, past_phase).seconds());
68+
y.emplace_back(ComposedModel::getModeledLoad(object, past_phase));
6969
}
7070

7171
// should we re-create this every time?
7272
LinearRegression regression{x, y};
73-
return TimeType{regression.predict(when.phases)};
73+
return regression.predict(when.phases);
7474
}
7575

7676
unsigned int LinearModel::getNumPastPhasesNeeded(unsigned int look_back) const

src/vt/vrt/collection/balance/model/load_model.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct LoadModel
244244
vtAbort(
245245
"LoadModel::getRawLoad() called on a model that does not implement it"
246246
);
247-
return TimeType{0.0};
247+
return 0.0;
248248
};
249249

250250
/**

src/vt/vrt/collection/balance/model/norm.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,22 @@ LoadType Norm::getModeledLoad(ElementIDStruct object, PhaseOffset offset) const
6464

6565
for (int i = 0; i < getNumSubphases(); ++i) {
6666
offset.subphase = i;
67-
auto t = ComposedModel::getModeledLoad(object, offset).seconds();
67+
auto t = ComposedModel::getModeledLoad(object, offset);
6868
sum += std::pow(t, power_);
6969
}
7070

71-
return TimeType{std::pow(sum, 1.0/power_)};
71+
return std::pow(sum, 1.0/power_);
7272
} else {
7373
// l-infinity implies a max norm
7474
double max = 0.0;
7575

7676
for (int i = 0; i < getNumSubphases(); ++i) {
7777
offset.subphase = i;
78-
auto t = ComposedModel::getModeledLoad(object, offset).seconds();
78+
auto t = ComposedModel::getModeledLoad(object, offset);
7979
max = std::max(max, t);
8080
}
8181

82-
return TimeType{max};
82+
return max;
8383
}
8484
}
8585

src/vt/vrt/collection/balance/model/raw_data.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ LoadType RawData::getRawLoad(ElementIDStruct object, PhaseOffset offset) const {
107107
if (phase_data.find(object) != phase_data.end()) {
108108
return phase_data.at(object).get(offset);
109109
} else {
110-
return TimeType{0.0};
110+
return 0.0;
111111
}
112112
}
113113

src/vt/vrt/collection/balance/model/weighted_communication_volume.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ LoadType WeightedCommunicationVolume::getModeledLoad(
5050
ElementIDStruct object, PhaseOffset when
5151
) const {
5252
return alpha_ * ComposedModel::getModeledLoad(object, when) +
53-
beta_ * ComposedModel::getModeledComm(object, when) + TimeType{gamma_};
53+
beta_ * ComposedModel::getModeledComm(object, when) + gamma_;
5454
}
5555

5656
}}}} // namespace vt::vrt::collection::balance

0 commit comments

Comments
 (0)