From 01707834a6b78356de3bd9c619723dd39db6ea23 Mon Sep 17 00:00:00 2001 From: Daniel Salwasser Date: Mon, 3 Jun 2024 08:35:55 +0200 Subject: [PATCH] feat(kaminpar-shm): update graph compression tool to support new io --- apps/tools/shm_graph_compression_tool.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/tools/shm_graph_compression_tool.cc b/apps/tools/shm_graph_compression_tool.cc index 8298f4c7..856195fb 100644 --- a/apps/tools/shm_graph_compression_tool.cc +++ b/apps/tools/shm_graph_compression_tool.cc @@ -11,6 +11,9 @@ #include +#include "kaminpar-shm/context_io.h" +#include "kaminpar-shm/kaminpar.h" + #include "kaminpar-common/logger.h" #include "apps/io/metis_parser.h" @@ -27,6 +30,7 @@ int main(int argc, char *argv[]) { std::string graph_filename; std::string compressed_graph_filename; GraphFileFormat graph_file_format = io::GraphFileFormat::METIS; + NodeOrdering node_ordering = NodeOrdering::NATURAL; int num_threads = 1; CLI::App app("Shared-memory graph compression tool"); @@ -38,6 +42,13 @@ int main(int argc, char *argv[]) { ->description(R"(Graph file formats: - metis - parhip)"); + app.add_option("--node-order", node_ordering) + ->transform(CLI::CheckedTransformer(get_node_orderings()).description("")) + ->description(R"(Criteria by which the nodes of the graph are sorted and rearranged: + - natural: keep node order of the graph (do not rearrange) + - deg-buckets: sort nodes by degree bucket and rearrange accordingly + - implicit-deg-buckets: nodes of the input graph are sorted by deg-buckets order)") + ->capture_default_str(); app.add_option("-t,--threads", num_threads, "Number of threads"); CLI11_PARSE(app, argc, argv); @@ -48,9 +59,11 @@ int main(int argc, char *argv[]) { CompressedGraph graph = [&] { switch (graph_file_format) { case GraphFileFormat::METIS: - return *metis::compress_read(graph_filename, false, false); + return *metis::compress_read( + graph_filename, node_ordering == NodeOrdering::IMPLICIT_DEGREE_BUCKETS, false + ); case GraphFileFormat::PARHIP: - return parhip::compressed_read(graph_filename, false); + return parhip::compressed_read_parallel(graph_filename, node_ordering); default: __builtin_unreachable(); }