Skip to content

Commit

Permalink
#476 rename SerdeTestLB to TestSerializationLB
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Strzebonski committed May 26, 2022
1 parent 0788818 commit 9b16989
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 69 deletions.
20 changes: 10 additions & 10 deletions docs/md/lb-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ To print LB specification during startup, use `--vt_lb_show_spec` command line f

\section load-balancers Load balancers

| Load Balancer | Type | Description | Reference |
| -------------- | ----------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------- |
| RotateLB | Testing | Rotate objects in a ring | `vt::vrt::collection::lb::RotateLB` |
| RandomLB | Testing | Randomly migrate object with seed | `vt::vrt::collection::lb::RandomLB` |
| GreedyLB | Centralized | Gather to central node apply min/max heap | `vt::vrt::collection::lb::GreedyLB` |
| TemperedLB | Distributed | Inspired by epidemic algorithms | `vt::vrt::collection::lb::TemperedLB` |
| HierarchicalLB | Hierarchical | Build tree to move objects nodes | `vt::vrt::collection::lb::HierarchicalLB` |
| ZoltanLB | Hyper-graph Partitioner | Run Zoltan in hyper-graph mode to LB | `vt::vrt::collection::lb::ZoltanLB` |
| OfflineLB | User-specified | Read file to determine mapping | `vt::vrt::collection::lb::OfflineLB` |
| SerdeTestLB | Testing | Migrate objects to the same node, for testing serialization/deserialization purpose | `vt::vrt::collection::lb::SerdeTestLB` |
| Load Balancer | Type | Description | Reference |
| ------------------- | ----------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------- |
| RotateLB | Testing | Rotate objects in a ring | `vt::vrt::collection::lb::RotateLB` |
| RandomLB | Testing | Randomly migrate object with seed | `vt::vrt::collection::lb::RandomLB` |
| GreedyLB | Centralized | Gather to central node apply min/max heap | `vt::vrt::collection::lb::GreedyLB` |
| TemperedLB | Distributed | Inspired by epidemic algorithms | `vt::vrt::collection::lb::TemperedLB` |
| HierarchicalLB | Hierarchical | Build tree to move objects nodes | `vt::vrt::collection::lb::HierarchicalLB` |
| ZoltanLB | Hyper-graph Partitioner | Run Zoltan in hyper-graph mode to LB | `vt::vrt::collection::lb::ZoltanLB` |
| OfflineLB | User-specified | Read file to determine mapping | `vt::vrt::collection::lb::OfflineLB` |
| TestSerializationLB | Testing | Migrate objects to the same node, for testing serialization/deserialization purpose | `vt::vrt::collection::lb::TestSerializationLB` |

\section load-models Object Load Models

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ set(
vrt/collection/balance/offlinelb
vrt/collection/balance/zoltanlb
vrt/collection/balance/randomlb
vrt/collection/balance/serdetestlb
vrt/collection/balance/testserializationlb
vrt/collection/balance/lb_invoke
vrt/collection/balance/model
vrt/collection/balance/proxy
Expand Down
22 changes: 11 additions & 11 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include "vt/vrt/collection/balance/lb_data_restart_reader.h"
#include "vt/vrt/collection/balance/zoltanlb/zoltanlb.h"
#include "vt/vrt/collection/balance/randomlb/randomlb.h"
#include "vt/vrt/collection/balance/serdetestlb/serdetestlb.h"
#include "vt/vrt/collection/balance/testserializationlb/testserializationlb.h"
#include "vt/vrt/collection/messages/system_create.h"
#include "vt/vrt/collection/manager.fwd.h"
#include "vt/utils/memory/memory_usage.h"
Expand Down Expand Up @@ -270,16 +270,16 @@ void LBManager::startLB(
}

switch (lb) {
case LBType::HierarchicalLB: lb_instances_["chosen"] = makeLB<lb::HierarchicalLB>(); break;
case LBType::GreedyLB: lb_instances_["chosen"] = makeLB<lb::GreedyLB>(); break;
case LBType::RotateLB: lb_instances_["chosen"] = makeLB<lb::RotateLB>(); break;
case LBType::TemperedLB: lb_instances_["chosen"] = makeLB<lb::TemperedLB>(); break;
case LBType::OfflineLB: lb_instances_["chosen"] = makeLB<lb::OfflineLB>(); break;
case LBType::RandomLB: lb_instances_["chosen"] = makeLB<lb::RandomLB>(); break;
case LBType::HierarchicalLB: lb_instances_["chosen"] = makeLB<lb::HierarchicalLB>(); break;
case LBType::GreedyLB: lb_instances_["chosen"] = makeLB<lb::GreedyLB>(); break;
case LBType::RotateLB: lb_instances_["chosen"] = makeLB<lb::RotateLB>(); break;
case LBType::TemperedLB: lb_instances_["chosen"] = makeLB<lb::TemperedLB>(); break;
case LBType::OfflineLB: lb_instances_["chosen"] = makeLB<lb::OfflineLB>(); break;
case LBType::RandomLB: lb_instances_["chosen"] = makeLB<lb::RandomLB>(); break;
# if vt_check_enabled(zoltan)
case LBType::ZoltanLB: lb_instances_["chosen"] = makeLB<lb::ZoltanLB>(); break;
case LBType::ZoltanLB: lb_instances_["chosen"] = makeLB<lb::ZoltanLB>(); break;
# endif
case LBType::SerdeTestLB: lb_instances_["chosen"] = makeLB<lb::SerdeTestLB>(); break;
case LBType::TestSerializationLB: lb_instances_["chosen"] = makeLB<lb::TestSerializationLB>(); break;
case LBType::NoLB:
vtAssert(false, "LBType::NoLB is not a valid LB for collectiveImpl");
break;
Expand Down Expand Up @@ -330,8 +330,8 @@ void LBManager::printLBArgsHelp(LBType lb) {
help = lb::ZoltanLB::getInputKeysWithHelp();
break;
# endif
case LBType::SerdeTestLB:
help = lb::SerdeTestLB::getInputKeysWithHelp();
case LBType::TestSerializationLB:
help = lb::TestSerializationLB::getInputKeysWithHelp();
break;
case LBType::NoLB:
// deliberately skip retrieving arguments
Expand Down
18 changes: 9 additions & 9 deletions src/vt/vrt/collection/balance/lb_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ namespace vt { namespace vrt { namespace collection {
namespace balance {

static std::unordered_map<LBType,std::string> lb_names_ = {
{LBType::NoLB, std::string{"NoLB" }},
{LBType::NoLB, std::string{"NoLB" }},
# if vt_check_enabled(zoltan)
{LBType::ZoltanLB, std::string{"ZoltanLB" }},
{LBType::ZoltanLB, std::string{"ZoltanLB" }},
# endif
{LBType::GreedyLB, std::string{"GreedyLB" }},
{LBType::HierarchicalLB, std::string{"HierarchicalLB"}},
{LBType::RotateLB, std::string{"RotateLB" }},
{LBType::TemperedLB, std::string{"TemperedLB" }},
{LBType::OfflineLB, std::string{"OfflineLB" }},
{LBType::RandomLB, std::string{"RandomLB" }},
{LBType::SerdeTestLB, std::string{"SerdeTestLB" }},
{LBType::GreedyLB, std::string{"GreedyLB" }},
{LBType::HierarchicalLB, std::string{"HierarchicalLB" }},
{LBType::RotateLB, std::string{"RotateLB" }},
{LBType::TemperedLB, std::string{"TemperedLB" }},
{LBType::OfflineLB, std::string{"OfflineLB" }},
{LBType::RandomLB, std::string{"RandomLB" }},
{LBType::TestSerializationLB, std::string{"TestSerializationLB"}},
};

std::unordered_map<LBType, std::string>& get_lb_names() {
Expand Down
18 changes: 9 additions & 9 deletions src/vt/vrt/collection/balance/lb_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
namespace vt { namespace vrt { namespace collection { namespace balance {

enum struct LBType : int8_t {
NoLB = 0
, GreedyLB = 1
, HierarchicalLB = 2
, RotateLB = 3
, TemperedLB = 4
, OfflineLB = 5
NoLB = 0
, GreedyLB = 1
, HierarchicalLB = 2
, RotateLB = 3
, TemperedLB = 4
, OfflineLB = 5
# if vt_check_enabled(zoltan)
, ZoltanLB = 6
, ZoltanLB = 6
# endif
, RandomLB = 7
, SerdeTestLB = 8
, RandomLB = 7
, TestSerializationLB = 8
};

}}}} /* end namespace vt::vrt::collection::balance */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// serdetestlb.cc
// testserializationlb.cc
// DARMA/vt => Virtual Transport
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
Expand Down Expand Up @@ -41,32 +41,32 @@
//@HEADER
*/

#include "vt/vrt/collection/balance/serdetestlb/serdetestlb.h"
#include "vt/vrt/collection/balance/testserializationlb/testserializationlb.h"
#include "vt/vrt/collection/balance/model/load_model.h"

namespace vt { namespace vrt { namespace collection { namespace lb {

/*static*/ std::unordered_map<std::string, std::string>
SerdeTestLB::getInputKeysWithHelp() {
TestSerializationLB::getInputKeysWithHelp() {
return std::unordered_map<std::string, std::string>{};
}

void SerdeTestLB::init(objgroup::proxy::Proxy<SerdeTestLB>) {
void TestSerializationLB::init(objgroup::proxy::Proxy<TestSerializationLB>) {
vtAssert(
theConfig()->vt_lb_self_migration,
"SerdeTestLB::init(): vt_lb_self_migration flag must be set to use SerdeTestLB\n"
"TestSerializationLB::init(): vt_lb_self_migration flag must be set to use TestSerializationLB\n"
);
}

void SerdeTestLB::inputParams(balance::SpecEntry*) { }
void TestSerializationLB::inputParams(balance::SpecEntry*) { }

void SerdeTestLB::runLB(TimeType) {
void TestSerializationLB::runLB(TimeType) {
auto const this_node = theContext()->getNode();
for (auto obj : *load_model_) {
TimeTypeWrapper const load = load_model_->getWork(obj, {balance::PhaseOffset::NEXT_PHASE, balance::PhaseOffset::WHOLE_PHASE});
vt_debug_print(
terse, lb,
"\t SerdeTestLB::migrating object to: obj={}, load={}, from_node={} to_node={}\n",
"\t TestSerializationLB::migrating object to: obj={}, load={}, from_node={} to_node={}\n",
obj, load, this_node, this_node
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// serdetestlb.h
// testserializationlb.h
// DARMA/vt => Virtual Transport
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
Expand Down Expand Up @@ -41,8 +41,8 @@
//@HEADER
*/

#if !defined INCLUDED_VT_VRT_COLLECTION_BALANCE_SERDETESTLB_SERDETESTLB_H
#define INCLUDED_VT_VRT_COLLECTION_BALANCE_SERDETESTLB_SERDETESTLB_H
#if !defined INCLUDED_VT_VRT_COLLECTION_BALANCE_TESTSERIALIZATIONLB_TESTSERIALIZATIONLB_H
#define INCLUDED_VT_VRT_COLLECTION_BALANCE_TESTSERIALIZATIONLB_TESTSERIALIZATIONLB_H

#include "vt/config.h"
#include "vt/messaging/message.h"
Expand All @@ -55,11 +55,11 @@

namespace vt { namespace vrt { namespace collection { namespace lb {

struct SerdeTestLB : BaseLB {
SerdeTestLB() = default;
virtual ~SerdeTestLB() {}
struct TestSerializationLB : BaseLB {
TestSerializationLB() = default;
virtual ~TestSerializationLB() {}

void init(objgroup::proxy::Proxy<SerdeTestLB> in_proxy);
void init(objgroup::proxy::Proxy<TestSerializationLB> in_proxy);
void runLB(TimeType) override;
void inputParams(balance::SpecEntry* spec) override;

Expand All @@ -68,4 +68,4 @@ struct SerdeTestLB : BaseLB {

}}}} /* end namespace vt::vrt::collection::lb */

#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_SERDETESTLB_SERDETESTLB_H*/
#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_TESTSERIALIZATIONLB_TESTSERIALIZATIONLB_H*/
26 changes: 13 additions & 13 deletions tests/unit/collection/test_lb.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,9 @@ INSTANTIATE_TEST_SUITE_P(
DumpUserdefinedDataExplode, TestDumpUserdefinedData, booleans
);

struct SerdeTestCol : vt::Collection<SerdeTestCol, vt::Index1D> {
struct SerializationTestCol : vt::Collection<SerializationTestCol, vt::Index1D> {
template <typename SerializerT> void serialize(SerializerT &s) {
vt::Collection<SerdeTestCol, vt::Index1D>::serialize(s);
vt::Collection<SerializationTestCol, vt::Index1D>::serialize(s);

if (s.isSizing()) {
s | was_packed | was_unpacked | packed_on_node | unpacked_on_node;
Expand Down Expand Up @@ -609,9 +609,9 @@ struct SerdeTestCol : vt::Collection<SerdeTestCol, vt::Index1D> {
int unpacked_on_node = -1;
};

using SerdeTestMsg = vt::CollectionMessage<SerdeTestCol>;
using SerializationTestMsg = vt::CollectionMessage<SerializationTestCol>;

void serdeColHandler(SerdeTestMsg *, SerdeTestCol *col) {
void serializationColHandler(SerializationTestMsg *, SerializationTestCol *col) {
auto const cur_phase = thePhase()->getCurrentPhase();
if (cur_phase < 2) {
return;
Expand All @@ -622,36 +622,36 @@ void serdeColHandler(SerdeTestMsg *, SerdeTestCol *col) {
EXPECT_EQ(col->packed_on_node, col->unpacked_on_node);
}

void runSerdeTest() {
void runSerializationTest() {
theConfig()->vt_lb = true;
theConfig()->vt_lb_self_migration = true;
theConfig()->vt_lb_name = "SerdeTestLB";
theConfig()->vt_lb_name = "TestSerializationLB";
if (theContext()->getNode() == 0) {
::fmt::print("Testing LB: SerdeTestLB\n");
::fmt::print("Testing LB: TestSerializationLB\n");
}

theCollective()->barrier();

auto range = Index1D{8};
vrt::collection::CollectionProxy<SerdeTestCol> proxy;
vrt::collection::CollectionProxy<SerializationTestCol> proxy;

runInEpochCollective([&] {
proxy = theCollection()->constructCollective<SerdeTestCol>(range);
proxy = theCollection()->constructCollective<SerializationTestCol>(range);
});

for (int phase = 0; phase < num_phases; ++phase) {
runInEpochCollective([&] {
proxy.broadcastCollective<SerdeTestMsg, serdeColHandler>();
proxy.broadcastCollective<SerializationTestMsg, serializationColHandler>();
});
thePhase()->nextPhaseCollective();
}
}

struct TestLoadBalancerSerdeTestLB : TestParallelHarness {};
struct TestLoadBalancerTestSerializationLB : TestParallelHarness {};

TEST_F(TestLoadBalancerSerdeTestLB, test_SerdeTestLB_load_balancer) {
TEST_F(TestLoadBalancerTestSerializationLB, test_TestSerializationLB_load_balancer) {
theCollective()->barrier();
runSerdeTest();
runSerializationTest();
}

}}}} // end namespace vt::tests::unit::lb
Expand Down

0 comments on commit 9b16989

Please sign in to comment.