Skip to content

Commit 32eca8f

Browse files
authored
orbit statistics (#37)
adaptive symmetry auto levels update update eftsubgraphscheduler bugfix update update update update update update OrbitGraphProcessor update eft scheduler refactoring update test
1 parent 5c3a2a2 commit 32eca8f

File tree

6 files changed

+384
-224
lines changed

6 files changed

+384
-224
lines changed

include/osp/dag_divider/isomorphism_divider/EftSubgraphScheduler.hpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@ class EftSubgraphScheduler {
4949
return execute_schedule(instance);
5050
}
5151

52+
void setMinWorkPerProcessor(const v_workw_t<Graph_t> min_work_per_processor) {
53+
min_work_per_processor_ = min_work_per_processor;
54+
}
55+
5256
private:
5357

5458
static constexpr bool verbose = false;
5559

5660
using job_id_t = vertex_idx_t<Graph_t>;
5761

62+
v_workw_t<Graph_t> min_work_per_processor_ = 2000;
63+
5864
enum class JobStatus {
5965
WAITING,
6066
READY,
@@ -117,11 +123,11 @@ class EftSubgraphScheduler {
117123
} else {
118124
job.status = JobStatus::WAITING;
119125
}
120-
job.multiplicity = multiplicities[idx];
121-
job.max_num_procs = max_num_procs[idx];
126+
job.total_work = graph.vertex_work_weight(idx);
127+
job.max_num_procs = std::min(max_num_procs[idx], static_cast<unsigned>((job.total_work + min_work_per_processor_ - 1) / min_work_per_processor_));
128+
job.multiplicity = std::min(multiplicities[idx], job.max_num_procs);
122129
job.required_proc_types = required_proc_types[idx];
123130
job.assigned_workers.resize(num_worker_types, 0);
124-
job.total_work = graph.vertex_work_weight(idx);
125131
job.start_time = -1.0;
126132
job.finish_time = -1.0;
127133

@@ -328,7 +334,7 @@ class EftSubgraphScheduler {
328334
std::cout << "Final Makespan: " << current_time << std::endl;
329335
std::cout << "Job Summary:" << std::endl;
330336
for(const auto& job : jobs_) {
331-
std::cout << " - Job " << job.id << ": Multiplicity=" << job.multiplicity << ", Max Procs=" << job.max_num_procs << ", Start=" << job.start_time << ", Finish=" << job.finish_time << ", Workers=[";
337+
std::cout << " - Job " << job.id << ": Multiplicity=" << job.multiplicity << ", Max Procs=" << job.max_num_procs << ", Work=" << job.total_work << ", Start=" << job.start_time << ", Finish=" << job.finish_time << ", Workers=[";
332338
for(size_t i=0; i<job.assigned_workers.size(); ++i) {
333339
std::cout << "T" << i << ":" << job.assigned_workers[i] << (i == job.assigned_workers.size()-1 ? "" : ", ");
334340
}
@@ -342,7 +348,7 @@ class EftSubgraphScheduler {
342348
for(const auto& job : jobs_) {
343349
result.node_assigned_worker_per_type[job.id].resize(num_worker_types);
344350
for (size_t i = 0; i < num_worker_types; ++i) {
345-
result.node_assigned_worker_per_type[job.id][i] = job.assigned_workers[i] / job.multiplicity;
351+
result.node_assigned_worker_per_type[job.id][i] = (job.assigned_workers[i] + job.multiplicity - 1) / job.multiplicity;
346352
}
347353
}
348354
return result;

include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)