Skip to content

Commit

Permalink
#1501: vrt_coll: major refactoring for collection construction/insert…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
lifflander committed Jul 27, 2021
1 parent 7bc62d8 commit 318c91a
Show file tree
Hide file tree
Showing 48 changed files with 1,404 additions and 2,384 deletions.
2 changes: 1 addition & 1 deletion src/vt/rdmahandle/manager.collection.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Handle<T, E, IndexT> Manager::makeCollectionHandles(
if (iter == collection_to_manager_[proxy_bits].end()) {
// First time this handle is being created on this node
if (map_han == -1) {
map_han = vrt::collection::UniversalIndexHolder<>::getMap(proxy_bits);
map_han = theCollection()->getTypelessHolder().getMap(proxy_bits);
}
sub_proxy = SubType::construct(true, range, true, map_han);
// Register the migration listener
Expand Down
11 changes: 11 additions & 0 deletions src/vt/topos/mapping/dense/dense.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@

namespace vt { namespace mapping {

/**
* \struct BaseMapper
*
* \brief The base class for a general mapper object group used for mapping
* elements of a collection to a node
*/
template <typename IdxT>
struct BaseMapper {
virtual NodeType map(IdxT* idx, int ndim) = 0;
};

template <typename IndexElmType, typename PhysicalType>
NodeType blockMapDenseFlatIndex(
IndexElmType* flat_idx, IndexElmType* num_elems, PhysicalType num_resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// insertable.h
// unbounded_default.h
// DARMA/vt => Virtual Transport
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
Expand Down Expand Up @@ -41,28 +41,27 @@
//@HEADER
*/

#if !defined INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_H
#define INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_H
#if !defined INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_H
#define INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_H

#include "vt/config.h"
#include "vt/vrt/vrt_common.h"
#include "vt/topos/mapping/dense/dense.h"

namespace vt { namespace vrt { namespace collection {
namespace vt { namespace mapping {

template <typename ColT, typename IndexT>
struct Insertable {
Insertable() = default;
/**
* \struct UnboundedDefaultMap
*
* \brief The default mapper for an unbounded dynamic collection
*/
template <typename IdxT>
struct UnboundedDefaultMap : BaseMapper<IdxT> {
static ObjGroupProxyType construct();

void insert(
IndexT const& idx, NodeType const& node = uninitialized_destination
);
void beginInserting();
void finishInserting();

protected:
bool doneInserting = false;
NodeType map(IdxT* idx, int ndim) override;
};

}}} /* end namespace vt::vrt::collection */
}} /* end namespace vt::mapping */

#include "vt/topos/mapping/dense/unbounded_default.impl.h"

#endif /*INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_H*/
#endif /*INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_H*/
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// insertable_epoch.h
// unbounded_default.impl.h
// DARMA/vt => Virtual Transport
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
Expand Down Expand Up @@ -41,31 +41,28 @@
//@HEADER
*/

#if !defined INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_EPOCH_H
#define INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_EPOCH_H
#if !defined INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_IMPL_H
#define INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_IMPL_H

#include "vt/config.h"
#include "vt/vrt/collection/types/insertable.h"
#include "vt/objgroup/manager.h"

namespace vt { namespace vrt { namespace collection {
namespace vt { namespace mapping {

/*
* Can be inserted during a specific epoch which is a dynamic (partially
* collective) property over time
*/

template <typename ColT, typename IndexT>
struct InsertableEpoch :
Insertable<ColT, IndexT>
{
InsertableEpoch()
: Insertable<ColT, IndexT>()
{ }
template <typename IdxT>
NodeType UnboundedDefaultMap<IdxT>::map(IdxT* idx, int ndim) {
typename IdxT::DenseIndexType val = 0;
for (int i = 0; i < ndim; i++) {
val ^= idx->get(i);
}
return val % theContext()->getNumNodes();
}

protected:
EpochType curEpoch_ = no_epoch;
};
template <typename IdxT>
/*static*/ ObjGroupProxyType UnboundedDefaultMap<IdxT>::construct() {
auto proxy = theObjGroup()->makeCollective<UnboundedDefaultMap<IdxT>>();
return proxy.getProxy();
}

}}} /* end namespace vt::vrt::collection */
}} /* end namespace vt::mapping */

#endif /*INCLUDED_VT_VRT_COLLECTION_TYPES_INSERTABLE_EPOCH_H*/
#endif /*INCLUDED_VT_TOPOS_MAPPING_DENSE_UNBOUNDED_DEFAULT_IMPL_H*/
Loading

0 comments on commit 318c91a

Please sign in to comment.