Skip to content

Commit

Permalink
#276: Update calls to sendMsg and broadcastMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable authored and lifflander committed Feb 8, 2023
1 parent 3b5f9a6 commit 3502881
Show file tree
Hide file tree
Showing 70 changed files with 161 additions and 161 deletions.
2 changes: 1 addition & 1 deletion examples/callback/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void colHan(TestMsg* msg, MyCol* col) {

void bounceCallback(vt::Callback<TestMsg> cb) {
auto msg = vt::makeMessage<HelloMsg>(cb);
vt::theMsg()->sendMsg<HelloMsg, hello_world>(1, msg);
vt::theMsg()->sendMsg<hello_world>(1, msg);
}

int main(int argc, char** argv) {
Expand Down
4 changes: 2 additions & 2 deletions examples/collection/transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct Block : vt::Collection<Block, vt::Index1D> {
);
auto const from_idx = getIndex().x();
auto data_msg = vt::makeMessage<DataMsg>(data_,from_idx);
vt::theMsg()->sendMsg<DataMsg,SubSolveInfo::solveDataIncoming>(
vt::theMsg()->sendMsg<SubSolveInfo::solveDataIncoming>(
requesting_node, data_msg
);
}
Expand Down Expand Up @@ -313,7 +313,7 @@ static void solveGroupSetup(vt::NodeType this_node, vt::VirtualProxyType coll_pr
if (this_node == 1) {
auto msg = vt::makeMessage<SubSolveMsg>(coll_proxy);
vt::envelopeSetGroup(msg->env, group_id);
vt::theMsg()->broadcastMsg<SubSolveMsg,SubSolveInfo::subSolveHandler>(msg);
vt::theMsg()->broadcastMsg<SubSolveInfo::subSolveHandler>(msg);
}
}, true
);
Expand Down
2 changes: 1 addition & 1 deletion examples/group/group_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char** argv) {
if (this_node == 1) {
auto msg = vt::makeMessage<HelloGroupMsg>();
vt::envelopeSetGroup(msg->env, group);
vt::theMsg()->broadcastMsg<HelloGroupMsg, hello_group_handler>(msg);
vt::theMsg()->broadcastMsg<hello_group_handler>(msg);
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions examples/group/group_rooted.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ int main(int argc, char** argv) {

if (this_node == 0) {
auto msg = vt::makeMessage<HelloMsg>(this_node);
vt::theMsg()->broadcastMsg<HelloMsg, hello_world>(msg);
vt::theMsg()->broadcastMsg<hello_world>(msg);

using RangeType = vt::group::region::Range;
auto list = std::make_unique<RangeType>(num_nodes / 2, num_nodes);

vt::theGroup()->newGroup(std::move(list), [=](vt::GroupType group){
auto gmsg = vt::makeMessage<HelloMsg>(this_node);
vt::envelopeSetGroup(gmsg->env, group);
vt::theMsg()->broadcastMsg<HelloMsg, hello_group_handler>(gmsg);
vt::theMsg()->broadcastMsg<hello_group_handler>(gmsg);
});
}

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/hello_world_virtual_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(int argc, char** argv) {

// send out the proxy to all the nodes
auto msg = vt::makeMessage<HelloMsg>(proxy);
vt::theMsg()->broadcastMsg<HelloMsg, hello_world>(msg);
vt::theMsg()->broadcastMsg<hello_world>(msg);
}

vt::finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/ring.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void sendToNext() {
vt::NodeType next_node = this_node + 1 >= num_nodes ? 0 : this_node + 1;

auto msg = vt::makeMessage<RingMsg>(this_node);
vt::theMsg()->sendMsg<RingMsg, ring>(next_node, msg);
vt::theMsg()->sendMsg<ring>(next_node, msg);
}

int main(int argc, char** argv) {
Expand Down
2 changes: 1 addition & 1 deletion examples/rdma/rdma_simple_get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int main(int argc, char** argv) {

auto msg = vt::makeMessage<HandleMsg>(this_node);
msg->han = my_handle;
vt::theMsg()->broadcastMsg<HandleMsg, tell_handle>(msg);
vt::theMsg()->broadcastMsg<tell_handle>(msg);
}

vt::finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/rdma/rdma_simple_get_direct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc, char** argv) {

auto msg = vt::makeMessage<HandleMsg>(this_node);
msg->han = my_handle;
vt::theMsg()->broadcastMsg<HandleMsg, tellHandle>(msg);
vt::theMsg()->broadcastMsg<tellHandle>(msg);
}

vt::finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/rdma/rdma_simple_put.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static void put_data_fn(HandleMsg* msg) {
fmt::print("{}: after put: sending msg back to 0\n", this_node);
auto msg2 = vt::makeMessage<HandleMsg>(this_node);
msg2->han = handle;
vt::theMsg()->sendMsg<HandleMsg,read_data_fn>(0, msg2);
vt::theMsg()->sendMsg<read_data_fn>(0, msg2);
}
);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ int main(int argc, char** argv) {

auto msg = vt::makeMessage<HandleMsg>(this_node);
msg->han = my_handle;
vt::theMsg()->broadcastMsg<HandleMsg,put_data_fn>(msg, false);
vt::theMsg()->broadcastMsg<put_data_fn>(msg, false);
}

vt::finalize();
Expand Down
6 changes: 3 additions & 3 deletions examples/rdma/rdma_simple_put_direct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void putDataFn(HandleMsg* msg) {
);

auto back = vt::makeMessage<HandleMsg>(han);
vt::theMsg()->sendMsg<HandleMsg, readDataFn>(0, back);
vt::theMsg()->sendMsg<readDataFn>(0, back);
});
}
}
Expand Down Expand Up @@ -117,8 +117,8 @@ int main(int argc, char** argv) {

auto msg1 = vt::makeMessage<HandleMsg>(my_handle);
auto msg2 = vt::makeMessage<HandleMsg>(my_handle);
vt::theMsg()->sendMsg<HandleMsg, putDataFn>(1, msg1);
vt::theMsg()->sendMsg<HandleMsg, putDataFn>(2, msg2);
vt::theMsg()->sendMsg<putDataFn>(1, msg1);
vt::theMsg()->sendMsg<putDataFn>(2, msg2);
}

vt::finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/termination/termination_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void test_handler(TestMsg* msg) {
num--;
if (num > 0) {
auto msg_send = vt::makeMessage<TestMsg>();
vt::theMsg()->sendMsg<TestMsg, test_handler>(nextNode(), msg_send);
vt::theMsg()->sendMsg<test_handler>(nextNode(), msg_send);
}
}

Expand All @@ -89,7 +89,7 @@ int main(int argc, char** argv) {
{
auto msg = vt::makeMessage<TestMsg>();
vt::envelopeSetEpoch(msg->env, epoch);
vt::theMsg()->sendMsg<TestMsg, test_handler>(nextNode(), msg);
vt::theMsg()->sendMsg<test_handler>(nextNode(), msg);
}

vt::theTerm()->finishedEpoch(epoch);
Expand Down
4 changes: 2 additions & 2 deletions examples/termination/termination_rooted.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void test_handler(TestMsg* msg) {
num--;
if (num > 0) {
auto msg_send = vt::makeMessage<TestMsg>();
vt::theMsg()->sendMsg<TestMsg, test_handler>(nextNode(), msg_send);
vt::theMsg()->sendMsg<test_handler>(nextNode(), msg_send);
}
}

Expand All @@ -88,7 +88,7 @@ int main(int argc, char** argv) {

auto msg = vt::makeMessage<TestMsg>();
vt::envelopeSetEpoch(msg->env, epoch);
vt::theMsg()->sendMsg<TestMsg, test_handler>(nextNode(), msg);
vt::theMsg()->sendMsg<test_handler>(nextNode(), msg);
vt::theTerm()->finishedEpoch(epoch);
}

Expand Down
4 changes: 2 additions & 2 deletions src/vt/collective/reduce/reduce.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void Reduce::startReduce(detail::ReduceStamp id, bool use_num_contrib) {
scope_.str(), detail::stringizeStamp(id), root, this_node
);

theMsg()->sendMsg<MsgT,ReduceManager::reduceRootRecv<MsgT>>(root, typed_msg);
theMsg()->sendMsg<ReduceManager::reduceRootRecv<MsgT>>(root, typed_msg);
} else {
vt_debug_print(
normal, reduce,
Expand All @@ -300,7 +300,7 @@ void Reduce::startReduce(detail::ReduceStamp id, bool use_num_contrib) {
scope_.str(), detail::stringizeStamp(id), parent
);

theMsg()->sendMsg<MsgT,ReduceManager::reduceUpHan<MsgT>>(parent, typed_msg);
theMsg()->sendMsg<ReduceManager::reduceUpHan<MsgT>>(parent, typed_msg);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/scatter/scatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void Scatter::scatterIn(ScatterMsg* msg) {
);
std::memcpy(ptr, in_ptr, child_bytes_size);
in_ptr += child_bytes_size;
theMsg()->sendMsg<ScatterMsg, scatterHandler>(
theMsg()->sendMsg<scatterHandler>(
child, child_msg
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/scatter/scatter.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void Scatter::scatter(
auto const& this_node = theContext()->getNode();
scatter_msg->user_han = handler;
if (this_node != root_node) {
theMsg()->sendMsg<ScatterMsg, scatterHandler>(
theMsg()->sendMsg<scatterHandler>(
root_node, scatter_msg
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/vt/event/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ EventType AsyncEvent::attachAction(EventType const& event, ActionType callable)
event, event_id, static_cast<int>(event_state), this_node
);

theMsg()->sendMsg<EventCheckFinishedMsg, checkEventFinished>(
theMsg()->sendMsg<checkEventFinished>(
owning_node, msg
);

Expand Down Expand Up @@ -162,7 +162,7 @@ EventType AsyncEvent::attachAction(EventType const& event, ActionType callable)
vtAssertExpr(send_back == msg->sent_from_node_);

auto msg_send = makeMessage<EventFinishedMsg>(event, msg->event_back_);
theMsg()->sendMsg<EventFinishedMsg, eventFinished>(
theMsg()->sendMsg<eventFinished>(
send_back, msg_send
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/vt/group/collective/group_collective_finished.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void InfoColl::CollSetupFinished::operator()(FinishedReduceMsg* msg) {
auto nmsg = makeMessage<GroupOnlyMsg>(
msg->getGroup(),info->new_tree_cont_
);
theMsg()->sendMsg<GroupOnlyMsg,InfoColl::newTreeHan>(
theMsg()->sendMsg<InfoColl::newTreeHan>(
info->known_root_node_, nmsg
);
} else {
Expand Down
30 changes: 15 additions & 15 deletions src/vt/group/collective/group_info_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void InfoColl::setupCollective() {
auto msg = makeMessage<GroupCollectiveMsg>(
group_, up_tree_cont_, in_group, size, child
);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(parent, msg);
theMsg()->sendMsg<upHan>(parent, msg);
}
}

Expand Down Expand Up @@ -336,7 +336,7 @@ void InfoColl::upTree() {
auto msg = makeMessage<GroupCollectiveMsg>(
group,new_root_cont_,true,subtree_zero,root_node,0,extra
);
theMsg()->sendMsg<GroupCollectiveMsg,newRootHan>(root_node, msg);
theMsg()->sendMsg<newRootHan>(root_node, msg);

for (std::size_t i = 1; i < msg_list.size(); i++) {
vt_debug_print(
Expand All @@ -347,7 +347,7 @@ void InfoColl::upTree() {

msg_list[i]->setOpID(down_tree_cont_);
auto pmsg = promoteMsg(msg_list[i]);
theMsg()->sendMsg<GroupCollectiveMsg,downHan>(root_node, pmsg);
theMsg()->sendMsg<downHan>(root_node, pmsg);
++send_down_;
}
in_phase_two_ = true;
Expand Down Expand Up @@ -377,7 +377,7 @@ void InfoColl::upTree() {
auto cmsg = makeMessage<GroupCollectiveMsg>(
group,op,is_in_group,total_subtree,child,level
);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, cmsg);
theMsg()->sendMsg<upHan>(p, cmsg);

for (auto&& msg : msg_in_group) {
span_children_.push_back(msg->getChild());
Expand Down Expand Up @@ -406,14 +406,14 @@ void InfoColl::upTree() {
auto msg = makeMessage<GroupCollectiveMsg>(
group,op,is_in_group,static_cast<NodeType>(subtree_),child,0,extra
);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, msg);
theMsg()->sendMsg<upHan>(p, msg);
/*
* Forward all the children messages up the tree (up to 2 of them)
*/
for (std::size_t i = 0; i < msg_in_group.size(); i++) {
// new MsgPtr to avoid thief of original in collection
auto msg_out = promoteMsg(msg_in_group[i].get());
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, msg_out);
theMsg()->sendMsg<upHan>(p, msg_out);
}
} else if (is_in_group && msg_in_group.size() == 1) {
/*
Expand All @@ -438,10 +438,10 @@ void InfoColl::upTree() {
auto msg = makeMessage<GroupCollectiveMsg>(
group,op,is_in_group,total_subtree,child,0,extra
);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, msg);
theMsg()->sendMsg<upHan>(p, msg);
// new MsgPtr to avoid thief of original in collection
auto msg_out = promoteMsg(msg_in_group[0].get());
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, msg_out);
theMsg()->sendMsg<upHan>(p, msg_out);
} else {
vtAssertExpr(msg_in_group.size() > 2);

Expand Down Expand Up @@ -478,7 +478,7 @@ void InfoColl::upTree() {
auto msg = makeMessage<GroupCollectiveMsg>(
group,op,is_in_group,total_subtree,child,0,extra
);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, msg);
theMsg()->sendMsg<upHan>(p, msg);

vt_debug_print(
verbose, group,
Expand All @@ -494,7 +494,7 @@ void InfoColl::upTree() {
GroupCollectiveMsg* tmsg = *iter;
c[i] = tmsg->getChild();
auto pmsg = promoteMsg(tmsg);
theMsg()->sendMsg<GroupCollectiveMsg,upHan>(p, pmsg);
theMsg()->sendMsg<upHan>(p, pmsg);
iter++;
}

Expand All @@ -503,7 +503,7 @@ void InfoColl::upTree() {
GroupCollectiveMsg* tmsg = *iter;
tmsg->setOpID(down_tree_cont_);
auto pmsg = promoteMsg(tmsg);
theMsg()->sendMsg<GroupCollectiveMsg,downHan>(c[i % extra], pmsg);
theMsg()->sendMsg<downHan>(c[i % extra], pmsg);
++send_down_;
++iter;
}
Expand Down Expand Up @@ -639,13 +639,13 @@ void InfoColl::downTree(GroupCollectiveMsg* msg) {
auto const& num = collective_->span_children_.size();
auto const& child = collective_->span_children_[msg->getChild() % num];
auto nmsg = makeMessage<GroupCollectiveMsg>(*msg);
theMsg()->sendMsg<GroupCollectiveMsg,downHan>(child, nmsg);
theMsg()->sendMsg<downHan>(child, nmsg);
++send_down_;
}

auto const& group_ = getGroupID();
auto nmsg = makeMessage<GroupOnlyMsg>(group_,down_tree_fin_cont_);
theMsg()->sendMsg<GroupOnlyMsg,downFinishedHan>(from, nmsg);
theMsg()->sendMsg<downFinishedHan>(from, nmsg);
}

void InfoColl::newTree(NodeType const& parent) {
Expand Down Expand Up @@ -686,7 +686,7 @@ void InfoColl::sendDownNewTree() {
group_, c
);
auto msg = makeMessage<GroupOnlyMsg>(group_,new_tree_cont_);
theMsg()->sendMsg<GroupOnlyMsg,newTreeHan>(c, msg);
theMsg()->sendMsg<newTreeHan>(c, msg);
}
}

Expand Down Expand Up @@ -727,7 +727,7 @@ void InfoColl::finalize() {
auto msg = makeMessage<GroupOnlyMsg>(
group_,finalize_cont_,known_root_node_,is_default_group_
);
theMsg()->sendMsg<GroupOnlyMsg,finalizeHan>(c, msg);
theMsg()->sendMsg<finalizeHan>(c, msg);
}

if (!is_in_group) {
Expand Down
2 changes: 1 addition & 1 deletion src/vt/group/global/group_default.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ template <typename MsgT, ActiveTypedFnType<MsgT>* handler>
} else {
auto msg = makeMessage<MsgT>();
envelopeSetTag(msg->env, phase);
theMsg()->sendMsg<MsgT, handler>(node, msg);
theMsg()->sendMsg<handler>(node, msg);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vt/group/group_info.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ template <typename MsgT>
if (op_id != no_op_id) {
// Send back message
auto retmsg = makeMessage<GroupOnlyMsg>(group, op_id);
theMsg()->sendMsg<GroupOnlyMsg, Info::groupTriggerHandler>(
theMsg()->sendMsg<Info::groupTriggerHandler>(
parent, retmsg
);
}
Expand Down Expand Up @@ -151,7 +151,7 @@ template <typename MsgT>

auto contmsg = makeMessage<GroupOnlyMsg>(group, op_id);
if (parent != this_node) {
theMsg()->sendMsg<GroupOnlyMsg, Info::groupTriggerHandler>(
theMsg()->sendMsg<Info::groupTriggerHandler>(
parent, contmsg
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/proxy/proxy_objgroup.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ messaging::PendingSend Proxy<void>::broadcast(Args&&... args) const {
template <typename MsgT, ActiveTypedFnType<MsgT>* f>
messaging::PendingSend
Proxy<void>::broadcastMsg(messaging::MsgPtrThief<MsgT> msg, TagType tag) const {
return theMsg()->broadcastMsg<MsgT, f>(msg, true, tag);
return theMsg()->broadcastMsg<f>(msg, true, tag);
}

template <typename OpT, typename FunctorT, typename MsgT, typename... Args>
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ inline ProxyElm<void>::ProxyElm(NodeType in_node) : node_{in_node} {}

template <typename MsgT, ActiveTypedFnType<MsgT>* f, typename... Args>
void ProxyElm<void>::send(Args&&... args) const {
vt::theMsg()->sendMsg<MsgT, f>(
vt::theMsg()->sendMsg<f>(
node_, vt::makeMessage<MsgT>(std::forward<Args>(args)...));
}

Expand Down
Loading

0 comments on commit 3502881

Please sign in to comment.