@@ -73,6 +73,7 @@ class IsomorphicSubgraphScheduler {
7373 double orbit_lock_ratio_ = 0.2 ;
7474 bool merge_different_node_types = true ;
7575 bool allow_use_trimmed_scheduler = true ;
76+ bool use_max_bsp = false ;
7677
7778 public:
7879
@@ -93,6 +94,7 @@ class IsomorphicSubgraphScheduler {
9394 void setMinSymmetry (size_t min_symmetry) { min_symmetry_ = min_symmetry; }
9495 void set_plot_dot_graphs (bool plot) { plot_dot_graphs_ = plot; }
9596 void disable_use_max_group_size () { use_max_group_size_ = false ; }
97+ void setUseMaxBsp (bool flag) { use_max_bsp = flag; }
9698 void enable_use_max_group_size (const unsigned max_group_size) {
9799 use_max_group_size_ = true ;
98100 max_group_size_ = max_group_size;
@@ -381,8 +383,7 @@ class IsomorphicSubgraphScheduler {
381383 }
382384 }
383385
384- // If min_non_zero_procs is still std::numeric_limits<unsigned>::max(), it means no processors
385- // were assigned to any type (all counts were 0). In this case, min_non_zero_procs > 1 will be false.
386+
386387 bool use_trimmed_scheduler = sub_sched.was_trimmed [group_idx] && min_non_zero_procs > 1 && allow_use_trimmed_scheduler;
387388
388389 Scheduler<Constr_Graph_t>* scheduler_for_group_ptr;
@@ -474,12 +475,20 @@ class IsomorphicSubgraphScheduler {
474475 writer.write_colored_graph (timestamp + " iso_group_rep_" + std::to_string (group_idx) + " .dot" , rep_dag, colors);
475476 }
476477
478+
479+ const bool max_bsp = use_max_bsp && (representative_instance.getComputationalDag ().num_edges () == 0 ) && (representative_instance.getComputationalDag ().vertex_type (0 ) == 0 );
480+
477481 // Build data structures for applying the pattern ---
478482 // Map (superstep, processor) -> relative partition ID
479483 std::map<std::pair<unsigned , unsigned >, vertex_idx_t <Graph_t>> sp_proc_to_relative_partition;
480484 vertex_idx_t <Graph_t> num_partitions_per_subgraph = 0 ;
481485 for (vertex_idx_t <Graph_t> j = 0 ; j < static_cast <vertex_idx_t <Graph_t>>(rep_subgraph_vertices_sorted.size ()); ++j) {
482- const auto sp_pair = std::make_pair (bsp_schedule.assignedSuperstep (j), bsp_schedule.assignedProcessor (j));
486+ auto sp_pair = std::make_pair (bsp_schedule.assignedSuperstep (j), bsp_schedule.assignedProcessor (j));
487+
488+ if (max_bsp)
489+ sp_pair = std::make_pair (j, 0 );
490+
491+
483492 if (sp_proc_to_relative_partition.find (sp_pair) == sp_proc_to_relative_partition.end ()) {
484493 sp_proc_to_relative_partition[sp_pair] = num_partitions_per_subgraph++;
485494 }
@@ -516,7 +525,11 @@ class IsomorphicSubgraphScheduler {
516525 // Apply the partition pattern
517526 for (const auto & current_vertex : current_subgraph_vertices_sorted) {
518527 const auto rep_local_idx = current_vertex_to_rep_local_idx.at (current_vertex);
519- const auto sp_pair = std::make_pair (bsp_schedule.assignedSuperstep (rep_local_idx), bsp_schedule.assignedProcessor (rep_local_idx));
528+ auto sp_pair = std::make_pair (bsp_schedule.assignedSuperstep (rep_local_idx), bsp_schedule.assignedProcessor (rep_local_idx));
529+
530+ if (max_bsp)
531+ sp_pair = std::make_pair (rep_local_idx, 0 );
532+
520533 partition[current_vertex] = current_partition_idx + sp_proc_to_relative_partition.at (sp_pair);
521534 }
522535 current_partition_idx += num_partitions_per_subgraph;
0 commit comments