Skip to content

Commit 093cf4d

Browse files
ILP for comm scheduling
1 parent 8b556ea commit 093cf4d

File tree

4 files changed

+444
-1
lines changed

4 files changed

+444
-1
lines changed

include/osp/bsp/model/BspSchedule.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,28 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
834834

835835
return num;
836836
}
837+
838+
virtual void shrinkSchedule() {
839+
840+
std::vector<bool> comm_phase_empty(number_of_supersteps, true);
841+
for (const auto& node : instance->vertices())
842+
for (const auto &child : instance->getComputationalDag().children(node))
843+
if(node_to_processor_assignment[node] != node_to_processor_assignment[child])
844+
comm_phase_empty[node_to_superstep_assignment[child]-1] = false;
845+
846+
std::vector<unsigned> new_step_index(number_of_supersteps);
847+
unsigned current_index = 0;
848+
for(unsigned step = 0; step < number_of_supersteps; ++step)
849+
{
850+
new_step_index[step] = current_index;
851+
if(!comm_phase_empty[step])
852+
current_index++;
853+
}
854+
for (const auto& node : instance->vertices())
855+
node_to_superstep_assignment[node] = new_step_index[node_to_superstep_assignment[node]];
856+
857+
setNumberOfSupersteps(current_index);
858+
}
837859
};
838860

839861
} // namespace osp

include/osp/bsp/model/BspScheduleCS.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,28 @@ class BspScheduleCS : public BspSchedule<Graph_t> {
472472
}
473473
}
474474
}
475+
476+
virtual void shrinkSchedule() override {
477+
478+
std::vector<bool> comm_phase_empty(this->number_of_supersteps, true);
479+
for (auto const &[key, val] : commSchedule)
480+
comm_phase_empty[val] = false;
481+
482+
std::vector<unsigned> new_step_index(this->number_of_supersteps);
483+
unsigned current_index = 0;
484+
for(unsigned step = 0; step < this->number_of_supersteps; ++step)
485+
{
486+
new_step_index[step] = current_index;
487+
if(!comm_phase_empty[step])
488+
current_index++;
489+
}
490+
for (const auto& node : this->instance->vertices())
491+
this->node_to_superstep_assignment[node] = new_step_index[this->node_to_superstep_assignment[node]];
492+
for (auto &[key, val] : commSchedule)
493+
val = new_step_index[val];
494+
495+
this->setNumberOfSupersteps(current_index);
496+
}
475497
};
476498

477499
} // namespace osp

0 commit comments

Comments
 (0)