Skip to content

Commit

Permalink
#1934: Reaply interface changes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable committed Dec 11, 2023
1 parent bdbfbdf commit e91de3d
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void LBManager::setLoadModel(std::shared_ptr<LoadModel> model) {

model_ = model;
model_->setLoads(nlb_data->getNodeLoad(),
nlb_data->getNodeComm(),
nlb_data->getUserData());
nlb_data->getNodeComm());

// Adjust buffers size on the objs in collection
runInEpochCollective("LBManager: setLoadModel", [=] {
Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/comm_overhead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ CommOverhead::CommOverhead(
per_byte_weight_(in_per_byte_weight)
{ }

void CommOverhead::setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) {
void CommOverhead::setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) {
proc_comm_ = proc_comm;
ComposedModel::setLoads(proc_load, proc_comm, user_data);
}
Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/comm_overhead.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ struct CommOverhead : public ComposedModel {
LoadType in_per_byte_weight
);

void setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) override;
void setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) override;

LoadType getModeledLoad(ElementIDStruct object, PhaseOffset when) const override;

Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/composed_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

namespace vt { namespace vrt { namespace collection { namespace balance {

void ComposedModel::setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) {
void ComposedModel::setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) {
base_->setLoads(proc_load, proc_comm, user_data);
}

Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/composed_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ class ComposedModel : public LoadModel
// \param[in] base must not be null
explicit ComposedModel(std::shared_ptr<LoadModel> base) : base_(base) {}

void setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) override;
void setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) override;

void updateLoads(PhaseType last_completed_phase) override;

Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/load_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ struct LoadModel
* passed a new model instance for a collection
*/
virtual void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data
) = 0;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/per_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void PerCollection::addModel(CollectionID proxy, std::shared_ptr<LoadModel> mode
models_[proxy] = model;
}

void PerCollection::setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) {
void PerCollection::setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) {
for (auto& m : models_)
m.second->setLoads(proc_load, proc_comm, user_data);
ComposedModel::setLoads(proc_load, proc_comm, user_data);
Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/per_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ struct PerCollection : public ComposedModel
*/
void addModel(CollectionID proxy, std::shared_ptr<LoadModel> model);

void setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) override;
void setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) override;

void updateLoads(PhaseType last_completed_phase) override;

Expand Down
8 changes: 4 additions & 4 deletions src/vt/vrt/collection/balance/model/raw_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ void RawData::updateLoads(PhaseType last_completed_phase) {
last_completed_phase_ = last_completed_phase;
}

void RawData::setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data)
void RawData::setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data)
{
proc_load_ = proc_load;
proc_comm_ = proc_comm;
Expand Down Expand Up @@ -118,7 +118,7 @@ ElmUserDataType RawData::getUserData(ElementIDStruct object, PhaseOffset offset)
"RawData makes no predictions. Compose with NaivePersistence or some longer-range forecasting model as needed");

auto phase = getNumCompletedPhases() + offset.phases;
if (user_data_->find(phase) != user_data_->end()) {
if (user_data_->contains(phase)) {
auto& phase_data = user_data_->at(phase);
if (phase_data.find(object) != phase_data.end()) {
return phase_data.at(object);
Expand Down
12 changes: 6 additions & 6 deletions src/vt/vrt/collection/balance/model/raw_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ struct RawData : public LoadModel {
bool hasUserData() const override { return user_data_ != nullptr; }
ElmUserDataType getUserData(ElementIDStruct object, PhaseOffset when) const override;

void setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data) override;
void setLoads(vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data) override;

ObjectIterator begin() const override;

Expand All @@ -77,9 +77,9 @@ struct RawData : public LoadModel {
unsigned int getNumPastPhasesNeeded(unsigned int look_back) const override;

// Observer pointers to the underlying data. In operation, these would be owned by NodeLBData
std::unordered_map<PhaseType, LoadMapType> const* proc_load_;
std::unordered_map<PhaseType, CommMapType> const* proc_comm_;
std::unordered_map<PhaseType, DataMapType> const* user_data_;
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load_;
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm_;
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data_;
PhaseType last_completed_phase_ = ~0;
}; // class RawData

Expand Down
6 changes: 3 additions & 3 deletions src/vt/vrt/collection/balance/model/weighted_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ struct WeightedMessages : public ComposedModel {
per_byte_weight_(in_per_byte_weight) { }

void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const* proc_comm,
std::unordered_map<PhaseType, DataMapType> const* user_data
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const* proc_comm,
vt::util::container::CircularPhasesBuffer<DataMapType> const* user_data
) override {
proc_comm_ = proc_comm;
ComposedModel::setLoads(proc_load, proc_comm, user_data);
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/collection/test_model_comm_overhead.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ using vt::vrt::collection::balance::SubphaseLoadMapType;
using vt::vrt::collection::balance::LoadMapObjectIterator;
using vt::vrt::collection::balance::DataMapType;

using ProcLoadMap = std::unordered_map<PhaseType, LoadMapType>;
using ProcSubphaseLoadMap = std::unordered_map<PhaseType, SubphaseLoadMapType>;
using ProcCommMap = std::unordered_map<PhaseType, CommMapType>;
using UserDataMap = std::unordered_map<PhaseType, DataMapType>;
using ProcLoadMap = vt::util::container::CircularPhasesBuffer<LoadMapType>;
using ProcSubphaseLoadMap = vt::util::container::CircularPhasesBuffer<SubphaseLoadMapType>;
using ProcCommMap = vt::util::container::CircularPhasesBuffer<CommMapType>;
using UserDataMap = vt::util::container::CircularPhasesBuffer<DataMapType>;

static auto num_phases = 0;

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_model_linear_model.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ struct StubModel : LoadModel {
virtual ~StubModel() = default;

void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const*,
std::unordered_map<PhaseType, DataMapType> const*) override {
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const*,
vt::util::container::CircularPhasesBuffer<DataMapType> const*) override {
proc_load_ = proc_load;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_model_multiple_phases.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ struct StubModel : LoadModel {
virtual ~StubModel() = default;

void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const*,
std::unordered_map<PhaseType, DataMapType> const*) override {
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const*,
vt::util::container::CircularPhasesBuffer<DataMapType> const*) override {
proc_load_ = proc_load;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_model_naive_persistence.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ struct StubModel : LoadModel {
virtual ~StubModel() = default;

void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const*,
std::unordered_map<PhaseType, DataMapType> const*) override {
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const*,
vt::util::container::CircularPhasesBuffer<DataMapType> const*) override {
proc_load_ = proc_load;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/collection/test_model_norm.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ using vt::vrt::collection::balance::SubphaseLoadMapType;
using vt::vrt::collection::balance::LoadMapObjectIterator;
using vt::vrt::collection::balance::DataMapType;

using ProcLoadMap = std::unordered_map<PhaseType, LoadMapType>;
using ProcSubphaseLoadMap = std::unordered_map<PhaseType, SubphaseLoadMapType>;
using ProcCommMap = std::unordered_map<PhaseType, CommMapType>;
using UserDataMap = std::unordered_map<PhaseType, DataMapType>;
using ProcLoadMap = vt::util::container::CircularPhasesBuffer<LoadMapType>;
using ProcSubphaseLoadMap = vt::util::container::CircularPhasesBuffer<SubphaseLoadMapType>;
using ProcCommMap = vt::util::container::CircularPhasesBuffer<CommMapType>;
using UserDataMap = vt::util::container::CircularPhasesBuffer<DataMapType>;

constexpr auto num_subphases = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ struct StubModel : LoadModel {
virtual ~StubModel() = default;

void setLoads(
std::unordered_map<PhaseType, LoadMapType> const* proc_load,
std::unordered_map<PhaseType, CommMapType> const*,
std::unordered_map<PhaseType, DataMapType> const*) override {
vt::util::container::CircularPhasesBuffer<LoadMapType> const* proc_load,
vt::util::container::CircularPhasesBuffer<CommMapType> const*,
vt::util::container::CircularPhasesBuffer<DataMapType> const*) override {
proc_load_ = proc_load;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_model_raw_data.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TEST_F(TestRawData, test_model_raw_data_scalar) {
auto test_model =
std::make_shared<RawData>();

std::unordered_map<PhaseType, LoadMapType> proc_loads;
vt::util::container::CircularPhasesBuffer<LoadMapType> proc_loads;
test_model->setLoads(&proc_loads, nullptr, nullptr);
EXPECT_TRUE(test_model->hasRawLoad());
EXPECT_FALSE(test_model->hasUserData()); // because passed a nullptr
Expand Down Expand Up @@ -129,8 +129,8 @@ TEST_F(TestRawData, test_model_raw_user_data) {
auto test_model =
std::make_shared<RawData>();

std::unordered_map<PhaseType, LoadMapType> proc_loads;
std::unordered_map<PhaseType, DataMapType> user_data;
vt::util::container::CircularPhasesBuffer<LoadMapType> proc_loads;
vt::util::container::CircularPhasesBuffer<DataMapType> user_data;
test_model->setLoads(&proc_loads, nullptr, &user_data);
EXPECT_TRUE(test_model->hasRawLoad());
EXPECT_TRUE(test_model->hasUserData());
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/collection/test_model_select_subphases.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ using vt::vrt::collection::balance::SubphaseLoadMapType;
using vt::vrt::collection::balance::LoadMapObjectIterator;
using vt::vrt::collection::balance::DataMapType;

using ProcLoadMap = std::unordered_map<PhaseType, LoadMapType>;
using ProcSubphaseLoadMap = std::unordered_map<PhaseType, SubphaseLoadMapType>;
using ProcCommMap = std::unordered_map<PhaseType, CommMapType>;
using UserDataMap = std::unordered_map<PhaseType, DataMapType>;
using ProcLoadMap = vt::util::container::CircularPhasesBuffer<LoadMapType>;
using ProcSubphaseLoadMap = vt::util::container::CircularPhasesBuffer<SubphaseLoadMapType>;
using ProcCommMap = vt::util::container::CircularPhasesBuffer<CommMapType>;
using UserDataMap = vt::util::container::CircularPhasesBuffer<DataMapType>;

constexpr auto num_subphases = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ using vt::vrt::collection::balance::PhaseOffset;
using vt::vrt::collection::balance::LoadMapObjectIterator;
using vt::vrt::collection::balance::DataMapType;

using ProcLoadMap = std::unordered_map<PhaseType, LoadMapType>;
using ProcCommMap = std::unordered_map<PhaseType, CommMapType>;
using UserDataMap = std::unordered_map<PhaseType, DataMapType>;
using ProcLoadMap = vt::util::container::CircularPhasesBuffer<LoadMapType>;
using ProcCommMap = vt::util::container::CircularPhasesBuffer<CommMapType>;
using UserDataMap = vt::util::container::CircularPhasesBuffer<DataMapType>;

static auto num_phases = 0;

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_model_weighted_messages.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ using vt::vrt::collection::balance::PhaseOffset;
using vt::vrt::collection::balance::LoadMapObjectIterator;
using vt::vrt::collection::balance::DataMapType;

using ProcLoadMap = std::unordered_map<PhaseType, LoadMapType>;
using ProcCommMap = std::unordered_map<PhaseType, CommMapType>;
using UserDataMap = std::unordered_map<PhaseType, DataMapType>;
using ProcLoadMap = vt::util::container::CircularPhasesBuffer<LoadMapType>;
using ProcCommMap = vt::util::container::CircularPhasesBuffer<CommMapType>;
using UserDataMap = vt::util::container::CircularPhasesBuffer<DataMapType>;

static auto num_phases = 0;

Expand Down

0 comments on commit e91de3d

Please sign in to comment.