Skip to content

Commit

Permalink
#476 clean up changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Strzebonski committed May 26, 2022
1 parent 8a77e78 commit 869e464
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 45 deletions.
1 change: 0 additions & 1 deletion src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ EventType ActiveMessenger::sendMsgBytesWithPut(
auto const& is_term = envelopeIsTerm(msg->env);
auto const& is_put = envelopeIsPut(msg->env);
auto const& is_put_packed = envelopeIsPackedPutType(msg->env);
auto const& is_bcast = envelopeIsBcast(msg->env);

if (!is_term || vt_check_enabled(print_term_msgs)) {
vt_debug_print(
Expand Down
16 changes: 12 additions & 4 deletions src/vt/vrt/collection/balance/baselb/baselb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ std::shared_ptr<const balance::Reassignment> BaseLB::normalizeReassignments() {

if (current_node == new_node) {
vt_debug_print(
terse, lb, "BaseLB::normalizeReassignments(): self migration\n"
verbose, lb, "BaseLB::normalizeReassignments(): self migration\n"
);
}

Expand Down Expand Up @@ -226,12 +226,20 @@ void BaseLB::notifyNewHostNodeOfObjectsArriving(
}
}

void BaseLB::migrateObjectTo(ObjIDType const obj_id, NodeType const to, bool const allow_self_migration) {
if (obj_id.curr_node != to || allow_self_migration) {
transfers_.push_back(TransferDestType{obj_id, to});
void BaseLB::migrateObjectTo(ObjIDType const obj_id, NodeType const to) {
if (obj_id.curr_node != to) {
migrateObject(obj_id, to);
}
}

void BaseLB::migrateObjectToSelf(const ObjIDType obj_id) {
migrateObject(obj_id, obj_id.curr_node);
}

void BaseLB::migrateObject(const ObjIDType obj_id, const NodeType to) {
transfers_.push_back(TransferDestType{obj_id, to});
}

void BaseLB::finalize(CountMsg* msg) {
auto global_count = msg->getVal();
if (migration_count_cb_) {
Expand Down
12 changes: 10 additions & 2 deletions src/vt/vrt/collection/balance/baselb/baselb.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,14 @@ struct BaseLB {
TransferVecType const& transfers, MigrationCountCB migration_count_callback
);
void migrationDone();
// TODO (STRZ) - in the end don't use bool var
void migrateObjectTo(ObjIDType const obj_id, NodeType const node, bool const allow_self_migration = false);
void migrateObjectTo(ObjIDType const obj_id, NodeType const node);

/*
* This function migrates object from and to the same node. It is used
* by SerdeTestLB for purpose of testing serialization and deserialization.
*/
void migrateObjectToSelf(ObjIDType const obj_id);

void transferSend(NodeType from, TransferVecType const& transfer);
void transferMigrations(TransferMsg<TransferVecType>* msg);
void finalize(CountMsg* msg);
Expand Down Expand Up @@ -162,6 +168,8 @@ struct BaseLB {
*/
std::shared_ptr<const balance::Reassignment> normalizeReassignments();

void migrateObject(ObjIDType const obj_id, NodeType const node);

private:
TransferVecType transfers_ = {};
TransferType off_node_migrate_ = {};
Expand Down
24 changes: 4 additions & 20 deletions src/vt/vrt/collection/balance/serdetestlb/serdetestlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@
//@HEADER
*/

// #include "vt/config.h"
// #include "vt/timing/timing.h"
#include "vt/vrt/collection/balance/serdetestlb/serdetestlb.h"
#include "vt/vrt/collection/balance/model/load_model.h"
// #include "vt/vrt/collection/manager.h"

// #include <memory>

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

Expand All @@ -62,27 +57,16 @@ void SerdeTestLB::inputParams(balance::SpecEntry*) { }

void SerdeTestLB::runLB(TimeType) {
auto const this_node = theContext()->getNode();
auto const next_node = this_node;

if (this_node == 0) {
vt_print(
lb,
"SerdeTestLB: runLB: next_node={}\n",
next_node
);
fflush(stdout);
}

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={}, to_node={} from_node={}\n",
obj, load, next_node, this_node
"\t SerdeTestLB::migrating object to: obj={}, load={}, from_node={} to_node={}\n",
obj, load, this_node, this_node
);

if (obj.isMigratable()) {
constexpr bool allow_self_migration = true;
migrateObjectTo(obj, next_node, allow_self_migration);
migrateObjectToSelf(obj);
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/vt/vrt/collection/balance/serdetestlb/serdetestlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
namespace vt { namespace vrt { namespace collection { namespace lb {

struct SerdeTestLB : BaseLB {

SerdeTestLB() = default;
virtual ~SerdeTestLB() {}

Expand All @@ -68,9 +67,6 @@ struct SerdeTestLB : BaseLB {
void inputParams(balance::SpecEntry* spec) override;

static std::unordered_map<std::string, std::string> getInputKeysWithHelp();

private:
objgroup::proxy::Proxy<SerdeTestLB> proxy = {};
};

}}}} /* end namespace vt::vrt::collection::lb */
Expand Down
16 changes: 2 additions & 14 deletions src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1789,15 +1789,14 @@ template <typename ColT, typename IndexT>
MigrateStatus CollectionManager::migrateOut(
VirtualProxyType const& col_proxy, IndexT const& idx, NodeType const& dest
) {
auto const& this_node = theContext()->getNode();
auto const this_node = theContext()->getNode();

vt_debug_print(
terse, vrt_coll,
"migrateOut: col_proxy={:x}, this_node={}, dest={}, idx={}\n",
col_proxy, this_node, dest, print_index(idx)
);

// if (this_node != dest) {
vt_debug_print(
terse, vrt_coll, "migrating from {} to {}\n", this_node, dest
);
Expand Down Expand Up @@ -1860,8 +1859,7 @@ MigrateStatus CollectionManager::migrateOut(

using MigrateMsgType = MigrateMsg<ColT, IndexT>;

auto msg =
makeMessage<MigrateMsgType>(proxy, this_node, dest, &typed_col_ref);
auto msg = makeMessage<MigrateMsgType>(proxy, this_node, dest, &typed_col_ref);

theMsg()->sendMsg<
MigrateMsgType, MigrateHandlers::migrateInHandler<ColT, IndexT>
Expand Down Expand Up @@ -1893,16 +1891,6 @@ MigrateStatus CollectionManager::migrateOut(
);

return MigrateStatus::MigratedToRemote;
// } else {
// #if vt_check_enabled(runtime_checks)
// vtAssert(
// false, "Migration should only be called when to_node is != this_node"
// );
// #else
// // Do nothing
// #endif
// return MigrateStatus::NoMigrationNecessary;
// }
}

template <typename ColT, typename IndexT>
Expand Down

0 comments on commit 869e464

Please sign in to comment.