Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/osp/bsp/model/BspSchedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,8 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
for (const auto& node : instance->vertices())
for (const auto &child : instance->getComputationalDag().children(node))
if(node_to_processor_assignment[node] != node_to_processor_assignment[child])
comm_phase_empty[node_to_superstep_assignment[child]-1] = false;
for(unsigned offset = 1; offset <= getStaleness(); ++offset)
comm_phase_empty[node_to_superstep_assignment[child] - offset] = false;

std::vector<unsigned> new_step_index(number_of_supersteps);
unsigned current_index = 0;
Expand Down
14 changes: 7 additions & 7 deletions include/osp/bsp/model/BspScheduleCS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,29 +470,29 @@ class BspScheduleCS : public BspSchedule<Graph_t> {

virtual void shrinkByMergingSupersteps() override {

std::vector<unsigned> comm_phase_latest_dependency(this->number_of_supersteps, 0);
std::vector<unsigned> superstep_latest_dependency(this->number_of_supersteps, 0);
std::vector<std::vector<unsigned> > first_at = getFirstPresence();

for (auto const &[key, val] : commSchedule)
if(this->assignedProcessor(std::get<0>(key)) != std::get<1>(key))
comm_phase_latest_dependency[val] = std::max(comm_phase_latest_dependency[val], first_at[std::get<0>(key)][std::get<1>(key)]);
superstep_latest_dependency[val] = std::max(superstep_latest_dependency[val], first_at[std::get<0>(key)][std::get<1>(key)]);


for (const auto &node : BspSchedule<Graph_t>::instance->getComputationalDag().vertices())
for (const auto &child : BspSchedule<Graph_t>::instance->getComputationalDag().children(node))
if(this->assignedProcessor(node) != this->assignedProcessor(child))
comm_phase_latest_dependency[this->assignedSuperstep(child)] = std::max(comm_phase_latest_dependency[this->assignedSuperstep(child)], first_at[node][this->assignedProcessor(child)]);
superstep_latest_dependency[this->assignedSuperstep(child)] = std::max(superstep_latest_dependency[this->assignedSuperstep(child)], first_at[node][this->assignedProcessor(child)]);

std::vector<bool> comm_phase_deleted(this->number_of_supersteps, false);
std::vector<bool> merge_with_previous(this->number_of_supersteps, false);
for(unsigned step = this->number_of_supersteps-1; step < this->number_of_supersteps; --step)
{
unsigned limit = 0;
while(step > limit)
{
limit = std::max(limit, comm_phase_latest_dependency[step]);
limit = std::max(limit, superstep_latest_dependency[step]);
if(step > limit)
{
comm_phase_deleted[step] = true;
merge_with_previous[step] = true;
--step;
}
}
Expand All @@ -502,7 +502,7 @@ class BspScheduleCS : public BspSchedule<Graph_t> {
unsigned current_index = std::numeric_limits<unsigned>::max();
for(unsigned step = 0; step < this->number_of_supersteps; ++step)
{
if(!comm_phase_deleted[step])
if(!merge_with_previous[step])
current_index++;

new_step_index[step] = current_index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ class HillClimbingScheduler : public ImprovementScheduler<Graph_t> {
// Create superstep lists (for convenience) for a BSP schedule
void CreateSupstepLists();

// Combine subsequent supersteps whenever there is no communication inbetween
void RemoveNeedlessSupSteps();

// For memory constraints
bool use_memory_constraint = false;
std::vector<std::vector<v_memw_t<Graph_t>>> memory_used;
Expand Down Expand Up @@ -178,9 +175,9 @@ RETURN_STATUS HillClimbingScheduler<Graph_t>::improveScheduleWithStepLimit(BspSc

template<typename Graph_t>
void HillClimbingScheduler<Graph_t>::Init() {
if(shrink) // NOTE: shrinking a MaxBspSchedule (without CS) might increase cost
if(shrink)
{
RemoveNeedlessSupSteps();
schedule->shrinkByMergingSupersteps();
CreateSupstepLists();
}

Expand Down Expand Up @@ -971,37 +968,6 @@ bool HillClimbingScheduler<Graph_t>::violatesMemConstraint(vertex_idx node, unsi
return false;
}

template<typename Graph_t>
void HillClimbingScheduler<Graph_t>::RemoveNeedlessSupSteps() {

unsigned current_step = 0;

unsigned nextBreak = schedule->numberOfSupersteps(), breakAfterNext = schedule->numberOfSupersteps();
for (unsigned step = 0; step < schedule->numberOfSupersteps(); ++step) {
if (nextBreak == step) {
++current_step;
nextBreak = breakAfterNext;
if (schedule->getStaleness() == 2)
breakAfterNext = schedule->numberOfSupersteps();
}
for (unsigned proc = 0; proc < schedule->getInstance().getArchitecture().numberOfProcessors(); ++proc)
for (const vertex_idx node : supsteplists[step][proc]) {
schedule->setAssignedSuperstep(node, current_step);
for (const vertex_idx &succ : schedule->getInstance().getComputationalDag().children(node))
{
if (schedule->assignedProcessor(node) != schedule->assignedProcessor(succ))
{
nextBreak = std::min(nextBreak, schedule->assignedSuperstep(succ) + 1 - schedule->getStaleness());
if (schedule->getStaleness() == 2)
breakAfterNext = std::min(breakAfterNext, schedule->assignedSuperstep(succ));
}
}
}
}

schedule->updateNumberOfSupersteps();
}

template<typename Graph_t>
void HillClimbingScheduler<Graph_t>::CreateSupstepLists() {

Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ _add_test( wavefront_scheduler )

_add_test( cuthill_mckee )

_add_test( maxbsp_schedulers )
_add_test( maxbsp_converter_and_hc )

## pebbling ILPs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ BOOST_AUTO_TEST_CASE(maxbsp_scheduling) {
// hill climbing

HillClimbingScheduler<graph> HC;
HC.setShrink(false);
HC.improveSchedule(maxbsp);
BOOST_CHECK(maxbsp.satisfiesPrecedenceConstraints());
auto cost_hc = maxbsp.computeCosts();
Expand Down