Skip to content

Commit

Permalink
#1672: send selected edges
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Apr 14, 2022
1 parent a205c69 commit d6a22d9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
10 changes: 10 additions & 0 deletions src/vt/vrt/collection/balance/baselb/baselb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ void BaseLB::finalize(CountMsg* msg) {
}
}

void BaseLB::recvSharedEdges(CommMsg* msg) {
auto& comm = msg->comm_;
for (auto&& elm : comm) {
vt_debug_print(
verbose, lb, "recv shared edge: from={}, to={}\n", elm.first.fromObj(),
elm.first.toObj()
);
}
}

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

#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_BASELB_BASELB_CC*/
21 changes: 20 additions & 1 deletion src/vt/vrt/collection/balance/baselb/baselb.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ struct LoadModel;

namespace lb {

struct CommMsg;

struct BaseLB {
using ObjIDType = balance::ElementIDStruct;
using ElementLoadType = std::unordered_map<ObjIDType,TimeType>;
Expand Down Expand Up @@ -142,6 +144,7 @@ struct BaseLB {
TransferVecType& getTransfers() { return transfers_; }

bool isCommAware() const { return comm_aware_; }
void recvSharedEdges(CommMsg* msg);

protected:
void getArgs(PhaseType phase);
Expand Down Expand Up @@ -173,6 +176,22 @@ struct BaseLB {
std::shared_ptr<balance::Reassignment> pending_reassignment_ = nullptr;
};

}}}} /* end namespace vt::vrt::collection::lb */
struct CommMsg : vt::Message {
using MessageParentType = vt::Message;
vt_msg_serialize_required();

CommMsg() = default;
explicit CommMsg(lb::BaseLB::ElementCommType in_comm) : comm_(in_comm) { }

lb::BaseLB::ElementCommType comm_;

template <typename SerializerT>
void serialize(SerializerT& s) {
MessageParentType::serialize(s);
s | comm_;
}
};

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

#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_BASELB_BASELB_H*/
32 changes: 3 additions & 29 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,32 +532,6 @@ bool LBManager::isCollectiveComm(elm::CommCategory cat) const {
return is_collective;
}

struct CommMsg : vt::Message {
using MessageParentType = vt::Message;
vt_msg_serialize_required(); // comm_

CommMsg() = default;
explicit CommMsg(lb::BaseLB::ElementCommType in_comm) : comm_(in_comm) { }

lb::BaseLB::ElementCommType comm_;

template <typename SerializerT>
void serialize(SerializerT& s) {
MessageParentType::serialize(s);
s | comm_;
}
};

void recvSharedEdges(CommMsg* msg) {
auto& comm = msg->comm_;
for (auto&& elm : comm) {
vt_debug_print(
verbose, lb, "recv shared edge: from={}, to={}\n",
elm.first.fromObj(), elm.first.toObj()
);
}
}

void makeGraphSymmetric(
PhaseType phase, objgroup::proxy::Proxy<lb::BaseLB> proxy
) {
Expand Down Expand Up @@ -605,9 +579,9 @@ void makeGraphSymmetric(
}

for (auto&& elm : shared_edges) {
(void)elm;
(void)proxy;
// proxy[elm.first].send<CommMsg, &recvSharedEdges>(elm.second);
proxy[elm.first].send<lb::CommMsg, &lb::BaseLB::recvSharedEdges>(
elm.second
);
}
}

Expand Down

0 comments on commit d6a22d9

Please sign in to comment.