Skip to content

Commit

Permalink
#868: zoltan: remove shared edges not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander authored and nlslatt committed Feb 26, 2021
1 parent edbba01 commit ce41ee6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 60 deletions.
75 changes: 17 additions & 58 deletions src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ void ZoltanLB::inputParams(balance::SpecEntry* spec) {
{"SEED", "" }
};

std::vector<std::string> allowed{"edges", "use_shared_edges"};
std::vector<std::string> allowed{"edges"};
for (auto& c : zoltan_config_) {
allowed.push_back(c.first);
}
spec->checkAllowedKeys(allowed);

do_edges_ = spec->getOrDefault<bool>("edges", do_edges_);
use_shared_edges_ = spec->getOrDefault<bool>(
"use_shared_edges", use_shared_edges_
);

for (auto& c : zoltan_config_) {
c.second = spec->getOrDefault<std::string>(c.first, c.second);
Expand Down Expand Up @@ -347,42 +344,11 @@ void ZoltanLB::allocateShareEdgeGIDs() {
key.fromObjTemp(),
key.toObjTemp()
);

if (use_shared_edges_) {
auto other_node = from_node == this_node ? to_node : from_node;
shared_edges[other_node][key] = elm.second;
}
} else {
// If use_shared_edges_, the other node will set the ID; wait to receive
// it in next phase. If not shared, the other node will provide the edge
// The other node will provide the edge
}
}
}

if (use_shared_edges_) {
for (auto&& elm : shared_edges) {
proxy[elm.first].send<CommMsg, &ZoltanLB::recvEdgeGID>(elm.second);
}
}
}

void ZoltanLB::recvEdgeGID(CommMsg* msg) {
auto& comm = msg->comm_;
for (auto&& elm : comm) {
vtAssert(
load_comm_edge_id.find(elm.first) == load_comm_edge_id.end(),
"Must not exists in edge ID map"
);

vt_debug_print(
lb, node,
"recvEdgeGID: edge_id={:x}, from={:x}, to={:x}\n",
elm.first.edge_id_,
elm.first.fromObjTemp(),
elm.first.toObjTemp()
);
load_comm_edge_id[elm.first] = elm.second;
}
}

Zoltan_Struct* ZoltanLB::initZoltan() {
Expand Down Expand Up @@ -498,7 +464,6 @@ std::unique_ptr<ZoltanLB::Graph> ZoltanLB::makeGraph() {

// Set the edge weights as bytes in the communication graph
{
auto const this_node = theContext()->getNode();
int edge_idx = 0;
int neighbor_idx = 0;

Expand All @@ -525,28 +490,22 @@ std::unique_ptr<ZoltanLB::Graph> ZoltanLB::makeGraph() {
neighbor_idx
);

auto from_node = objGetNode(iter->first.fromObjTemp());
auto to_node = objGetNode(iter->first.toObjTemp());

// Set up the links between communicating GIDs
if ((use_shared_edges_ and from_node == this_node) or not use_shared_edges_) {
vt_debug_print(
lb, node,
"makeEdgeGraph: \t edge_id={}: edge_idx={}, obj={:x}\n",
iter->first.edge_id_, edge_idx, iter->first.fromObjTemp()
);

graph->neighbor_gid[neighbor_idx++] = iter->first.fromObjTemp();
}
if ((use_shared_edges_ and to_node == this_node) or not use_shared_edges_) {
vt_debug_print(
lb, node,
"makeEdgeGraph: \t edge_id={}: edge_idx={}, obj={:x}\n",
iter->first.edge_id_, edge_idx, iter->first.toObjTemp()
);

graph->neighbor_gid[neighbor_idx++] = iter->first.toObjTemp();
}
vt_debug_print(
lb, node,
"makeEdgeGraph: \t edge_id={}: edge_idx={}, obj={:x}\n",
iter->first.edge_id_, edge_idx, iter->first.fromObjTemp()
);

graph->neighbor_gid[neighbor_idx++] = iter->first.fromObjTemp();

vt_debug_print(
lb, node,
"makeEdgeGraph: \t edge_id={}: edge_idx={}, obj={:x}\n",
iter->first.edge_id_, edge_idx, iter->first.toObjTemp()
);

graph->neighbor_gid[neighbor_idx++] = iter->first.toObjTemp();

// This edge begins at neighbor_idx
graph->neighbor_idx[edge_idx + 1] = neighbor_idx;
Expand Down
2 changes: 0 additions & 2 deletions src/vt/vrt/collection/balance/zoltanlb/zoltanlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ struct ZoltanLB : BaseLB {
};

void recvSharedEdges(CommMsg* msg);
void recvEdgeGID(CommMsg* msg);

private:
static int getNumberOfVertices(void *data, int *ierr);
Expand All @@ -146,7 +145,6 @@ struct ZoltanLB : BaseLB {
objgroup::proxy::Proxy<ZoltanLB> proxy = {};
Zoltan_Struct* zoltan_ = nullptr;
bool do_edges_ = false;
bool use_shared_edges_ = false;
std::unordered_map<std::string, std::string> zoltan_config_;
ElementCommType load_comm_symm;
ElementCommType load_comm_edge_id;
Expand Down

0 comments on commit ce41ee6

Please sign in to comment.