@@ -105,9 +105,7 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
105105 : instance(&schedule.getInstance()), number_of_supersteps(schedule.numberOfSupersteps()),
106106 node_to_processor_assignment(schedule.getInstance().numberOfVertices()),
107107 node_to_superstep_assignment(schedule.getInstance().numberOfVertices()) {
108-
109108 for (const auto &v : schedule.getInstance ().getComputationalDag ().vertices ()) {
110-
111109 node_to_processor_assignment[v] = schedule.assignedProcessor (v);
112110 node_to_superstep_assignment[v] = schedule.assignedSuperstep (v);
113111 }
@@ -572,11 +570,14 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
572570 */
573571 virtual void shrinkByMergingSupersteps () {
574572 std::vector<bool > comm_phase_empty (number_of_supersteps, true );
575- for (const auto &node : instance->vertices ())
576- for (const auto &child : instance->getComputationalDag ().children (node))
577- if (node_to_processor_assignment[node] != node_to_processor_assignment[child])
573+ for (const auto &node : instance->vertices ()) {
574+ for (const auto &child : instance->getComputationalDag ().children (node)) {
575+ if (node_to_processor_assignment[node] != node_to_processor_assignment[child]) {
578576 for (unsigned offset = 1 ; offset <= getStaleness (); ++offset)
579577 comm_phase_empty[node_to_superstep_assignment[child] - offset] = false ;
578+ }
579+ }
580+ }
580581
581582 std::vector<unsigned > new_step_index (number_of_supersteps);
582583 unsigned current_index = 0 ;
@@ -585,9 +586,9 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
585586 if (!comm_phase_empty[step])
586587 current_index++;
587588 }
588- for (const auto &node : instance->vertices ())
589+ for (const auto &node : instance->vertices ()) {
589590 node_to_superstep_assignment[node] = new_step_index[node_to_superstep_assignment[node]];
590-
591+ }
591592 setNumberOfSupersteps (current_index);
592593 }
593594
@@ -633,7 +634,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
633634 std::vector<v_memw_t <Graph_t>> current_proc_transient_memory (instance->numberOfProcessors (), 0 );
634635
635636 for (const auto &node : instance->vertices ()) {
636-
637637 const unsigned proc = node_to_processor_assignment[node];
638638 current_proc_persistent_memory[proc] += instance->getComputationalDag ().vertex_mem_weight (node);
639639 current_proc_transient_memory[proc] = std::max (
@@ -659,7 +659,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
659659 std::vector<v_memw_t <Graph_t>> current_proc_memory (instance->numberOfProcessors (), 0 );
660660
661661 for (const auto &node : instance->vertices ()) {
662-
663662 const unsigned proc = node_to_processor_assignment[node];
664663 current_proc_memory[proc] += instance->getComputationalDag ().vertex_mem_weight (node);
665664
@@ -671,12 +670,10 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
671670 }
672671
673672 bool satisfiesLocalInOutMemoryConstraints () const {
674-
675673 SetSchedule set_schedule = SetSchedule (*this );
676674
677675 for (unsigned step = 0 ; step < number_of_supersteps; step++) {
678676 for (unsigned proc = 0 ; proc < instance->numberOfProcessors (); proc++) {
679-
680677 v_memw_t <Graph_t> memory = 0 ;
681678 for (const auto &node : set_schedule.step_processor_vertices [step][proc]) {
682679 memory += instance->getComputationalDag ().vertex_mem_weight (node) +
@@ -701,20 +698,17 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
701698 }
702699
703700 bool satisfiesLocalIncEdgesMemoryConstraints () const {
704-
705701 SetSchedule set_schedule = SetSchedule (*this );
706702
707703 for (unsigned step = 0 ; step < number_of_supersteps; step++) {
708704 for (unsigned proc = 0 ; proc < instance->numberOfProcessors (); proc++) {
709-
710705 std::unordered_set<vertex_idx_t <Graph_t>> nodes_with_incoming_edges;
711706
712707 v_memw_t <Graph_t> memory = 0 ;
713708 for (const auto &node : set_schedule.step_processor_vertices [step][proc]) {
714709 memory += instance->getComputationalDag ().vertex_comm_weight (node);
715710
716711 for (const auto &parent : instance->getComputationalDag ().parents (node)) {
717-
718712 if (node_to_superstep_assignment[parent] != step) {
719713 nodes_with_incoming_edges.insert (parent);
720714 }
@@ -734,17 +728,14 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
734728 }
735729
736730 bool satisfiesLocalSourcesIncEdgesMemoryConstraints () const {
737-
738731 SetSchedule set_schedule = SetSchedule (*this );
739732
740733 for (unsigned step = 0 ; step < number_of_supersteps; step++) {
741734 for (unsigned proc = 0 ; proc < instance->numberOfProcessors (); proc++) {
742-
743735 std::unordered_set<vertex_idx_t <Graph_t>> nodes_with_incoming_edges;
744736
745737 v_memw_t <Graph_t> memory = 0 ;
746738 for (const auto &node : set_schedule.step_processor_vertices [step][proc]) {
747-
748739 if (is_source (node, instance->getComputationalDag ())) {
749740 memory += instance->getComputationalDag ().vertex_mem_weight (node);
750741 }
0 commit comments