Skip to content

Commit 8f29250

Browse files
committed
#2201: created framework to integrate transfer strategy ivar
1 parent b716b06 commit 8f29250

File tree

3 files changed

+47
-30
lines changed

3 files changed

+47
-30
lines changed

src/vt/vrt/collection/balance/temperedlb/tempered_enums.h

+30-30
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,36 @@ enum struct InformTypeEnum : uint8_t {
7171
AsyncInform = 1
7272
};
7373

74+
/// Enum for the strategy to be used in transfer stage
75+
enum struct TransferTypeEnum : uint8_t {
76+
/**
77+
* \brief Original strategy
78+
*
79+
* Transfer one object per transfer as in original Grapevine approach.
80+
*/
81+
Original = 0,
82+
/**
83+
* \brief Original strategy improved by recursion
84+
*
85+
* When single object transfer is rejected, attempt to recurse in order to
86+
* pull more objects into the transfer and hereby minimize work added by
87+
* said transfer.
88+
* This is especially useful when communication is taken into account, as
89+
* object transfers typically disrupt local vs. global communication edges.
90+
*/
91+
Recursive = 1,
92+
/**
93+
* \brief Form object clusters and attempt to perform swaps.
94+
*
95+
* Object can be clustered according to arbitrary definition, and swaps
96+
* of entire clusters, according the nullset, between ranks are attempted.
97+
* This is especially useful when shared memory constraints are present,
98+
* as breaking shared memory clusters results in higher overall memory
99+
* footprint, in constrast with whole cluster swaps.
100+
*/
101+
SwapClusters = 2,
102+
};
103+
74104
/// Enum for the order in which local objects are considered for transfer
75105
enum struct ObjectOrderEnum : uint8_t {
76106
Arbitrary = 0, //< Arbitrary order: iterate as defined by the unordered_map
@@ -165,36 +195,6 @@ enum struct KnowledgeEnum : uint8_t {
165195
Log = 2
166196
};
167197

168-
/// Enum for the strategy to be used in transfer stage
169-
enum struct TransferStrategyEnum : uint8_t {
170-
/**
171-
* \brief Original strategy
172-
*
173-
* Transfer one object per transfer as in original Grapevine approach.
174-
*/
175-
Original = 0,
176-
/**
177-
* \brief Original strategy improved by recursion
178-
*
179-
* When single object transfer is rejected, attempt to recurse in order to
180-
* pull more objects into the transfer and hereby minimize work added by
181-
* said transfer.
182-
* This is especially useful when communication is taken into account, as
183-
* object transfers typically disrupt local vs. global communication edges.
184-
*/
185-
Recursive = 1,
186-
/**
187-
* \brief Form object clusters and attempt to perform swaps.
188-
*
189-
* Object can be clustered according to arbitrary definition, and swaps
190-
* of entire clusters, according the nullset, between ranks are attempted.
191-
* This is especially useful when shared memory constraints are present,
192-
* as breaking shared memory clusters results in higher overall memory
193-
* footprint, in constrast with whole cluster swaps.
194-
*/
195-
ClusterSwap = 2,
196-
};
197-
198198
}}}} /* end namespace vt::vrt::collection::lb */
199199

200200
#endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_TEMPEREDLB_TEMPERED_ENUMS_H*/

src/vt/vrt/collection/balance/temperedlb/temperedlb.cc

+10
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) {
373373
);
374374
inform_type_ = inform_type_converter_.getFromConfig(config, inform_type_);
375375

376+
balance::LBArgsEnumConverter<TransferTypeEnum> transfer_type_converter_(
377+
"cmf", "TransferTypeEnum", {
378+
{TransferTypeEnum::Original, "Original"},
379+
{TransferTypeEnum::Recursive, "Recursive"},
380+
{TransferTypeEnum::SwapClusters, "SwapClusters"}
381+
}
382+
);
383+
transfer_type_ = transfer_type_converter_.getFromConfig(config, transfer_type_);
384+
376385
balance::LBArgsEnumConverter<ObjectOrderEnum> obj_ordering_converter_(
377386
"ordering", "ObjectOrderEnum", {
378387
{ObjectOrderEnum::Arbitrary, "Arbitrary"},
@@ -414,6 +423,7 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) {
414423
knowledge_converter_.getString(knowledge_), f_, k_max_, num_iters_,
415424
criterion_converter_.getString(criterion_), num_trials_, deterministic_,
416425
inform_type_converter_.getString(inform_type_),
426+
transfer_type_converter_.getString(transfer_type_),
417427
obj_ordering_converter_.getString(obj_ordering_),
418428
cmf_type_converter_.getString(cmf_type_), rollback_, target_pole_
419429
);

src/vt/vrt/collection/balance/temperedlb/temperedlb.h

+7
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ struct TemperedLB : BaseLB {
172172
LoadType target_max_load_ = 0.0;
173173
CriterionEnum criterion_ = CriterionEnum::ModifiedGrapevine;
174174
InformTypeEnum inform_type_ = InformTypeEnum::AsyncInform;
175+
/**
176+
* \brief Type of strategy to be used in transfer stage
177+
*
178+
* Available strategies include: Original, Recursive, and SwapClusters
179+
* and are adapted to different kinds of problems.
180+
*/
181+
TransferTypeEnum transfer_type_ = TransferTypeEnum::Original;
175182
ObjectOrderEnum obj_ordering_ = ObjectOrderEnum::FewestMigrations;
176183
CMFTypeEnum cmf_type_ = CMFTypeEnum::NormByMax;
177184
KnowledgeEnum knowledge_ = KnowledgeEnum::Log;

0 commit comments

Comments
 (0)