diff --git a/src/vt/vrt/collection/balance/lb_data_holder.cc b/src/vt/vrt/collection/balance/lb_data_holder.cc index efd4cca0e9..cfebb9f4a5 100644 --- a/src/vt/vrt/collection/balance/lb_data_holder.cc +++ b/src/vt/vrt/collection/balance/lb_data_holder.cc @@ -61,7 +61,7 @@ void get_object_from_json_field_( } ElementIDStruct get_elm_from_object_info_( - const nlohmann::json& object, bool is_bitpacked, bool migratable, + const nlohmann::json& object, bool is_bitpacked, bool is_migratable, const nlohmann::json& home, const nlohmann::json& node) { using Field = uint64_t; @@ -75,26 +75,28 @@ ElementIDStruct get_elm_from_object_info_( } return elm::ElmIDBits::createCollectionImpl( - migratable, object_id, home, node); + is_migratable, object_id, home, node); } -ElementIDStruct get_elm_from_comm_object_(const nlohmann::json& field, bool collection) { +ElementIDStruct +get_elm_from_comm_object_(const nlohmann::json& field, bool collection) { // Get the object's id and determine if it is bit-encoded nlohmann::json object; bool is_bitpacked; get_object_from_json_field_(field, object, is_bitpacked); vtAssertExpr(object.is_number()); - // TODO: need to get this information (if it's relevant) - int home = 0; - int node = 0; - bool migratable = false; - // Create elm with encoded data ElementIDStruct elm; + if (collection) { - elm = - get_elm_from_object_info_(object, is_bitpacked, migratable, home, node); + // TODO: need to get actual object data + int home = 0; + int node = 0; + bool is_migratable = false; + + elm = get_elm_from_object_info_( + object, is_bitpacked, is_migratable, home, node); } else { elm = ElementIDStruct{object, theContext()->getNode()}; } @@ -350,7 +352,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) auto time = task["time"]; auto etype = task["entity"]["type"]; auto home = task["entity"]["home"]; - bool migratable = task["entity"]["migratable"]; + bool is_migratable = task["entity"]["migratable"]; vtAssertExpr(time.is_number()); vtAssertExpr(node.is_number()); @@ -367,7 +369,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) task["entity"].find("collection_id") != task["entity"].end() and task["entity"].find("index") != task["entity"].end()) { elm = get_elm_from_object_info_( - object, is_bitpacked, migratable, home, node); + object, is_bitpacked, is_migratable, home, node); auto cid = task["entity"]["collection_id"]; auto idx = task["entity"]["index"]; if (cid.is_number() && idx.is_array()) { diff --git a/tests/unit/lb/test_lb_data_holder.cc b/tests/unit/lb/test_lb_data_holder.cc index cfcb3583af..4494123ff4 100644 --- a/tests/unit/lb/test_lb_data_holder.cc +++ b/tests/unit/lb/test_lb_data_holder.cc @@ -54,7 +54,7 @@ namespace vt { namespace tests { namespace unit { namespace lb { using TestLBDataHolder = TestHarness; nlohmann::json create_basic_json(std::string id_type, int id, - int home, int node, bool migratable) { + int home, int node, bool is_migratable) { nlohmann::json j = { {"metadata", { {"rank", 0}, @@ -70,7 +70,7 @@ nlohmann::json create_basic_json(std::string id_type, int id, {"index", {0}}, {"home", home}, {id_type, id}, - {"migratable", migratable}, + {"migratable", is_migratable}, {"type", "object"} }}, {"node", node}, @@ -85,18 +85,18 @@ nlohmann::json create_basic_json(std::string id_type, int id, return j; } -void test_data_holder_elms(int seq_id, int home, int node, bool migratable) { +void test_data_holder_elms(int seq_id, int home, int node, bool is_migratable) { // Determine encoded ID - auto elm = elm::ElmIDBits::createCollectionImpl(migratable, seq_id, home, node); + auto elm = elm::ElmIDBits::createCollectionImpl(is_migratable, seq_id, home, node); auto encoded_id = elm.id; // Create DataHolder and get resulting object elm - auto simple_json_id = create_basic_json("id", encoded_id, home, node, migratable); + auto simple_json_id = create_basic_json("id", encoded_id, home, node, is_migratable); auto dh_id = vt::vrt::collection::balance::LBDataHolder(simple_json_id); auto elm_id = dh_id.node_data_[0].begin()->first; // Create new DataHolder using "seq_id" and get elm - auto simple_json_seq = create_basic_json("seq_id", seq_id, home, node, migratable); + auto simple_json_seq = create_basic_json("seq_id", seq_id, home, node, is_migratable); auto dh_seq = vt::vrt::collection::balance::LBDataHolder(simple_json_seq); auto elm_seq = dh_seq.node_data_[0].begin()->first; @@ -106,7 +106,7 @@ void test_data_holder_elms(int seq_id, int home, int node, bool migratable) { } TEST_F(TestLBDataHolder, test_lb_data_holder_no_comms_object_id) { - // Run a variety of test cases (seq_id, home, node, migratable) + // Run a variety of test cases (seq_id, home, node, is_migratable) test_data_holder_elms(0,0,0,false); test_data_holder_elms(0,0,0,true); test_data_holder_elms(0,0,2,false);