Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store degree instead of first edge ID in the header of a compressed neighborhood #33

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
19 changes: 1 addition & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,15 @@ endif ()

# Control graph compression options
###################################
option(KAMINPAR_COMPRESSION_EDGE_WEIGHTS "Whether to compress edge weights." ON)
option(KAMINPAR_COMPRESSION_HIGH_DEGREE_ENCODING "Use high-degree encoding for the compressed graph." ON)
option(KAMINPAR_COMPRESSION_INTERVAL_ENCODING "Use interval encoding for the compressed graph." ON)
option(KAMINPAR_COMPRESSION_RUN_LENGTH_ENCODING "Use run-length encoding for the compressed graph." OFF)
option(KAMINPAR_COMPRESSION_STREAMVBYTE_ENCODING "Use StreamVByte encoding for the compressed graph." OFF)
option(KAMINPAR_COMPRESSION_FAST_DECODING "Use fast decoding for the compressed graph." OFF)

if (KAMINPAR_COMPRESSION_RUN_LENGTH_ENCODING AND KAMINPAR_COMPRESSION_STREAM_ENCODING)
message(FATAL_ERROR "Either run-length or StreamVByte encoding can be used for varints but not both.")
endif ()
option(KAMINPAR_COMPRESSION_FAST_DECODING "Use a fast PEXT-based decoding routine for the compressed graph." OFF)

if (KAMINPAR_64BIT_NODE_IDS AND KAMINPAR_COMPRESSION_STREAM_ENCODING)
message(FATAL_ERROR "StreamVByte encoding cannot be used with 64-bit NodeIDs.")
endif ()

if (KAMINPAR_COMPRESSION_EDGE_WEIGHTS AND KAMINPAR_COMPRESSION_RUN_LENGTH_ENCODING)
message(FATAL_ERROR "Run-length encoding cannot be used together with compressed edge weights.")
endif ()

################################################################################
## Declare dependencies ##
################################################################################
Expand Down Expand Up @@ -212,13 +202,6 @@ endif ()

message(STATUS "Graph compression summary:")

if (KAMINPAR_COMPRESSION_EDGE_WEIGHTS)
list(APPEND KAMINPAR_DEFINITIONS "-DKAMINPAR_COMPRESSION_EDGE_WEIGHTS")
message(" Compressed edge weights: enabled")
else ()
message(" Compressed edge weights: disabled")
endif ()

if (KAMINPAR_COMPRESSION_HIGH_DEGREE_ENCODING)
list(APPEND KAMINPAR_DEFINITIONS "-DKAMINPAR_COMPRESSION_HIGH_DEGREE_ENCODING")
message(" High-degree encoding: enabled")
Expand Down
1 change: 0 additions & 1 deletion apps/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ add_shm_benchmark(shm_label_propagation_benchmark shm_label_propagation_benchmar
add_shm_benchmark(shm_refinement_benchmark shm_refinement_benchmark.cc)
#add_shm_benchmark(shm_gain_cache_benchmark shm_gain_cache_benchmark.cc)
add_shm_benchmark(shm_compressed_graph_benchmark shm_compressed_graph_benchmark.cc)
add_shm_benchmark(shm_variable_length_codec_benchmark shm_variable_length_codec_benchmark.cc)

if (KAMINPAR_BUILD_DISTRIBUTED)
function(add_dist_benchmark target)
Expand Down
83 changes: 11 additions & 72 deletions apps/benchmarks/shm_compressed_graph_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ template <typename Graph> void benchmark_degree(const Graph &graph) {
}
}

template <typename Graph> void benchmark_incident_edges(const Graph &graph) {
SCOPED_TIMER("Incident Edges");

for (const auto node : graph.nodes()) {
for (const auto incident_edge : graph.incident_edges(node)) {
do_not_optimize(incident_edge);
}
}
}

template <typename Graph> void benchmark_adjacent_nodes(const Graph &graph) {
SCOPED_TIMER("Adjacent Nodes");

Expand All @@ -74,73 +64,30 @@ template <typename Graph> void benchmark_weighted_adjacent_nodes(const Graph &gr
}
}

template <typename Graph> void benchmark_neighbors(const Graph &graph) {
SCOPED_TIMER("Neighbors");

for (const auto node : graph.nodes()) {
graph.neighbors(node, [](const auto incident_edge, const auto adjacent_node) {
do_not_optimize(incident_edge);
do_not_optimize(adjacent_node);
});
}
}

template <typename Graph> void benchmark_weighted_neighbors(const Graph &graph) {
SCOPED_TIMER("Neighbors with Edge Weights");

for (const auto node : graph.nodes()) {
graph.neighbors(
node,
[](const auto incident_edge, const auto adjacent_node, const auto edge_weight) {
do_not_optimize(incident_edge);
do_not_optimize(adjacent_node);
do_not_optimize(edge_weight);
}
);
}
}

template <typename Graph> void benchmark_neighbors_limit(const Graph &graph) {
SCOPED_TIMER("Neighbors (with limit)");

for (const auto node : graph.nodes()) {
graph.neighbors(
node,
std::numeric_limits<NodeID>::max(),
[](const auto incident_edge, const auto adjacent_node) {
do_not_optimize(incident_edge);
do_not_optimize(adjacent_node);
}
);
}
}

template <typename Graph> void benchmark_weighted_neighbors_limit(const Graph &graph) {
SCOPED_TIMER("Neighbors with Edge Weights (with limit)");
template <typename Graph> void benchmark_weighted_adjacent_nodes_limit(const Graph &graph) {
SCOPED_TIMER("Adjacent Nodes with Edge Weights");

for (const auto node : graph.nodes()) {
graph.neighbors(
graph.adjacent_nodes(
node,
std::numeric_limits<NodeID>::max(),
[](const auto incident_edge, const auto adjacent_node, const auto edge_weight) {
do_not_optimize(incident_edge);
[&](const auto adjacent_node, const auto edge_weight) {
do_not_optimize(adjacent_node);
do_not_optimize(edge_weight);
}
);
}
}

template <typename Graph> void benchmark_pfor_neighbors(const Graph &graph) {
template <typename Graph> void benchmark_pfor_adjacent_nodes(const Graph &graph) {
SCOPED_TIMER("Parallel For Neighbors");

for (const auto node : graph.nodes()) {
graph.pfor_neighbors(
graph.pfor_adjacent_nodes(
node,
std::numeric_limits<NodeID>::max(),
1000,
[](const auto incident_edge, const auto adjacent_node, const auto edge_weight) {
do_not_optimize(incident_edge);
[](const auto adjacent_node, const auto edge_weight) {
do_not_optimize(adjacent_node);
do_not_optimize(edge_weight);
}
Expand All @@ -151,26 +98,18 @@ template <typename Graph> void benchmark_pfor_neighbors(const Graph &graph) {
void run_benchmark(const CSRGraph &graph, const CompressedGraph &compressed_graph) {
TIMED_SCOPE("Uncompressed graph operations") {
benchmark_degree(graph);
benchmark_incident_edges(graph);
benchmark_adjacent_nodes(graph);
benchmark_weighted_adjacent_nodes(graph);
benchmark_neighbors(graph);
benchmark_weighted_neighbors(graph);
benchmark_neighbors_limit(graph);
benchmark_weighted_neighbors_limit(graph);
benchmark_pfor_neighbors(graph);
benchmark_weighted_adjacent_nodes_limit(graph);
benchmark_pfor_adjacent_nodes(graph);
};

TIMED_SCOPE("Compressed graph operations") {
benchmark_degree(compressed_graph);
benchmark_incident_edges(compressed_graph);
benchmark_adjacent_nodes(compressed_graph);
benchmark_weighted_adjacent_nodes(compressed_graph);
benchmark_neighbors(compressed_graph);
benchmark_weighted_neighbors(compressed_graph);
benchmark_neighbors_limit(compressed_graph);
benchmark_weighted_neighbors_limit(compressed_graph);
benchmark_pfor_neighbors(compressed_graph);
benchmark_weighted_adjacent_nodes_limit(compressed_graph);
benchmark_pfor_adjacent_nodes(compressed_graph);
};
}

Expand Down
Loading