Skip to content

Commit

Permalink
fix(compressed-graph): cover edge case where the largest chunk is the…
Browse files Browse the repository at this point in the history
… last one during parallel compression
  • Loading branch information
dsalwasser committed Jun 23, 2024
1 parent 31ead47 commit 30addef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kaminpar-common/datastructures/maxsize_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <typename T> class MaxCapacityAllocator : public std::allocator<T> {
}

void deallocate(T *p, size_type n) {
return Base::deallocate(p, n);
return Base::deallocate(p, std::min(n, _max_capacity));
}

private:
Expand Down
4 changes: 3 additions & 1 deletion kaminpar-shm/datastructures/compressed_graph_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class CompressedEdgesBuilder {
void init(const EdgeID first_edge);

/*!
* Adds the (possibly weighted) neighborhood of a node. Note that the neighbourhood vector is modified.
* Adds the (possibly weighted) neighborhood of a node. Note that the neighbourhood vector is
* modified.
*
* @param node The node whose neighborhood to add.
* @param neighbourhood The neighbourhood of the node to add.
Expand Down Expand Up @@ -796,6 +797,7 @@ CompressedGraph compute_compressed_graph(
// If the last chunk is smaller than the chunk size limit, add it explicitly.
if (cur_chunk_start != num_nodes) {
chunks.emplace_back(cur_chunk_start, num_nodes, cur_first_edge);
max_chunk_size = std::max<NodeID>(max_chunk_size, num_nodes - cur_chunk_start);
}
};

Expand Down

0 comments on commit 30addef

Please sign in to comment.