@@ -71,6 +71,17 @@ class Serial : public Scheduler<Graph_t> {
7171 return RETURN_STATUS::ERROR;
7272 }
7373
74+ const unsigned num_node_types = dag.num_vertex_types ();
75+ std::vector<std::vector<unsigned >> node_type_compatible_processors (num_node_types);
76+
77+ for (v_type_t <Graph_t> type = 0 ; type < num_node_types; ++type) {
78+ for (const auto &p : chosen_procs) {
79+ if (instance.isCompatibleType (type, p)) {
80+ node_type_compatible_processors[type].push_back (p);
81+ }
82+ }
83+ }
84+
7485 std::vector<vertex_idx_t <Graph_t>> in_degree (num_vertices);
7586 std::deque<vertex_idx_t <Graph_t>> ready_nodes;
7687 std::deque<vertex_idx_t <Graph_t>> deferred_nodes;
@@ -93,25 +104,29 @@ class Serial : public Scheduler<Graph_t> {
93104 ready_nodes.pop_front ();
94105
95106 bool scheduled = false ;
96- for (const auto &p : chosen_procs) {
97- if (instance.isCompatible (v, p)) {
98- bool parents_compatible = true ;
99- for (const auto &parent : dag.parents (v)) {
100- if (schedule.assignedSuperstep (parent) == current_superstep &&
101- schedule.assignedProcessor (parent) != p) {
102- parents_compatible = false ;
103- break ;
104- }
105- }
106107
107- if (parents_compatible) {
108- schedule.setAssignedProcessor (v, p);
109- schedule.setAssignedSuperstep (v, current_superstep);
110- scheduled = true ;
111- ++scheduled_nodes_count;
112- break ;
108+ unsigned v_type = 0 ;
109+ if constexpr (has_typed_vertices_v<Graph_t>) {
110+ v_type = dag.vertex_type (v);
111+ }
112+
113+ for (const auto &p : node_type_compatible_processors[v_type]) {
114+ bool parents_compatible = true ;
115+ for (const auto &parent : dag.parents (v)) {
116+ if (schedule.assignedSuperstep (parent) == current_superstep &&
117+ schedule.assignedProcessor (parent) != p) {
118+ parents_compatible = false ;
119+ break ;
113120 }
114121 }
122+
123+ if (parents_compatible) {
124+ schedule.setAssignedProcessor (v, p);
125+ schedule.setAssignedSuperstep (v, current_superstep);
126+ scheduled = true ;
127+ ++scheduled_nodes_count;
128+ break ;
129+ }
115130 }
116131
117132 if (not scheduled) {
0 commit comments