Skip to content

Commit

Permalink
feat(kaminpar-shm): update graph compression tool to support new io
Browse files Browse the repository at this point in the history
  • Loading branch information
dsalwasser committed Jun 3, 2024
1 parent a03b1ee commit 0170783
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions apps/tools/shm_graph_compression_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include <tbb/global_control.h>

#include "kaminpar-shm/context_io.h"
#include "kaminpar-shm/kaminpar.h"

#include "kaminpar-common/logger.h"

#include "apps/io/metis_parser.h"
Expand All @@ -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");
Expand All @@ -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);

Expand All @@ -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();
}
Expand Down

0 comments on commit 0170783

Please sign in to comment.