Skip to content

Commit

Permalink
Add Strategy Argument
Browse files Browse the repository at this point in the history
  • Loading branch information
T3C42 committed Nov 20, 2024
1 parent b72e0a6 commit 54b4f82
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
12 changes: 7 additions & 5 deletions mt-kahypar/dynamic/dynamic_partitioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ namespace mt_kahypar::dyn {

auto [changes, hypergraph] = generateChanges(context);

// first_fitting_partition_strategy(hypergraph, context, disabled_nodes);
// repartition_strategy(hypergraph, context, disabled_nodes);
// highest_connectivity_partition_strategy(hypergraph, context, disabled_nodes, start_id);
//repartition_all(hypergraph, context, changes, 0.01);
repartition_x_connectivity_partition_strategy(hypergraph, context, changes);
if (context.dynamic.strategy == "connectivity") {
repartition_x_connectivity_partition_strategy(hypergraph, context, changes);
} else if (context.dynamic.strategy == "repartition") {
repartition_strategy(hypergraph, context, changes, 0.01);
} else {
throw std::runtime_error("Unknown dynamic strategy: " + context.dynamic.strategy);
}

utils::delete_hypergraph(hypergraph);
}
Expand Down
4 changes: 2 additions & 2 deletions mt-kahypar/dynamic/strategies/dynamic_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace mt_kahypar::dyn {
return partitioned_hypergraph;
}

void repartition_all(mt_kahypar_hypergraph_t hypergraph, Context& context, const std::vector<Change>& changes, double step_size) {
void repartition_strategy(mt_kahypar_hypergraph_t hypergraph, Context& context, const std::vector<Change>& changes, double step_size) {
auto& hypergraph_s = utils::cast<ds::StaticHypergraph>(hypergraph);
size_t re_enabled_nodes = context.dynamic.initial_partitioning_size;

Expand Down Expand Up @@ -57,7 +57,7 @@ namespace mt_kahypar::dyn {
}
}

void repartition_strategy(mt_kahypar_hypergraph_t hypergraph, Context& context, const std::vector<Change>& changes) {
void repartition_old(mt_kahypar_hypergraph_t hypergraph, Context& context, const std::vector<Change>& changes) {
for ( const Change& change : changes ) {
const HypernodeID& hn = change.added_nodes[0];
auto& hypergraph_s = utils::cast<ds::StaticHypergraph>(hypergraph);
Expand Down
5 changes: 4 additions & 1 deletion mt-kahypar/io/command_line_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,10 @@ namespace mt_kahypar {
("d-result-folder",
po::value<std::string>(&context.dynamic.result_folder)->value_name("<string>"),
"Folder to store the data generated during the dynamic partitioning");

dynamic_options.add_options()
("d-strategy",
po::value<std::string>(&context.dynamic.strategy)->value_name("<string>"),
"Strategy for dynamic partitioning:\n");
return dynamic_options;
}

Expand Down
1 change: 1 addition & 0 deletions mt-kahypar/partition/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ struct DynamicParameters {
size_t initial_partitioning_size = 0;
bool use_final_weight = false;
std::string result_folder = "";
std::string strategy = "";
};

std::ostream & operator<< (std::ostream& str, const DynamicParameters& params);
Expand Down

0 comments on commit 54b4f82

Please sign in to comment.