From 5057ae920cdcaf305a72e43555ceec14f1e78693 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Thu, 22 May 2014 19:07:29 +0200 Subject: [PATCH] replace a couple of std::sort calls with tbb::parallel_sort --- Contractor/Contractor.h | 3 ++- DataStructures/NodeBasedGraph.h | 4 +++- DataStructures/StaticRTree.h | 3 ++- prepare.cpp | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Contractor/Contractor.h b/Contractor/Contractor.h index 8e6bee2a34c..edd2659d50c 100644 --- a/Contractor/Contractor.h +++ b/Contractor/Contractor.h @@ -43,6 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include @@ -188,7 +189,7 @@ class Contractor } // clear input vector and trim the current set of edges with the well-known swap trick input_edge_list.clear(); - sort(edges.begin(), edges.end()); + tbb::parallel_sort(edges.begin(), edges.end()); NodeID edge = 0; for (NodeID i = 0; i < edges.size();) { diff --git a/DataStructures/NodeBasedGraph.h b/DataStructures/NodeBasedGraph.h index 46594ac0119..9f2d63086f2 100644 --- a/DataStructures/NodeBasedGraph.h +++ b/DataStructures/NodeBasedGraph.h @@ -4,6 +4,8 @@ #include "DynamicGraph.h" #include "ImportEdge.h" +#include + #include struct NodeBasedEdgeData @@ -50,7 +52,7 @@ inline std::shared_ptr NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector &input_edge_list) { static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption"); - std::sort(input_edge_list.begin(), input_edge_list.end()); + // tbb::parallel_sort(input_edge_list.begin(), input_edge_list.end()); // TODO: remove duplicate edges DeallocatingVector edges_list; diff --git a/DataStructures/StaticRTree.h b/DataStructures/StaticRTree.h index 268c583782f..0561f0ed54f 100644 --- a/DataStructures/StaticRTree.h +++ b/DataStructures/StaticRTree.h @@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include @@ -313,7 +314,7 @@ class StaticRTree leaf_node_file.write((char *)&m_element_count, sizeof(uint64_t)); // sort the hilbert-value representatives - std::sort(input_wrapper_vector.begin(), input_wrapper_vector.end()); + tbb::parallel_sort(input_wrapper_vector.begin(), input_wrapper_vector.end()); std::vector tree_nodes_in_level; // pack M elements into leaf node and write to leaf file diff --git a/prepare.cpp b/prepare.cpp index 0448299dada..4ab0818ca25 100644 --- a/prepare.cpp +++ b/prepare.cpp @@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include typedef QueryEdge::EdgeData EdgeData; typedef DynamicGraph::InputEdge InputEdge; @@ -68,8 +69,6 @@ std::vector edge_list; int main(int argc, char *argv[]) { - - try { LogPolicy::GetInstance().Unmute();