Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2250: Remove count field from phases metadata #2252

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/JSON_data_files_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _get_valid_schema(self) -> Schema:
'num_nodes': int,
},
Optional('phases'): {
'count': int,
Optional('count'): int,
JacobDomagala marked this conversation as resolved.
Show resolved Hide resolved
'skipped': {
'list': [int],
'range': [[int]],
Expand Down
10 changes: 0 additions & 10 deletions src/vt/vrt/collection/balance/lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ std::unique_ptr<nlohmann::json> LBDataHolder::metadataToJson() const {
};

nlohmann::json j;
j["count"] = count_;

// Generate list and ranges of skipped phases
std::set<PhaseType> skipped_list;
Expand Down Expand Up @@ -264,7 +263,6 @@ std::unique_ptr<nlohmann::json> LBDataHolder::toJson(PhaseType phase) const {
}

LBDataHolder::LBDataHolder(nlohmann::json const& j)
: count_(0)
{
auto this_node = theContext()->getNode();

Expand Down Expand Up @@ -438,10 +436,6 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j)
}
}

if (!count_) {
count_ = node_data_.size();
}

// @todo: implement subphase communication de-serialization, no use for it
// right now, so it will be ignored
}
Expand All @@ -451,9 +445,6 @@ void LBDataHolder::readMetadata(nlohmann::json const& j) {
auto metadata = j["metadata"];
if (metadata.find("phases") != metadata.end()) {
auto phases = metadata["phases"];
// load count
vtAssertExpr(phases["count"].is_number());
count_ = phases["count"];
// load all skipped phases
auto sl = phases["skipped"]["list"];
if(sl.is_array()) {
Expand Down Expand Up @@ -507,7 +498,6 @@ void LBDataHolder::clear() {
node_data_.clear();
node_subphase_comm_.clear();
node_idx_.clear();
count_ = 0;
skipped_phases_.clear();
identical_phases_.clear();
}
Expand Down
3 changes: 0 additions & 3 deletions src/vt/vrt/collection/balance/lb_data_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ struct LBDataHolder {
s | user_defined_json_;
s | user_per_phase_json_;
s | node_idx_;
s | count_;
s | skipped_phases_;
s | identical_phases_;
s | user_defined_lb_info_;
Expand Down Expand Up @@ -156,8 +155,6 @@ struct LBDataHolder {
std::unordered_map<ElementIDStruct, std::tuple<VirtualProxyType, std::vector<uint64_t>>> node_idx_;
/// Map from id to objgroup proxy
std::unordered_map<ElementIDStruct, ObjGroupProxyType> node_objgroup_;
// Number of all phases including skipped and identical
PhaseType count_;
// Set of phases that are skipped
std::set<PhaseType> skipped_phases_;
// Set of phases which are identical to previous
Expand Down
10 changes: 0 additions & 10 deletions tests/unit/collection/test_lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ TEST_F(TestLBDataHolder, test_no_metadata) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand All @@ -106,7 +105,6 @@ TEST_F(TestLBDataHolder, test_no_metadata) {
auto outJsonPtr = testObj.metadataToJson();
ASSERT_TRUE(outJsonPtr != nullptr);

EXPECT_EQ((*outJsonPtr)["count"], num_phases);
std::vector<PhaseType> expectedSkippedList = {};
EXPECT_EQ((*outJsonPtr)["skipped"]["list"], expectedSkippedList);
std::vector<std::pair<PhaseType, PhaseType>> expectedSkippedRanges = {};
Expand All @@ -126,7 +124,6 @@ TEST_F(TestLBDataHolder, test_no_lb_phases_metadata) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand All @@ -135,7 +132,6 @@ TEST_F(TestLBDataHolder, test_no_lb_phases_metadata) {
auto outJsonPtr = testObj.metadataToJson();
ASSERT_TRUE(outJsonPtr != nullptr);

EXPECT_EQ((*outJsonPtr)["count"], num_phases);
std::vector<PhaseType> expectedSkippedList = {};
EXPECT_EQ((*outJsonPtr)["skipped"]["list"], expectedSkippedList);
std::vector<std::pair<PhaseType, PhaseType>> expectedSkippedRanges = {};
Expand All @@ -150,7 +146,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_empty) {
using LBDataHolder = vt::vrt::collection::balance::LBDataHolder;

nlohmann::json metadata, phasesMetadata, json;
phasesMetadata["count"] = num_phases;
phasesMetadata["skipped"]["list"] = {};
phasesMetadata["skipped"]["range"] = {};
phasesMetadata["identical_to_previous"]["list"] = {};
Expand All @@ -162,7 +157,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_empty) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand All @@ -171,7 +165,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_empty) {
auto outJsonPtr = testObj.metadataToJson();
ASSERT_TRUE(outJsonPtr != nullptr);

EXPECT_EQ((*outJsonPtr)["count"], num_phases);
std::vector<PhaseType> expectedSkippedList = {};
EXPECT_EQ((*outJsonPtr)["skipped"]["list"], expectedSkippedList);
std::vector<std::pair<PhaseType, PhaseType>> expectedSkippedRanges = {};
Expand All @@ -186,7 +179,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_filled) {
using LBDataHolder = vt::vrt::collection::balance::LBDataHolder;

nlohmann::json metadata, phasesMetadata, json;
phasesMetadata["count"] = num_phases;
phasesMetadata["skipped"]["list"] = {2};
phasesMetadata["skipped"]["range"] = {{3,4}};
phasesMetadata["identical_to_previous"]["list"] = {1};
Expand All @@ -198,7 +190,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_filled) {
addPhasesDataToJson(json, num_phases, {1,2,3,4,8,9});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
std::set<PhaseType> expectedSkipped = {2, 3, 4};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {1, 8, 9};
Expand All @@ -207,7 +198,6 @@ TEST_F(TestLBDataHolder, test_lb_phases_metadata_filled) {
auto outJsonPtr = testObj.metadataToJson();
ASSERT_TRUE(outJsonPtr != nullptr);

EXPECT_EQ((*outJsonPtr)["count"], num_phases);
std::vector<PhaseType> expectedSkippedList = {};
EXPECT_EQ((*outJsonPtr)["skipped"]["list"], expectedSkippedList);
std::vector<std::pair<PhaseType, PhaseType>> expectedSkippedRanges = {{2,4}};
Expand Down
Loading