Skip to content

Commit

Permalink
[dKaMinPar] Cleanup old / unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSeemaier committed Jan 24, 2024
1 parent 0672798 commit 3bb37d8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 1,301 deletions.
57 changes: 0 additions & 57 deletions kaminpar-cli/dkaminpar_arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ CLI::Option_group *create_refinement_options(CLI::App *app, Context &ctx) {
)
->capture_default_str();

create_fm_refinement_options(app, ctx);
create_lp_refinement_options(app, ctx);
create_colored_lp_refinement_options(app, ctx);
create_jet_refinement_options(app, ctx);
Expand All @@ -153,62 +152,6 @@ CLI::Option_group *create_refinement_options(CLI::App *app, Context &ctx) {
return refinement;
}

CLI::Option_group *create_fm_refinement_options(CLI::App *app, Context &ctx) {
auto *fm = app->add_option_group("Refinement -> FM");

fm->add_option(
"--r-fm-alpha", ctx.refinement.fm.alpha, "Alpha parameter for the adaptive stopping rule."
)
->capture_default_str();

fm->add_flag("--r-fm-independent-seeds", ctx.refinement.fm.use_independent_seeds)
->capture_default_str();
fm->add_flag("--r-fm-bfs-seeds-as-fm-seeds", ctx.refinement.fm.use_bfs_seeds_as_fm_seeds)
->capture_default_str();

fm->add_option("--r-fm-max-hops", ctx.refinement.fm.max_hops)->capture_default_str();
fm->add_option("--r-fm-max-radius", ctx.refinement.fm.max_radius)->capture_default_str();
fm->add_option("--r-fm-num-global-iterations", ctx.refinement.fm.num_global_iterations)
->capture_default_str();
fm->add_option("--r-fm-num-local-iterations", ctx.refinement.fm.num_local_iterations)
->capture_default_str();
fm->add_flag(
"--r-fm-revert-local-moves-after-batch", ctx.refinement.fm.revert_local_moves_after_batch
)
->capture_default_str();
fm->add_flag(
"--r-fm-rebalance-after-each-global-iteration",
ctx.refinement.fm.rebalance_after_each_global_iteration
)
->capture_default_str();
fm->add_flag("--r-fm-rebalance-after-refinement", ctx.refinement.fm.rebalance_after_refinement)
->capture_default_str();
fm->add_option("--r-fm-balancing-algorithm", ctx.refinement.fm.balancing_algorithm)
->transform(CLI::CheckedTransformer(get_balancing_algorithms()).description(""))
->description(
std::string("Balancing algorithm(s). Possible options are:\n") +
get_balancing_algorithms_description()
)
->capture_default_str();
fm->add_flag("--r-fm-rollback", ctx.refinement.fm.rollback_deterioration)->capture_default_str();

fm->add_flag("--r-fm-use-abortion-threshold", ctx.refinement.fm.use_abortion_threshold)
->capture_default_str();
fm->add_option("--r-fm-abortion-threshold", ctx.refinement.fm.abortion_threshold)
->capture_default_str();

fm->add_flag(
"--r-fm-chunk-local-rounds",
ctx.refinement.fm.chunk_local_rounds,
"If enabled, divide local rounds into chunks and synchronize the partition state after "
"each chunk."
)
->capture_default_str();
create_chunks_options(fm, "--r-fm", ctx.refinement.fm.chunks);

return fm;
}

CLI::Option_group *create_lp_refinement_options(CLI::App *app, Context &ctx) {
auto *lp = app->add_option_group("Refinement -> Chunked Label Propagation");

Expand Down
2 changes: 0 additions & 2 deletions kaminpar-cli/dkaminpar_arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ CLI::Option_group *create_initial_partitioning_options(CLI::App *app, Context &c

CLI::Option_group *create_refinement_options(CLI::App *app, Context &ctx);

CLI::Option_group *create_fm_refinement_options(CLI::App *app, Context &ctx);

CLI::Option_group *create_lp_refinement_options(CLI::App *app, Context &ctx);

CLI::Option_group *create_colored_lp_refinement_options(CLI::App *app, Context &ctx);
Expand Down
54 changes: 6 additions & 48 deletions kaminpar-dist/context_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ std::unordered_map<std::string, RefinementAlgorithm> get_kway_refinement_algorit
{"noop", RefinementAlgorithm::NOOP},
{"lp/batches", RefinementAlgorithm::BATCHED_LP},
{"lp/colors", RefinementAlgorithm::COLORED_LP},
{"fm/global", RefinementAlgorithm::GLOBAL_FM},
{"greedy-balancer/nodes", RefinementAlgorithm::GREEDY_NODE_BALANCER},
{"greedy-balancer/clusters", RefinementAlgorithm::GREEDY_CLUSTER_BALANCER},
{"jet/refiner", RefinementAlgorithm::JET_REFINER},
{"jet/balancer", RefinementAlgorithm::JET_BALANCER},
{"jet", RefinementAlgorithm::JET_REFINER},
{"mtkahypar", RefinementAlgorithm::MTKAHYPAR},
};
}
Expand All @@ -135,7 +133,6 @@ std::unordered_map<std::string, RefinementAlgorithm> get_balancing_algorithms()
{"noop", RefinementAlgorithm::NOOP},
{"greedy-balancer/nodes", RefinementAlgorithm::GREEDY_NODE_BALANCER},
{"greedy-balancer/clusters", RefinementAlgorithm::GREEDY_CLUSTER_BALANCER},
{"jet/balancer", RefinementAlgorithm::JET_BALANCER},
{"mtkahypar", RefinementAlgorithm::MTKAHYPAR},
};
};
Expand All @@ -148,16 +145,12 @@ std::ostream &operator<<(std::ostream &out, const RefinementAlgorithm algorithm)
return out << "lp/batches";
case RefinementAlgorithm::COLORED_LP:
return out << "lp/colors";
case RefinementAlgorithm::GLOBAL_FM:
return out << "fm/global";
case RefinementAlgorithm::GREEDY_NODE_BALANCER:
return out << "greedy-balancer/nodes";
case RefinementAlgorithm::GREEDY_CLUSTER_BALANCER:
return out << "greedy-balancer/clusters";
case RefinementAlgorithm::JET_REFINER:
return out << "jet/refiner";
case RefinementAlgorithm::JET_BALANCER:
return out << "jet/balancer";
case RefinementAlgorithm::MTKAHYPAR:
return out << "mtkahypar";
}
Expand All @@ -170,18 +163,15 @@ std::string get_refinement_algorithms_description() {
- noop: do nothing
- lp/batches: LP where batches are nodes with subsequent IDs
- lp/colors: LP where batches are color classes
- fm/local: local FM
- fm/global: global FM
- jet/refiner: reimplementation of JET's refinement algorithm)")
.substr(1) +
"\n" + get_balancing_algorithms_description();
}

std::string get_balancing_algorithms_description() {
return std::string(R"(
- jet/balancer: reimplementation of JET's balancing algorithm
- greedy-balancer/singletons: greedy, move individual nodes
- greedy-balancer/movesets: greedy, move sets of nodes)")
- greedy-balancer/nodes: greedy, move individual nodes
- greedy-balancer/clusters: greedy, move sets of nodes)")
.substr(1);
}

Expand Down Expand Up @@ -316,7 +306,7 @@ void print(const PartitionContext &ctx, const bool root, std::ostream &out, MPI_
});
const auto width = std::ceil(std::log10(size)) + 1;

const GlobalNodeID num_global_total_nodes =
const auto num_global_total_nodes =
mpi::allreduce<GlobalNodeID>(ctx.graph->total_n, MPI_SUM, comm);

if (root) {
Expand Down Expand Up @@ -478,30 +468,9 @@ void print(const RefinementContext &ctx, const ParallelContext &parallel, std::o
<< ", final " << ctx.jet.final_negative_gain_factor << "\n";
out << " Balancing algorithm: " << ctx.jet.balancing_algorithm << "\n";
}
if (ctx.includes_algorithm(RefinementAlgorithm::GLOBAL_FM)) {
out << "Global FM refinement: " << RefinementAlgorithm::GLOBAL_FM << "\n";
out << " Number of iterations: " << ctx.fm.num_global_iterations << " x "
<< ctx.fm.num_local_iterations << "\n";
if (ctx.fm.chunk_local_rounds) {
print(ctx.fm.chunks, parallel, out);
}
out << " Search radius: " << ctx.fm.max_radius << " via " << ctx.fm.max_hops
<< " hop(s)\n";
out << " Revert batch-local moves: "
<< (ctx.fm.revert_local_moves_after_batch ? "yes" : "no") << "\n";
out << " Rollback to best partition: " << (ctx.fm.rollback_deterioration ? "yes" : "no")
<< "\n";
out << " Rebalance algorithm: " << ctx.fm.balancing_algorithm << "\n";
out << " Rebalance after iter.: "
<< (ctx.fm.rebalance_after_each_global_iteration ? "yes" : "no") << "\n";
out << " Rebalance after ref.: " << (ctx.fm.rebalance_after_refinement ? "yes" : "no")
<< "\n";
}
if (ctx.includes_algorithm(RefinementAlgorithm::GREEDY_NODE_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::JET_REFINER) &&
ctx.jet.balancing_algorithm == RefinementAlgorithm::GREEDY_NODE_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::GLOBAL_FM) &&
ctx.fm.balancing_algorithm == RefinementAlgorithm::GREEDY_NODE_BALANCER)) {
ctx.jet.balancing_algorithm == RefinementAlgorithm::GREEDY_NODE_BALANCER)) {
out << "Node balancer: " << RefinementAlgorithm::GREEDY_NODE_BALANCER << "\n";
out << " Number of rounds: " << ctx.node_balancer.max_num_rounds << "\n";
out << " Sequential balancing: "
Expand All @@ -526,9 +495,7 @@ void print(const RefinementContext &ctx, const ParallelContext &parallel, std::o
}
if (ctx.includes_algorithm(RefinementAlgorithm::GREEDY_CLUSTER_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::JET_REFINER) &&
ctx.jet.balancing_algorithm == RefinementAlgorithm::GREEDY_CLUSTER_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::GLOBAL_FM) &&
ctx.fm.balancing_algorithm == RefinementAlgorithm::GREEDY_CLUSTER_BALANCER)) {
ctx.jet.balancing_algorithm == RefinementAlgorithm::GREEDY_CLUSTER_BALANCER)) {
out << "Cluster balancer: " << RefinementAlgorithm::GREEDY_CLUSTER_BALANCER << "\n";
out << " Clusters: " << ctx.cluster_balancer.cluster_strategy << "\n";
out << " Max weight: " << ctx.cluster_balancer.cluster_size_strategy << " x "
Expand Down Expand Up @@ -557,14 +524,5 @@ void print(const RefinementContext &ctx, const ParallelContext &parallel, std::o
<< 100.0 * ctx.cluster_balancer.par_initial_rebalance_fraction << "%, increase by "
<< 100.0 * ctx.cluster_balancer.par_rebalance_fraction_increase << "% each round\n";
}
if (ctx.includes_algorithm(RefinementAlgorithm::JET_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::JET_REFINER) &&
ctx.jet.balancing_algorithm == RefinementAlgorithm::JET_BALANCER) ||
(ctx.includes_algorithm(RefinementAlgorithm::GLOBAL_FM) &&
ctx.fm.balancing_algorithm == RefinementAlgorithm::JET_BALANCER)) {
out << "Jet balancer: " << RefinementAlgorithm::JET_BALANCER << "\n";
out << " Number of iterations: " << ctx.jet_balancer.num_weak_iterations << " weak + "
<< ctx.jet_balancer.num_strong_iterations << " strong\n";
}
}
} // namespace kaminpar::dist
36 changes: 0 additions & 36 deletions kaminpar-dist/dkaminpar.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ enum class RefinementAlgorithm {
NOOP,
BATCHED_LP,
COLORED_LP,
GLOBAL_FM,
JET_REFINER,
JET_BALANCER,
GREEDY_NODE_BALANCER,
GREEDY_CLUSTER_BALANCER,
MTKAHYPAR,
Expand Down Expand Up @@ -188,33 +186,6 @@ struct LabelPropagationRefinementContext {
bool ignore_probabilities;
};

struct FMRefinementContext {
double alpha;

bool use_independent_seeds;
bool use_bfs_seeds_as_fm_seeds;

bool chunk_local_rounds;
ChunksContext chunks;

int max_hops;
int max_radius;

int num_global_iterations;
int num_local_iterations;

bool revert_local_moves_after_batch;

bool rebalance_after_each_global_iteration;
bool rebalance_after_refinement;
RefinementAlgorithm balancing_algorithm;

bool rollback_deterioration;

bool use_abortion_threshold;
double abortion_threshold;
};

struct MtKaHyParRefinementContext {
std::string config_filename;
std::string fine_config_filename;
Expand Down Expand Up @@ -300,11 +271,6 @@ struct ClusterBalancerContext {
bool switch_to_singleton_after_stallmate;
};

struct JetBalancerContext {
int num_weak_iterations;
int num_strong_iterations;
};

struct JetRefinementContext {
int num_coarse_rounds;
int num_fine_rounds;
Expand All @@ -330,12 +296,10 @@ struct RefinementContext {

LabelPropagationRefinementContext lp;
ColoredLabelPropagationRefinementContext colored_lp;
FMRefinementContext fm;
NodeBalancerContext node_balancer;
ClusterBalancerContext cluster_balancer;

JetRefinementContext jet;
JetBalancerContext jet_balancer;

MtKaHyParRefinementContext mtkahypar;

Expand Down
8 changes: 0 additions & 8 deletions kaminpar-dist/factories.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include "kaminpar-dist/refinement/adapters/mtkahypar_refiner.h"
#include "kaminpar-dist/refinement/balancer/cluster_balancer.h"
#include "kaminpar-dist/refinement/balancer/node_balancer.h"
#include "kaminpar-dist/refinement/fm/fm_refiner.h"
#include "kaminpar-dist/refinement/jet/jet_balancer.h"
#include "kaminpar-dist/refinement/jet/jet_refiner.h"
#include "kaminpar-dist/refinement/lp/clp_refiner.h"
#include "kaminpar-dist/refinement/lp/lp_refiner.h"
Expand Down Expand Up @@ -92,15 +90,9 @@ create_refiner(const Context &ctx, const RefinementAlgorithm algorithm) {
case RefinementAlgorithm::COLORED_LP:
return std::make_unique<ColoredLPRefinerFactory>(ctx);

case RefinementAlgorithm::GLOBAL_FM:
return std::make_unique<FMRefinerFactory>(ctx);

case RefinementAlgorithm::JET_REFINER:
return std::make_unique<JetRefinerFactory>(ctx);

case RefinementAlgorithm::JET_BALANCER:
return std::make_unique<JetBalancerFactory>(ctx);

case RefinementAlgorithm::GREEDY_NODE_BALANCER:
return std::make_unique<NodeBalancerFactory>(ctx);

Expand Down
Loading

0 comments on commit 3bb37d8

Please sign in to comment.