Skip to content

Commit

Permalink
#2201: created framework to integrate transfer strategy ivar
Browse files Browse the repository at this point in the history
  • Loading branch information
ppebay authored and lifflander committed Nov 28, 2023
1 parent 3577106 commit ed4ba0e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 30 deletions.
60 changes: 30 additions & 30 deletions src/vt/vrt/collection/balance/temperedlb/tempered_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,36 @@ enum struct InformTypeEnum : uint8_t {
AsyncInform = 1
};

/// Enum for the strategy to be used in transfer stage
enum struct TransferTypeEnum : uint8_t {
/**
* \brief Original strategy
*
* Transfer one object per transfer as in original Grapevine approach.
*/
Original = 0,
/**
* \brief Original strategy improved by recursion
*
* When single object transfer is rejected, attempt to recurse in order to
* pull more objects into the transfer and hereby minimize work added by
* said transfer.
* This is especially useful when communication is taken into account, as
* object transfers typically disrupt local vs. global communication edges.
*/
Recursive = 1,
/**
* \brief Form object clusters and attempt to perform swaps.
*
* Object can be clustered according to arbitrary definition, and swaps
* of entire clusters, according the nullset, between ranks are attempted.
* This is especially useful when shared memory constraints are present,
* as breaking shared memory clusters results in higher overall memory
* footprint, in constrast with whole cluster swaps.
*/
SwapClusters = 2,
};

/// Enum for the order in which local objects are considered for transfer
enum struct ObjectOrderEnum : uint8_t {
Arbitrary = 0, //< Arbitrary order: iterate as defined by the unordered_map
Expand Down Expand Up @@ -165,36 +195,6 @@ enum struct KnowledgeEnum : uint8_t {
Log = 2
};

/// Enum for the strategy to be used in transfer stage
enum struct TransferStrategyEnum : uint8_t {
/**
* \brief Original strategy
*
* Transfer one object per transfer as in original Grapevine approach.
*/
Original = 0,
/**
* \brief Original strategy improved by recursion
*
* When single object transfer is rejected, attempt to recurse in order to
* pull more objects into the transfer and hereby minimize work added by
* said transfer.
* This is especially useful when communication is taken into account, as
* object transfers typically disrupt local vs. global communication edges.
*/
Recursive = 1,
/**
* \brief Form object clusters and attempt to perform swaps.
*
* Object can be clustered according to arbitrary definition, and swaps
* of entire clusters, according the nullset, between ranks are attempted.
* This is especially useful when shared memory constraints are present,
* as breaking shared memory clusters results in higher overall memory
* footprint, in constrast with whole cluster swaps.
*/
ClusterSwap = 2,
};

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

#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_TEMPEREDLB_TEMPERED_ENUMS_H*/
10 changes: 10 additions & 0 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) {
);
inform_type_ = inform_type_converter_.getFromConfig(config, inform_type_);

balance::LBArgsEnumConverter<TransferTypeEnum> transfer_type_converter_(
"cmf", "TransferTypeEnum", {
{TransferTypeEnum::Original, "Original"},
{TransferTypeEnum::Recursive, "Recursive"},
{TransferTypeEnum::SwapClusters, "SwapClusters"}
}
);
transfer_type_ = transfer_type_converter_.getFromConfig(config, transfer_type_);

balance::LBArgsEnumConverter<ObjectOrderEnum> obj_ordering_converter_(
"ordering", "ObjectOrderEnum", {
{ObjectOrderEnum::Arbitrary, "Arbitrary"},
Expand Down Expand Up @@ -414,6 +423,7 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) {
knowledge_converter_.getString(knowledge_), f_, k_max_, num_iters_,
criterion_converter_.getString(criterion_), num_trials_, deterministic_,
inform_type_converter_.getString(inform_type_),
transfer_type_converter_.getString(transfer_type_),
obj_ordering_converter_.getString(obj_ordering_),
cmf_type_converter_.getString(cmf_type_), rollback_, target_pole_
);
Expand Down
7 changes: 7 additions & 0 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ struct TemperedLB : BaseLB {
LoadType target_max_load_ = 0.0;
CriterionEnum criterion_ = CriterionEnum::ModifiedGrapevine;
InformTypeEnum inform_type_ = InformTypeEnum::AsyncInform;
/**
* \brief Type of strategy to be used in transfer stage
*
* Available strategies include: Original, Recursive, and SwapClusters
* and are adapted to different kinds of problems.
*/
TransferTypeEnum transfer_type_ = TransferTypeEnum::Original;
ObjectOrderEnum obj_ordering_ = ObjectOrderEnum::FewestMigrations;
CMFTypeEnum cmf_type_ = CMFTypeEnum::NormByMax;
KnowledgeEnum knowledge_ = KnowledgeEnum::Log;
Expand Down

0 comments on commit ed4ba0e

Please sign in to comment.