Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ class EftSubgraphScheduler {
return execute_schedule(instance);
}

void setMinWorkPerProcessor(const v_workw_t<Graph_t> min_work_per_processor) {
min_work_per_processor_ = min_work_per_processor;
}

private:

static constexpr bool verbose = false;

using job_id_t = vertex_idx_t<Graph_t>;

v_workw_t<Graph_t> min_work_per_processor_ = 2000;

enum class JobStatus {
WAITING,
READY,
Expand Down Expand Up @@ -117,11 +123,11 @@ class EftSubgraphScheduler {
} else {
job.status = JobStatus::WAITING;
}
job.multiplicity = multiplicities[idx];
job.max_num_procs = max_num_procs[idx];
job.total_work = graph.vertex_work_weight(idx);
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_));
job.multiplicity = std::min(multiplicities[idx], job.max_num_procs);
job.required_proc_types = required_proc_types[idx];
job.assigned_workers.resize(num_worker_types, 0);
job.total_work = graph.vertex_work_weight(idx);
job.start_time = -1.0;
job.finish_time = -1.0;

Expand Down Expand Up @@ -328,7 +334,7 @@ class EftSubgraphScheduler {
std::cout << "Final Makespan: " << current_time << std::endl;
std::cout << "Job Summary:" << std::endl;
for(const auto& job : jobs_) {
std::cout << " - Job " << job.id << ": Multiplicity=" << job.multiplicity << ", Max Procs=" << job.max_num_procs << ", Start=" << job.start_time << ", Finish=" << job.finish_time << ", Workers=[";
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=[";
for(size_t i=0; i<job.assigned_workers.size(); ++i) {
std::cout << "T" << i << ":" << job.assigned_workers[i] << (i == job.assigned_workers.size()-1 ? "" : ", ");
}
Expand All @@ -342,7 +348,7 @@ class EftSubgraphScheduler {
for(const auto& job : jobs_) {
result.node_assigned_worker_per_type[job.id].resize(num_worker_types);
for (size_t i = 0; i < num_worker_types; ++i) {
result.node_assigned_worker_per_type[job.id][i] = job.assigned_workers[i] / job.multiplicity;
result.node_assigned_worker_per_type[job.id][i] = (job.assigned_workers[i] + job.multiplicity - 1) / job.multiplicity;
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class IsomorphicSubgraphScheduler {
double orbit_lock_ratio_ = 0.2;
bool merge_different_node_types = true;
bool allow_use_trimmed_scheduler = true;
bool use_max_bsp = false;

public:

Expand All @@ -93,6 +94,7 @@ class IsomorphicSubgraphScheduler {
void setMinSymmetry(size_t min_symmetry) { min_symmetry_ = min_symmetry; }
void set_plot_dot_graphs(bool plot) { plot_dot_graphs_ = plot; }
void disable_use_max_group_size() { use_max_group_size_ = false; }
void setUseMaxBsp(bool flag) { use_max_bsp = flag; }
void enable_use_max_group_size(const unsigned max_group_size) {
use_max_group_size_ = true;
max_group_size_ = max_group_size;
Expand Down Expand Up @@ -381,8 +383,7 @@ class IsomorphicSubgraphScheduler {
}
}

// If min_non_zero_procs is still std::numeric_limits<unsigned>::max(), it means no processors
// were assigned to any type (all counts were 0). In this case, min_non_zero_procs > 1 will be false.

bool use_trimmed_scheduler = sub_sched.was_trimmed[group_idx] && min_non_zero_procs > 1 && allow_use_trimmed_scheduler;

Scheduler<Constr_Graph_t>* scheduler_for_group_ptr;
Expand Down Expand Up @@ -474,12 +475,20 @@ class IsomorphicSubgraphScheduler {
writer.write_colored_graph(timestamp + "iso_group_rep_" + std::to_string(group_idx) + ".dot", rep_dag, colors);
}


const bool max_bsp = use_max_bsp && (representative_instance.getComputationalDag().num_edges() == 0) && (representative_instance.getComputationalDag().vertex_type(0) == 0);

// Build data structures for applying the pattern ---
// Map (superstep, processor) -> relative partition ID
std::map<std::pair<unsigned, unsigned>, vertex_idx_t<Graph_t>> sp_proc_to_relative_partition;
vertex_idx_t<Graph_t> num_partitions_per_subgraph = 0;
for (vertex_idx_t<Graph_t> j = 0; j < static_cast<vertex_idx_t<Graph_t>>(rep_subgraph_vertices_sorted.size()); ++j) {
const auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(j), bsp_schedule.assignedProcessor(j));
auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(j), bsp_schedule.assignedProcessor(j));

if (max_bsp)
sp_pair = std::make_pair(j, 0);


if (sp_proc_to_relative_partition.find(sp_pair) == sp_proc_to_relative_partition.end()) {
sp_proc_to_relative_partition[sp_pair] = num_partitions_per_subgraph++;
}
Expand Down Expand Up @@ -516,7 +525,11 @@ class IsomorphicSubgraphScheduler {
// Apply the partition pattern
for (const auto& current_vertex : current_subgraph_vertices_sorted) {
const auto rep_local_idx = current_vertex_to_rep_local_idx.at(current_vertex);
const auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(rep_local_idx), bsp_schedule.assignedProcessor(rep_local_idx));
auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(rep_local_idx), bsp_schedule.assignedProcessor(rep_local_idx));

if (max_bsp)
sp_pair = std::make_pair(rep_local_idx, 0);

partition[current_vertex] = current_partition_idx + sp_proc_to_relative_partition.at(sp_pair);
}
current_partition_idx += num_partitions_per_subgraph;
Expand Down
Loading