Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1051: Add local invoke to proxies that trace and record LB #1132

Merged
merged 18 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3090282
#1051: vrt-collection: add invoke function to virtual collection prox…
JacobDomagala Oct 29, 2020
97999ad
#1051: objgroup: add invoke function for objgrp proxy which invokes g…
JacobDomagala Nov 3, 2020
b836975
#1051: vrt-collection: Add unittest for Vrt-Collection invoke
JacobDomagala Nov 4, 2020
baf591a
#1051: objgroup: Add unittest for Objgroup proxy invoke
JacobDomagala Nov 4, 2020
d790d80
#1051: runnable: Add invoke function which invokes and creates trace …
JacobDomagala Nov 16, 2020
7e4fa4a
#1051: objgroup: Add non-msg invoke function for objgrp proxy.
JacobDomagala Nov 16, 2020
798dea1
#1051: vrt-collection: Add non-msg invoke function for vrt-collection…
JacobDomagala Nov 16, 2020
d6b793b
#1051: runnable: Fix issue with incorrectly generated Trace name for …
JacobDomagala Nov 17, 2020
1b43d37
#1051: runnable: Use explicit return time for invoke.h function when …
JacobDomagala Nov 20, 2020
e937a15
#1051: vrt-collection: Cleanup invoke related code in vrt-collection
JacobDomagala Nov 20, 2020
6d51393
#1051: runnable: Extract functions for trace names generation used in…
JacobDomagala Nov 20, 2020
20c78cc
#1051: runnable: Add more unittests for invoke function
JacobDomagala Nov 20, 2020
db4ce8b
#1051: runnable: Move return type SFINAE checks (used for invoke func…
JacobDomagala Nov 22, 2020
9841046
#1051: objgroup: Remove warnings
JacobDomagala Nov 22, 2020
2507946
#1051: runnable: Use LocalInvoke enum value in outputTraces function
JacobDomagala Nov 22, 2020
7d7551c
#1051: trace: Use Create event type for local invoke
JacobDomagala Nov 26, 2020
3c6a390
#1051: vrt-collection: Add doxygen documentation for invokable struct
JacobDomagala Nov 27, 2020
e1d4ad4
#1051: trace: Fix incorrect trace name for invoke and remove localInv…
JacobDomagala Dec 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ set(
vrt/collection/dispatch vrt/collection/gettable vrt/collection/rdmaable
vrt/collection/staged_token
vrt/collection/listener
vrt/collection/invoke
vrt/collection/balance
vrt/collection/balance/baselb
vrt/collection/balance/hierarchicallb
Expand Down
2 changes: 2 additions & 0 deletions src/vt/objgroup/manager.fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void dispatchObjGroup(MsgSharedPtr<ShortMessage> msg, HandlerType han);
template <typename MsgT>
void send(MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node);
template <typename MsgT>
void invoke(messaging::MsgPtrThief<MsgT> msg, HandlerType han, NodeType node);
template <typename MsgT>
void broadcast(MsgSharedPtr<MsgT> msg, HandlerType han);
void scheduleMsg(
MsgSharedPtr<ShortMessage> msg, HandlerType han, EpochType epoch
Expand Down
31 changes: 31 additions & 0 deletions src/vt/objgroup/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,26 @@ struct ObjGroupManager : runtime::component::Component<ObjGroupManager> {
template <typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void send(ProxyElmType<ObjT> proxy, MsgSharedPtr<MsgT> msg);

/**
* \internal \brief Invoke message handler on an element of the object group
* The message handler will be invoked inline without going through scheduler
*
* \param[in] proxy proxy to the object group
* \param[in] msg message
*/
template <typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void invoke(ProxyElmType<ObjT> proxy, messaging::MsgPtrThief<MsgT> msg);

/**
* \internal \brief Invoke function 'f' on an element of the object group
* The function will be invoked inline without going through scheduler
*
* \param[in] proxy proxy to the object group
* \param[in] args function arguments
*/
template <typename ObjT, typename Type, Type f, typename... Args>
decltype(auto) invoke(ProxyElmType<ObjT> proxy, Args&&... args);

/**
* \internal \brief Broadcast a message to all nodes in object group
*
Expand Down Expand Up @@ -316,6 +336,17 @@ struct ObjGroupManager : runtime::component::Component<ObjGroupManager> {
template <typename MsgT>
void send(MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node);

/**
* \internal \brief Invoke a message handler on an objgroup
* The message handler will be invoked inline without going through scheduler
*
* \param[in] msg message
* \param[in] han handler to invoke
* \param[in] node node to invoke the handler on
*/
template <typename MsgT>
void invoke(messaging::MsgPtrThief<MsgT> msg, HandlerType han, NodeType node);

/**
* \internal \brief Broadcast message to an objgroup
*
Expand Down
48 changes: 47 additions & 1 deletion src/vt/objgroup/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "vt/registry/auto/auto_registry.h"
#include "vt/collective/collective_alg.h"
#include "vt/messaging/active.h"
#include "vt/runnable/invoke.h"

#include <memory>

Expand Down Expand Up @@ -262,17 +263,55 @@ void ObjGroupManager::send(ProxyElmType<ObjT> proxy, MsgSharedPtr<MsgT> msg) {
send<MsgT>(msg,han,dest_node);
}

template <typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void ObjGroupManager::invoke(
ProxyElmType<ObjT> proxy, messaging::MsgPtrThief<MsgT> msg
) {
auto const proxy_bits = proxy.getProxy();
auto const dest_node = proxy.getNode();
auto const ctrl = proxy::ObjGroupProxy::getID(proxy_bits);
auto const han = auto_registry::makeAutoHandlerObjGroup<ObjT, MsgT, fn>(ctrl);

vt_debug_print(
objgroup, node,
"ObjGroupManager::invoke: proxy={:x}, node={}, ctrl={:x}, han={:x}\n",
proxy_bits, dest_node, ctrl, han
);

invoke<MsgT>(msg, han, dest_node);
}

template <typename ObjT, typename Type, Type f, typename... Args>
decltype(auto)
ObjGroupManager::invoke(ProxyElmType<ObjT> proxy, Args&&... args) {
auto const dest_node = proxy.getNode();
auto const this_node = theContext()->getNode();

vtAssert(
dest_node == this_node,
fmt::format(
"Attempting to invoke handler on node:{} instead of node:{}!\n", this_node,
dest_node
)
);

return runnable::invoke<Type, f>(get(proxy), std::forward<Args>(args)...);
}


template <typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void ObjGroupManager::broadcast(ProxyType<ObjT> proxy, MsgSharedPtr<MsgT> msg) {
auto const proxy_bits = proxy.getProxy();
auto const ctrl = proxy::ObjGroupProxy::getID(proxy_bits);
auto const han = auto_registry::makeAutoHandlerObjGroup<ObjT,MsgT,fn>(ctrl);

vt_debug_print(
objgroup, node,
"ObjGroupManager::broadcast: proxy={:x}, ctrl={:x}, han={:x}\n",
proxy_bits, ctrl, han
);
broadcast<MsgT>(msg,han);

broadcast<MsgT>(msg, han);
}

template <typename MsgT>
Expand All @@ -282,6 +321,13 @@ void ObjGroupManager::send(
return objgroup::send(msg,han,dest_node);
}

template <typename MsgT>
void ObjGroupManager::invoke(
messaging::MsgPtrThief<MsgT> msg, HandlerType han, NodeType dest_node
) {
objgroup::invoke(msg, han, dest_node);
}

template <typename MsgT>
void ObjGroupManager::broadcast(MsgSharedPtr<MsgT> msg, HandlerType han) {
return objgroup::broadcast(msg,han);
Expand Down
15 changes: 15 additions & 0 deletions src/vt/objgroup/manager.static.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ void send(MsgSharedPtr<MsgT> msg, HandlerType han, NodeType dest_node) {
}
}

template <typename MsgT>
void invoke(messaging::MsgPtrThief<MsgT> msg, HandlerType han, NodeType dest_node) {
auto const this_node = theContext()->getNode();

vtAssert(
dest_node == this_node,
fmt::format(
"Attempting to invoke handler on node:{} instead of node:{}!", this_node,
dest_node
)
);

runnable::Runnable<MsgT>::run(han, nullptr, msg.msg_.get(), this_node);
}

template <typename MsgT>
void broadcast(MsgSharedPtr<MsgT> msg, HandlerType han) {
// Get the current epoch for the message
Expand Down
18 changes: 18 additions & 0 deletions src/vt/objgroup/proxy/proxy_objgroup_elm.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ struct ProxyElm {
template <typename MsgT, ActiveObjType<MsgT, ObjT> fn, typename... Args>
void send(Args&&... args) const;

/**
* \brief Invoke locally a message handler on the node/element indexed by this proxy.
* The message handler will be invoked inline without going through scheduler
*
* \param[in] args args to pass to the message constructor
*/
template <typename MsgT, ActiveObjType<MsgT, ObjT> fn, typename... Args>
void invoke(Args&&... args) const;

/**
* \brief Invoke locally a function 'f' on the node/element indexed by this proxy.
* The function will be invoked inline without going through scheduler
*
* \param[in] args function arguments
*/
template <typename Type, Type f, typename... Args>
decltype(auto) invoke(Args&&... args) const;

/**
* \brief Update the local object instance pointer on this node. Must be run
* on local node.
Expand Down
20 changes: 20 additions & 0 deletions src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,26 @@ void ProxyElm<ObjT>::send(Args&&... args) const {
return sendMsg<MsgT,fn>(makeMessage<MsgT>(std::forward<Args>(args)...));
}

template <typename ObjT>
template <typename MsgT, ActiveObjType<MsgT, ObjT> fn, typename... Args>
void ProxyElm<ObjT>::invoke(Args&&... args) const {
auto proxy = ProxyElm<ObjT>(*this);
theObjGroup()->invoke<ObjT, MsgT, fn>(
proxy, makeMessage<MsgT>(std::forward<Args>(args)...)
);
}

template <typename ObjT>
template <typename Type, Type f, typename... Args>
decltype(auto) ProxyElm<ObjT>::invoke(
Args&&... args
) const
{
auto proxy = ProxyElm<ObjT>(*this);
return theObjGroup()->invoke<ObjT, Type, f>(
proxy, std::forward<Args>(args)...);
}

template <typename ObjT>
template <typename SerializerT>
void ProxyElm<ObjT>::serialize(SerializerT& s) {
Expand Down
Loading