@@ -67,38 +67,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
6767 std::vector<unsigned > node_to_processor_assignment;
6868 std::vector<unsigned > node_to_superstep_assignment;
6969
70- template <unsigned staleness>
71- inline bool satisfies_precedence_constraints_staleness () const {
72-
73- if (node_to_processor_assignment.size () != instance->numberOfVertices () ||
74- node_to_superstep_assignment.size () != instance->numberOfVertices ()) {
75- return false ;
76- }
77-
78- for (const auto &v : instance->vertices ()) {
79-
80- if (node_to_superstep_assignment[v] >= number_of_supersteps) {
81- return false ;
82- }
83-
84- if (node_to_processor_assignment[v] >= instance->numberOfProcessors ()) {
85- return false ;
86- }
87-
88- for (const auto &target : instance->getComputationalDag ().children (v)) {
89-
90- const unsigned different_processors =
91- (node_to_processor_assignment[v] == node_to_processor_assignment[target]) ? 0u : staleness;
92-
93- if (node_to_superstep_assignment[v] + different_processors > node_to_superstep_assignment[target]) {
94- return false ;
95- }
96- }
97- }
98-
99- return true ;
100- }
101-
10270 void compute_lazy_communication_costs_helper (std::vector<std::vector<v_commw_t <Graph_t>>> & rec, std::vector<std::vector<v_commw_t <Graph_t>>> & send) const {
10371 for (const auto &node : instance->vertices ()) {
10472
@@ -580,9 +548,36 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
580548 *
581549 * @return True if the schedule satisfies the precedence constraints of the computational DAG, false otherwise.
582550 */
583- virtual bool satisfiesPrecedenceConstraints () const {
584- return satisfies_precedence_constraints_staleness<1 >();
585- };
551+ inline bool satisfiesPrecedenceConstraints () const {
552+
553+ if (node_to_processor_assignment.size () != instance->numberOfVertices () ||
554+ node_to_superstep_assignment.size () != instance->numberOfVertices ()) {
555+ return false ;
556+ }
557+
558+ for (const auto &v : instance->vertices ()) {
559+
560+ if (node_to_superstep_assignment[v] >= number_of_supersteps) {
561+ return false ;
562+ }
563+
564+ if (node_to_processor_assignment[v] >= instance->numberOfProcessors ()) {
565+ return false ;
566+ }
567+
568+ for (const auto &target : instance->getComputationalDag ().children (v)) {
569+
570+ const unsigned different_processors =
571+ (node_to_processor_assignment[v] == node_to_processor_assignment[target]) ? 0u : getStaleness ();
572+
573+ if (node_to_superstep_assignment[v] + different_processors > node_to_superstep_assignment[target]) {
574+ return false ;
575+ }
576+ }
577+ }
578+
579+ return true ;
580+ }
586581
587582 bool satisfiesNodeTypeConstraints () const {
588583
@@ -834,6 +829,8 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
834829
835830 return num;
836831 }
832+
833+ unsigned virtual getStaleness () const { return 1 ; }
837834};
838835
839836} // namespace osp
0 commit comments