Skip to content

Commit

Permalink
#1490: vrt_coll: add documentation, improve name
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Aug 2, 2021
1 parent 22df455 commit b09e318
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
29 changes: 24 additions & 5 deletions src/vt/vrt/collection/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1871,15 +1871,21 @@ struct CollectionManager
typename ColT::IndexType range, std::string const& file_base
);

/**
* \internal \struct RestoreMigrateMsg
*
* \brief Migrate elements to restore where it belongs based on the checkpoint
*/
template <
typename ColT,
typename MsgT = vt::Message,
typename IdxT = typename ColT::IndexType
>
struct RestoreMigrateMsg : MsgT {
RestoreMigrateMsg() = default;
RestoreMigrateMsg(NodeType in_to_node, IdxT in_idx, CollectionProxyWrapType<ColT> in_proxy)
: to_node_(in_to_node),
RestoreMigrateMsg(
NodeType in_to_node, IdxT in_idx, CollectionProxyWrapType<ColT> in_proxy
) : to_node_(in_to_node),
idx_(in_idx),
proxy_(in_proxy)
{ }
Expand All @@ -1889,18 +1895,31 @@ struct CollectionManager
CollectionProxyWrapType<ColT> proxy_;
};

/**
* \internal \struct RestoreMigrateColMsg
*
* \brief Migrate collection element to restore where it belongs
*/
template <typename ColT, typename IdxT = typename ColT::IndexType>
struct RestoreMigrateColMsg
: RestoreMigrateMsg<ColT, CollectionMessage<ColT>, IdxT>
{
RestoreMigrateColMsg() = default;
RestoreMigrateColMsg(NodeType in_to_node, IdxT in_idx, CollectionProxyWrapType<ColT> in_proxy)
: RestoreMigrateMsg<ColT, CollectionMessage<ColT>, IdxT>(in_to_node, in_idx, in_proxy)
RestoreMigrateColMsg(
NodeType in_to_node, IdxT in_idx, CollectionProxyWrapType<ColT> in_proxy
) : RestoreMigrateMsg<ColT, CollectionMessage<ColT>, IdxT>(
in_to_node, in_idx, in_proxy
)
{ }
};

/**
* \internal \brief Migrate element to restore location from checkpoint
*
* \param[in] msg the migrate message
*/
template <typename ColT>
static void restoreHandler(RestoreMigrateMsg<ColT>* msg);
static void migrateToRestoreLocation(RestoreMigrateMsg<ColT>* msg);

/**
* \brief Restore the collection (collective) from file on top of an existing
Expand Down
10 changes: 7 additions & 3 deletions src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3173,7 +3173,9 @@ inline void restoreOffHomeElement(
} /* end namespace detail */

template <typename ColT>
/*static*/ void CollectionManager::restoreHandler(RestoreMigrateMsg<ColT>* msg) {
/*static*/ void CollectionManager::migrateToRestoreLocation(
RestoreMigrateMsg<ColT>* msg
) {
auto idx = msg->idx_;
auto node = msg->to_node_;
auto proxy = msg->proxy_;
Expand Down Expand Up @@ -3224,9 +3226,11 @@ void CollectionManager::restoreFromFileInPlace(
using MsgType = RestoreMigrateMsg<ColT>;
auto msg = makeMessage<MsgType>(this_node, idx, proxy);
if (mapped_node != this_node) {
theMsg()->sendMsg<MsgType, restoreHandler<ColT>>(mapped_node, msg);
theMsg()->sendMsg<MsgType, migrateToRestoreLocation<ColT>>(
mapped_node, msg
);
} else {
restoreHandler<ColT>(msg.get());
migrateToRestoreLocation<ColT>(msg.get());
}
}
}
Expand Down

0 comments on commit b09e318

Please sign in to comment.