@@ -56,7 +56,7 @@ namespace vt { namespace vrt { namespace collection {
56
56
namespace balance { namespace replay {
57
57
58
58
void replayWorkloads (
59
- PhaseType initial_phase, PhaseType phases_to_run
59
+ PhaseType initial_phase, PhaseType phases_to_run, PhaseType phase_mod
60
60
) {
61
61
// read in object loads from json files
62
62
auto const filename = theConfig ()->getLBDataFileIn ();
@@ -67,11 +67,11 @@ void replayWorkloads(
67
67
&LBManager::statsHandler
68
68
>(theLBManager ()->getProxy ());
69
69
70
- replayWorkloads (initial_phase, phases_to_run, workloads, stats_cb);
70
+ replayWorkloads (initial_phase, phases_to_run, phase_mod, workloads, stats_cb);
71
71
}
72
72
73
73
void replayWorkloads (
74
- PhaseType initial_phase, PhaseType phases_to_run,
74
+ PhaseType initial_phase, PhaseType phases_to_run, PhaseType phase_mod,
75
75
std::shared_ptr<LBDataHolder> workloads,
76
76
Callback<std::vector<balance::LoadData>> stats_cb
77
77
) {
@@ -102,6 +102,8 @@ void replayWorkloads(
102
102
// simulate the given number of phases
103
103
auto stop_phase = initial_phase + phases_to_run;
104
104
for (PhaseType phase = initial_phase; phase < stop_phase; phase++) {
105
+ PhaseType input_phase = phase_mod == 0 ? phase : phase % phase_mod;
106
+
105
107
// reapply the base load model if in case we overwrote it on a previous iter
106
108
theLBManager ()->setLoadModel (base_load_model);
107
109
@@ -113,7 +115,7 @@ void replayWorkloads(
113
115
114
116
// point the load model at the workloads for the relevant phase
115
117
runInEpochCollective (" WorkloadReplayDriver -> updateLoads" , [=] {
116
- base_load_model->updateLoads (phase );
118
+ base_load_model->updateLoads (input_phase );
117
119
});
118
120
119
121
if (theConfig ()->vt_debug_replay ) {
@@ -123,7 +125,7 @@ void replayWorkloads(
123
125
++count;
124
126
vt_debug_print (
125
127
normal , replay,
126
- " workload for element {} is here on phase {}\n " , workload_id, phase
128
+ " workload for element {} is here on input_phase {}\n " , workload_id, input_phase
127
129
);
128
130
}
129
131
}
@@ -161,7 +163,7 @@ void replayWorkloads(
161
163
}
162
164
163
165
if (this_rank == 0 ) {
164
- vt_print (replay, " Simulating phase {}...\n " , phase);
166
+ vt_print (replay, " Simulating phase {} using inputs from phase {} ...\n " , phase, input_phase );
165
167
}
166
168
167
169
if (theConfig ()->vt_debug_replay ) {
@@ -227,12 +229,19 @@ void replayWorkloads(
227
229
auto cb = theCB ()->makeFunc <ReassignmentMsg>(
228
230
vt::pipe ::LifetimeEnum::Once, postLBWork
229
231
);
230
- theLBManager ()->selectStartLB (phase, cb);
232
+ auto lb = theLBManager ()->decideLBToRun (phase, true );
233
+ auto const start_time = timing::getCurrentTime ();
234
+ theLBManager ()->startLB (input_phase, lb, cb);
235
+ auto const total_time = timing::getCurrentTime () - start_time;
236
+ if (lb != LBType::NoLB) {
237
+ vt_print (replay, " Time in load balancer: {}\n " , total_time);
238
+ }
231
239
});
232
240
runInEpochCollective (" WorkloadReplayDriver -> destroyLB" , [&] {
233
241
theLBManager ()->destroyLB ();
234
242
});
235
243
auto last_phase_info = theLBManager ()->getPhaseInfo ();
244
+ last_phase_info->phase = phase;
236
245
thePhase ()->printSummary (last_phase_info);
237
246
}
238
247
}
0 commit comments