Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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/vt/configs/error/stack_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <string>
#include <tuple>
#include <vector>
#include <cstdint>

namespace vt { namespace debug { namespace stack {

Expand Down
7 changes: 6 additions & 1 deletion src/vt/elm/elm_lb_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "vt/elm/elm_id.h"
#include "vt/elm/elm_comm.h"
#include "vt/timing/timing.h"
#include "vt/vrt/vrt_common.h"

namespace vt { namespace vrt { namespace collection { namespace balance {

Expand Down Expand Up @@ -109,9 +110,13 @@ struct ElementLBData {

template <typename Serializer>
void serialize(Serializer& s) {
using vt::vrt::CheckpointInternalTrait;
using checkpoint::has_user_traits_v;

s | cur_time_started_;
s | cur_time_;
s | cur_phase_;
if(!has_user_traits_v<Serializer, CheckpointInternalTrait>)
s | cur_phase_;
s | phase_timings_;
s | phase_comm_;
s | cur_subphase_;
Expand Down
10 changes: 10 additions & 0 deletions src/vt/objgroup/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ struct ObjGroupManager : runtime::component::Component<ObjGroupManager> {
template <typename ObjT>
ProxyElmType<ObjT> proxyElm(ObjT* obj);

/**
* \brief Get the group that a proxy element is a member of.
*
* \param[in] proxy_elm an element of an object group
*
* \return de-indexed proxy to the object group
*/
template <typename ObjT>
ProxyType<ObjT> proxyGroup(ProxyElmType<ObjT> proxy_elm);

/**
* \brief Get object group label
*
Expand Down
5 changes: 5 additions & 0 deletions src/vt/objgroup/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ typename ObjGroupManager::ProxyElmType<ObjT> ObjGroupManager::proxyElm(ObjT* obj
return getProxy<ObjT>(obj).operator()(theContext()->getNode());
}

template <typename ObjT>
typename ObjGroupManager::ProxyType<ObjT> ObjGroupManager::proxyGroup(ProxyElmType<ObjT> proxy_elm) {
return ProxyType<ObjT>(proxy_elm.getProxy());
}

template <typename ObjT>
std::string ObjGroupManager::getLabel(ObjGroupManager::ProxyType<ObjT> proxy) const {
auto const proxy_bits = proxy.getProxy();
Expand Down
25 changes: 25 additions & 0 deletions src/vt/objgroup/proxy/proxy_objgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#include "vt/utils/fntraits/fntraits.h"
#include "vt/group/region/group_list.h"

#include "vt/vrt/vrt_common.h"

namespace vt { namespace objgroup { namespace proxy {

/**
Expand Down Expand Up @@ -449,7 +451,30 @@ struct Proxy {

template <typename Serializer>
void serialize(Serializer& s) {
auto old_proxy = proxy_;
s | proxy_;

using vt::vrt::CheckpointTrait;
using vt::vrt::CheckpointInternalTrait;
using checkpoint::has_user_traits_v;

if constexpr(has_user_traits_v<Serializer, CheckpointTrait>){
vtAssert(old_proxy != no_obj_group, "ObjGroups must be pre-instantiated to be checkpointed or restored");
vtWarnIf(old_proxy != proxy_,
"Checkpointed ObjGroup and deserialize target do not match!");
proxy_ = old_proxy;

auto objPtr = get();

bool null = objPtr == nullptr;
s | null;

if(!null){
auto newS = s.template withoutTraits<CheckpointTrait>()
.template withTraits<CheckpointInternalTrait>();
newS | *objPtr;
}
}
}

private:
Expand Down
2 changes: 1 addition & 1 deletion src/vt/serialization/sizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct MsgSizer<
> {
static std::size_t get(MsgT* msg) {
auto& msg_ref = *msg;
return ::checkpoint::getSize<MsgT>(msg_ref);
return ::checkpoint::getSize(msg_ref);
}
};

Expand Down
1 change: 1 addition & 0 deletions src/vt/utils/compress/decompressor_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <string>
#include <cstdint>
#include <cstdlib>
#include <cstdint>

namespace vt { namespace util { namespace compress {

Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/collection_builder.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::tuple<EpochType, VirtualProxyType> CollectionManager::makeCollection(
auto const is_collective = po.collective_;

// Generate a new proxy for this new collection
auto const proxy_bits = makeCollectionProxy(is_collective, is_migratable);
auto const proxy_bits = makeCollectionProxy<typename ColT::IndexType>(is_collective, is_migratable, po.proxy_bits_);
po.proxy_bits_ = proxy_bits;

if (not is_collective) {
Expand Down
24 changes: 0 additions & 24 deletions src/vt/vrt/collection/manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,30 +95,6 @@ void CollectionManager::schedule(ActionType action) {
theSched()->enqueue(action);
}

VirtualProxyType CollectionManager::makeCollectionProxy(
bool is_collective, bool is_migratable
) {
VirtualIDType const new_id = is_collective ?
next_collective_id_++ :
next_rooted_id_++;

auto const this_node = theContext()->getNode();
bool const is_collection = true;

// Create the new proxy with the `new_dist_id`
auto const proxy = VirtualProxyBuilder::createProxy(
new_id, this_node, is_collection, is_migratable, is_collective
);

vt_debug_print(
verbose, vrt_coll,
"makeCollectionProxy: node={}, new_dist_id={}, proxy={:x}\n",
this_node, new_id, proxy
);

return proxy;
}

/*static*/ void CollectionManager::computeReduceStamp(CollectionStampMsg* msg) {
theCollection()->reduce_stamp_[msg->proxy_] = msg->getVal();
}
Expand Down
18 changes: 17 additions & 1 deletion src/vt/vrt/collection/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "vt/vrt/collection/dispatch/registry.h"
#include "vt/vrt/collection/listener/listen_events.h"
#include "vt/vrt/proxy/collection_proxy.h"
#include "vt/vrt/proxy/collection_elm_proxy.h"
#include "vt/topos/mapping/mapping_headers.h"
#include "vt/messaging/message.h"
#include "vt/messaging/pending_send.h"
Expand Down Expand Up @@ -350,10 +351,14 @@ struct CollectionManager
*
* \param[in] is_collective whether the collection is collective
* \param[in] is_migratable whether the collection is migratable
* \param[in] request_match an input proxy which we would like to use, if
* there are no existing conflicts. no_vrt_proxy indicates no
* request.
*
* \return the collection proxy bits
*/
VirtualProxyType makeCollectionProxy(bool is_collective, bool is_migratable);
template<typename IndexT>
VirtualProxyType makeCollectionProxy(bool is_collective, bool is_migratable, VirtualProxyType request_match);

/**
* \brief Query the current index context of the running handler
Expand Down Expand Up @@ -1548,6 +1553,16 @@ struct CollectionManager
template <typename ColT, typename IndexT = typename ColT::IndexType>
IndexT getRange(VirtualProxyType proxy);

/**
* \brief Get the whether the collection has dynamic membership
*
* \param[in] proxy the proxy of the collection
*
* \return the dynamic membership state
*/
template <typename ColT, typename IndexT = typename ColT::IndexType>
bool getDynamicMembership(VirtualProxyType proxy);

/**
* \brief Get the local indices that are currently on this node
*
Expand Down Expand Up @@ -1798,6 +1813,7 @@ struct CollectionManager
#include "vt/vrt/collection/types/base.impl.h"
#include "vt/rdmahandle/manager.collection.impl.h"
#include "vt/vrt/proxy/collection_proxy.impl.h"
#include "vt/vrt/proxy/collection_elm_proxy.impl.h"
#include "vt/context/runnable_context/lb_data.impl.h"
#include "vt/context/runnable_context/collection.impl.h"

Expand Down
50 changes: 50 additions & 0 deletions src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,50 @@ void CollectionManager::insertMetaCollection(
};
}

template<typename IndexT>
VirtualProxyType CollectionManager::makeCollectionProxy(
bool is_collective, bool is_migratable, VirtualProxyType requested
) {

if(requested != no_vrt_proxy){
auto conflicting_holder = findColHolder<IndexT>(requested);

if(conflicting_holder == nullptr){
VirtualIDType const req_id = VirtualProxyBuilder::getVirtualID(requested);

if(is_collective) next_collective_id_ = std::max(next_collective_id_, req_id+1);
else next_rooted_id_ = std::max(next_rooted_id_, req_id+1);

vt_debug_print(
verbose, vrt_coll,
"makeCollectionProxy: node={}, new_dist_id={}, proxy={:x} (by request)\n",
theContext()->getNode(), req_id, requested
);
return requested;
} // else ignore request, make as normal
};

VirtualIDType const new_id = is_collective ?
next_collective_id_++ :
next_rooted_id_++;

auto const this_node = theContext()->getNode();
bool const is_collection = true;

// Create the new proxy with the `new_dist_id`
auto const proxy = VirtualProxyBuilder::createProxy(
new_id, this_node, is_collection, is_migratable, is_collective
);

vt_debug_print(
verbose, vrt_coll,
"makeCollectionProxy: node={}, new_dist_id={}, proxy={:x}\n",
this_node, new_id, proxy
);

return proxy;
}

template <typename ColT>
void CollectionManager::constructGroup(VirtualProxyType const& proxy) {
/*
Expand Down Expand Up @@ -2087,6 +2131,12 @@ IndexT CollectionManager::getRange(VirtualProxyType proxy) {
return col_holder->bounds;
}

template <typename ColT, typename IndexT>
bool CollectionManager::getDynamicMembership(VirtualProxyType proxy) {
auto col_holder = findColHolder<IndexT>(proxy);
return col_holder->has_dynamic_membership_;
}

template <typename ColT, typename IndexT>
std::set<IndexT> CollectionManager::getLocalIndices(
CollectionProxyWrapType<ColT> proxy
Expand Down
27 changes: 27 additions & 0 deletions src/vt/vrt/collection/param/construct_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@ struct ConstructParams {
);
}

protected:
friend CollectionProxy<ColT, typename ColT::IndexType>;
/**
* \brief Specify the proxy bits to attempt to use for this collection,
* if no conflicts are found. Helpful when restoring from checkpoints.
*
* \param[in] in_proxy_bits_ the proxy bits to request
*/
ThisType&& proxyBits(VirtualProxyType in_proxy_bits){
proxy_bits_ = in_proxy_bits;
migratable_ = VirtualProxyBuilder::isMigratable(in_proxy_bits);
return std::move(*this);
}

public:

/**
* \brief Specify the bounds for the collection. If it doesn't have dynamic
* membership this whole range will be constructed.
Expand Down Expand Up @@ -393,6 +409,17 @@ struct ConstructParams {
"Must have valid bounds or exactly one bulk insert or use list insertion"
);
}
if(proxy_bits_ != no_vrt_proxy){
using Bits = VirtualProxyBuilder;
vtAssert(
Bits::isCollection(proxy_bits_) == true and
Bits::isMigratable(proxy_bits_) == migratable_ and
Bits::isRemote(proxy_bits_) == collective_ and
( collective_ or
Bits::getVirtualNode(proxy_bits_) == theContext()->getNode()),
"Requested proxy bits must match requested collection properties"
);
}
}

public:
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/types/migratable.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define INCLUDED_VT_VRT_COLLECTION_TYPES_MIGRATABLE_IMPL_H

#include "vt/config.h"
#include "vt/vrt/vrt_common.h"
#include "vt/vrt/collection/types/migratable.h"

namespace vt { namespace vrt { namespace collection {
Expand Down
5 changes: 4 additions & 1 deletion src/vt/vrt/collection/types/storage/storable.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ namespace vt { namespace vrt { namespace collection { namespace storage {

template <typename SerializerT>
void Storable::serialize(SerializerT& s) {
s | map_;
//We need a traitless serializer, since StoreElmBase uses
//virtual serialization
auto clean_s = s.setTraits();
clean_s | map_;
}

template <typename U>
Expand Down
20 changes: 15 additions & 5 deletions src/vt/vrt/proxy/collection_elm_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@

#include "vt/config.h"
#include "vt/vrt/collection/proxy_traits/proxy_elm_traits.h"
#include "vt/vrt/collection/proxy_builder/elm_proxy_builder.h"
#include "vt/vrt/collection/manager.fwd.h"
#include "vt/vrt/collection/send/sendable.h"
#include "vt/vrt/collection/insert/insertable.h"
#include "vt/vrt/proxy/base_elm_proxy.h"
#include "vt/vrt/vrt_common.h"

#include <iosfwd>

Expand Down Expand Up @@ -83,19 +85,27 @@ struct VrtElmProxy : ProxyCollectionElmTraits<ColT, IndexT> {
other.elm_proxy_ == this->elm_proxy_;
}

template <typename SerializerT>
void serialize(SerializerT& s) {
ProxyCollectionElmTraits<ColT, IndexT>::serialize(s);
}
friend struct CollectionManager;

template <typename ColU, typename IndexU>
friend std::ostream& operator<<(
std::ostream& os, VrtElmProxy<ColU,IndexU> const& vrt
);

friend struct CollectionManager;
IndexT getIndex(){
return this->getElementProxy().getIndex();
}

template <typename SerT>
void serialize(SerT& s);

//Deserialize without placing values into the runtime,
//just return the element pointer.
template <typename SerT>
std::unique_ptr<ColT> deserializeToElm(SerT& s);
};


template <typename ColT, typename IndexT>
std::ostream& operator<<(
std::ostream& os, VrtElmProxy<ColT,IndexT> const& vrt
Expand Down
Loading
Loading