Skip to content

Commit

Permalink
#1497: vrt_coll: implement function to get local indices
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jul 6, 2021
1 parent b59bc88 commit 749470b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/vt/vrt/collection/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,16 @@ struct CollectionManager
template <typename ColT, typename IndexT = typename ColT::IndexType>
IndexT getRange(VirtualProxyType proxy);

/**
* \brief Get the local indices that are currently on this node
*
* \param[in] proxy the proxy of the collection
*
* \return the set of indices on this node
*/
template <typename ColT, typename IndexT = typename ColT::IndexType>
std::set<IndexT> getLocalIndices(CollectionProxyWrapType<ColT> proxy);

/**
* \brief Make the filename for checkpoint/restore
*
Expand Down
12 changes: 12 additions & 0 deletions src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,18 @@ IndexT CollectionManager::getRange(VirtualProxyType proxy) {
return col_holder->max_idx;
}

template <typename ColT, typename IndexT>
std::set<IndexT> CollectionManager::getLocalIndices(
CollectionProxyWrapType<ColT> proxy
) {
auto elm_holder = findElmHolder<ColT>(proxy);
std::set<IndexT> local;
elm_holder->foreach([&](IndexT const& idx, CollectionBase<ColT,IndexT>*) {
local.insert(idx);
});
return local;
}

template <typename IndexT>
std::string CollectionManager::makeMetaFilename(
std::string file_base, bool make_sub_dirs
Expand Down

0 comments on commit 749470b

Please sign in to comment.