vt::objgroup::ObjGroupManager struct

A core VT component that can create groups with one object per node.

Create a "object group" with one instance of that group on each node. An instantiated object group has once instance on each node that can be collectively referred to with a single proxy. This proxy allows sends/broadcasts/reduces over the object group.

Object groups create a clean isolation of a instance of some functionality that has distributed behavior. Some of the newer VT components are implemented as object groups, such as the load balancers.

Base classes

template<typename T>
struct vt::runtime::component::Component<ObjGroupManager>
Component class for a generic VT runtime module, CRTP'ed over the component's actual type

Public types

template<typename ObjT>
using ProxyType = proxy::Proxy<ObjT>
template<typename ObjT>
using ProxyElmType = proxy::ProxyElm<ObjT>
template<typename ObjT>
using MakeFnType = std::function<std::unique_ptr<ObjT>()>
using HolderBaseType = holder::HolderBase
using HolderBasePtrType = std::unique_ptr<HolderBaseType>
using PendingSendType = messaging::PendingSend

Constructors, destructors, conversion operators

ObjGroupManager() defaulted
Construct the ObjGroupManager.

Public functions

auto name() -> std::string override
Get the name of the component.
void startup() override
Empty default overridden startup method.
auto getDefault() const -> proxy::DefaultProxyType
Construct a special proxy instance that allows sending, broadcasting and reducing without actual object group.
template<typename ObjT, typename... Args>
auto makeCollective(std::string const& label, Args && ... args) -> ProxyType<ObjT>
Collectively construct a new object group. Allocates and constructs the object on each node by forwarding constructor arguments.
template<typename ObjT>
auto makeCollective(std::unique_ptr<ObjT> obj, std::string const& label = {}) -> ProxyType<ObjT>
Collectively construct a new object group from a existing unique pointer to the local object.
template<typename ObjT>
auto makeCollective(MakeFnType<ObjT> fn, std::string const& label = {}) -> ProxyType<ObjT>
Collectively construct a new object group with a callback to provide a unique pointer on each node.
template<typename ObjT>
auto makeCollective(ObjT* obj, std::string const& label = {}) -> ProxyType<ObjT>
Collectively construct a new object group from a raw pointer to the object.
template<template<typename> class UserPtr, typename ObjT>
auto makeCollective(UserPtr<ObjT> obj, std::string const& label = {}) -> ProxyType<ObjT>
Collectively construct a new object group from a smart-pointer-like handle.
template<typename ObjT>
void destroyCollective(ProxyType<ObjT> proxy)
Collectively destroy an object group across the whole system.
template<typename ObjT, typename... Args>
void update(ProxyElmType<ObjT> proxy, Args && ... args)
Locally update the underlying object group instance. Swap the current object group locally for a new instance.
template<typename ObjT, typename... Args>
void update(ProxyType<ObjT> proxy, Args && ... args)
Collectively update the underlying object group instance. Swap the current object group for a new instance.
template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
auto send(ProxyElmType<ObjT> proxy, MsgSharedPtr<MsgT> msg) -> PendingSendType
Send a message to an element of the object group.
template<auto fn>
auto send(ProxyElmType<typename ObjFuncTraits<decltype(fn)>::ObjT> proxy, MsgSharedPtr<typename ObjFuncTraits<decltype(fn)>::MsgT> msg) -> PendingSendType
Send a message to an element of the object group.
template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
auto invoke(ProxyElmType<ObjT> proxy, messaging::MsgPtrThief<MsgT> msg) -> decltype(auto)
Invoke message handler on an element of the object group The message handler will be invoked inline without going through scheduler.
template<typename ObjT, auto f, typename... Args>
auto invoke(ProxyElmType<ObjT> proxy, Args && ... args) -> decltype(auto)
Invoke function 'f' on an element of the object group The function will be invoked inline without going through scheduler.
template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
auto broadcast(ProxyType<ObjT> proxy, MsgSharedPtr<MsgT> msg) -> PendingSendType
Broadcast a message to all nodes in object group.
template<auto fn>
auto broadcast(ProxyType<typename ObjFuncTraits<decltype(fn)>::ObjT> proxy, MsgSharedPtr<typename ObjFuncTraits<decltype(fn)>::MsgT> msg) -> PendingSendType
Broadcast a message to all nodes in object group.
template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void setTraceName(ProxyType<ObjT> proxy, std::string const& name, std::string const& parent = "")
Change the traced name of the object group.
template<typename ObjT, typename MsgT, ActiveTypedFnType<MsgT>* f>
auto reduce(ProxyType<ObjT> proxy, MsgSharedPtr<MsgT> msg, collective::reduce::ReduceStamp const& stamp) -> PendingSendType
Perform a reduction over an objgroup.
template<typename ObjT, auto f>
auto reduce(ProxyType<ObjT> proxy, messaging::MsgPtrThief<typename FuncTraits<decltype(f)>::MsgT> msg, collective::reduce::ReduceStamp const& stamp) -> PendingSendType
Perform a reduction over an objgroup.
template<typename ObjT>
auto get(ProxyType<ObjT> proxy) -> ObjT*
Get a pointer to the local objgroup instance. Returns null if the object doesn't exist.
template<typename ObjT>
auto get(ProxyElmType<ObjT> proxy) -> ObjT*
Get a pointer to the local objgroup instance. Returns null if the object doesn't exist.
template<typename ObjT>
auto getProxy(ObjT* obj) -> ProxyType<ObjT>
Get the proxy from a object instance pointer. Assert that object pointer is part of a valid object group.
template<typename ObjT>
auto proxyElm(ObjT* obj) -> ProxyElmType<ObjT>
Get the element proxy from a object instance pointer.
template<typename ObjT>
auto getLabel(ProxyType<ObjT> proxy) const -> std::string
Get object group label.
template<typename MsgT>
auto send(MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node) -> PendingSendType
Send a message to an objgroup.
template<typename ObjT, typename MsgT, auto f>
auto invoke(messaging::MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node) -> decltype(auto)
Invoke a message handler on an objgroup The message handler will be invoked inline without going through scheduler.
template<typename MsgT>
auto broadcast(MsgSharedPtr<MsgT> msg, HandlerType han) -> PendingSendType
Broadcast message to an objgroup.
auto getProxy(ObjGroupProxyType proxy) -> ObjGroupProxyType
Get the proxy, identity function.
template<typename SerializerT>
void serialize(SerializerT& s)

Friends

auto detail::getHolderBase(HandlerType handler) -> holder::HolderBase*
auto getObjs() -> std::unordered_map<ObjGroupProxyType, HolderBasePtrType>&
auto getPending() -> std::unordered_map<ObjGroupProxyType, std::vector<ActionType>>&

Function documentation

proxy::DefaultProxyType vt::objgroup::ObjGroupManager::getDefault() const

Construct a special proxy instance that allows sending, broadcasting and reducing without actual object group.

Returns proxy to the object group

template<typename ObjT, typename... Args>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::makeCollective(std::string const& label, Args && ... args)

Collectively construct a new object group. Allocates and constructs the object on each node by forwarding constructor arguments.

Parameters
label in object group label
args in args to pass to the object's constructor on each node
Returns proxy to the object group

template<typename ObjT>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::makeCollective(std::unique_ptr<ObjT> obj, std::string const& label = {})

Collectively construct a new object group from a existing unique pointer to the local object.

Parameters
obj in the std::unique_ptr<ObjT> to the local object
label in object group label
Returns proxy to the object group

template<typename ObjT>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::makeCollective(MakeFnType<ObjT> fn, std::string const& label = {})

Collectively construct a new object group with a callback to provide a unique pointer on each node.

Parameters
fn in callback function to construct
label in object group label
Returns proxy to the object group

template<typename ObjT>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::makeCollective(ObjT* obj, std::string const& label = {})

Collectively construct a new object group from a raw pointer to the object.

Parameters
obj in raw pointer to the object
label in object group label
Returns proxy to the object group

template<template<typename> class UserPtr, typename ObjT>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::makeCollective(UserPtr<ObjT> obj, std::string const& label = {})

Collectively construct a new object group from a smart-pointer-like handle.

Parameters
obj in the smart-pointer-like handle that the system holds until destruction
label in object group label
Returns proxy to the object group

template<typename ObjT>
void vt::objgroup::ObjGroupManager::destroyCollective(ProxyType<ObjT> proxy)

Collectively destroy an object group across the whole system.

Parameters
proxy in proxy to the object group

template<typename ObjT, typename... Args>
void vt::objgroup::ObjGroupManager::update(ProxyElmType<ObjT> proxy, Args && ... args)

Locally update the underlying object group instance. Swap the current object group locally for a new instance.

Parameters
proxy in proxy to the object group
args in args to reconstruct the object group instance

template<typename ObjT, typename... Args>
void vt::objgroup::ObjGroupManager::update(ProxyType<ObjT> proxy, Args && ... args)

Collectively update the underlying object group instance. Swap the current object group for a new instance.

Parameters
proxy in proxy to the object group
args in args to reconstruct the object group instance

template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
PendingSendType vt::objgroup::ObjGroupManager::send(ProxyElmType<ObjT> proxy, MsgSharedPtr<MsgT> msg)

Send a message to an element of the object group.

Parameters
proxy in proxy to the object group
msg in message to send

template<auto fn>
PendingSendType vt::objgroup::ObjGroupManager::send(ProxyElmType<typename ObjFuncTraits<decltype(fn)>::ObjT> proxy, MsgSharedPtr<typename ObjFuncTraits<decltype(fn)>::MsgT> msg)

Send a message to an element of the object group.

Parameters
proxy in proxy to the object group
msg in message to send

template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
decltype(auto) vt::objgroup::ObjGroupManager::invoke(ProxyElmType<ObjT> proxy, messaging::MsgPtrThief<MsgT> msg)

Invoke message handler on an element of the object group The message handler will be invoked inline without going through scheduler.

Parameters
proxy in proxy to the object group
msg in message

template<typename ObjT, auto f, typename... Args>
decltype(auto) vt::objgroup::ObjGroupManager::invoke(ProxyElmType<ObjT> proxy, Args && ... args)

Invoke function 'f' on an element of the object group The function will be invoked inline without going through scheduler.

Parameters
proxy in proxy to the object group
args in function arguments

template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
PendingSendType vt::objgroup::ObjGroupManager::broadcast(ProxyType<ObjT> proxy, MsgSharedPtr<MsgT> msg)

Broadcast a message to all nodes in object group.

Parameters
proxy in proxy to the object group
msg in message to broadcast

template<auto fn>
PendingSendType vt::objgroup::ObjGroupManager::broadcast(ProxyType<typename ObjFuncTraits<decltype(fn)>::ObjT> proxy, MsgSharedPtr<typename ObjFuncTraits<decltype(fn)>::MsgT> msg)

Broadcast a message to all nodes in object group.

Parameters
proxy in proxy to the object group
msg in message to broadcast

template<typename ObjT, typename MsgT, ActiveObjType<MsgT, ObjT> fn>
void vt::objgroup::ObjGroupManager::setTraceName(ProxyType<ObjT> proxy, std::string const& name, std::string const& parent = "")

Change the traced name of the object group.

Parameters
proxy in proxy to the object group
name in the new active method name for the object group in traces
parent in the new object function name

template<typename ObjT, typename MsgT, ActiveTypedFnType<MsgT>* f>
PendingSendType vt::objgroup::ObjGroupManager::reduce(ProxyType<ObjT> proxy, MsgSharedPtr<MsgT> msg, collective::reduce::ReduceStamp const& stamp)

Perform a reduction over an objgroup.

Parameters
proxy in proxy to the object group
msg in reduction message
stamp in stamp to identify reduction across nodes
Returns the PendingSend corresponding to the reduce

template<typename ObjT, auto f>
PendingSendType vt::objgroup::ObjGroupManager::reduce(ProxyType<ObjT> proxy, messaging::MsgPtrThief<typename FuncTraits<decltype(f)>::MsgT> msg, collective::reduce::ReduceStamp const& stamp)

Perform a reduction over an objgroup.

Parameters
proxy in proxy to the object group
msg in reduction message
stamp in stamp to identify reduction across nodes
Returns the PendingSend corresponding to the reduce

template<typename ObjT>
ObjT* vt::objgroup::ObjGroupManager::get(ProxyType<ObjT> proxy)

Get a pointer to the local objgroup instance. Returns null if the object doesn't exist.

Parameters
proxy in proxy to the object group
Returns raw pointer to the object instance on this node

template<typename ObjT>
ObjT* vt::objgroup::ObjGroupManager::get(ProxyElmType<ObjT> proxy)

Get a pointer to the local objgroup instance. Returns null if the object doesn't exist.

Parameters
proxy in indexed proxy to the object group (must be the current node)
Returns raw pointer to the object instance on this node

template<typename ObjT>
ProxyType<ObjT> vt::objgroup::ObjGroupManager::getProxy(ObjT* obj)

Get the proxy from a object instance pointer. Assert that object pointer is part of a valid object group.

Parameters
obj in the raw pointer to an object
Returns proxy to the object group

template<typename ObjT>
ProxyElmType<ObjT> vt::objgroup::ObjGroupManager::proxyElm(ObjT* obj)

Get the element proxy from a object instance pointer.

Parameters
obj in the raw pointer to an object
Returns indexed proxy to the object group

template<typename ObjT>
std::string vt::objgroup::ObjGroupManager::getLabel(ProxyType<ObjT> proxy) const

Get object group label.

Parameters
proxy in indexed proxy to the object group (must be the current node)
Returns label of the Object Group

template<typename MsgT>
PendingSendType vt::objgroup::ObjGroupManager::send(MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node)

Send a message to an objgroup.

Parameters
msg in message to send
han in handler to invoke
node in node to send message

template<typename ObjT, typename MsgT, auto f>
decltype(auto) vt::objgroup::ObjGroupManager::invoke(messaging::MsgSharedPtr<MsgT> msg, HandlerType han, NodeType node)

Invoke a message handler on an objgroup The message handler will be invoked inline without going through scheduler.

Parameters
msg in message
han in handler to invoke
node in node to invoke the handler on

template<typename MsgT>
PendingSendType vt::objgroup::ObjGroupManager::broadcast(MsgSharedPtr<MsgT> msg, HandlerType han)

Broadcast message to an objgroup.

Parameters
msg in message to broadcast
han in handler to invoke

ObjGroupProxyType vt::objgroup::ObjGroupManager::getProxy(ObjGroupProxyType proxy)

Get the proxy, identity function.

Parameters
proxy in the proxy to the objgroup
Returns the proxy