replace a couple of std::sort calls with tbb::parallel_sort

This commit is contained in:
Dennis Luxen 2014-05-22 19:07:29 +02:00
parent 6a03f13d55
commit 5057ae920c
4 changed files with 8 additions and 5 deletions

View File

@ -43,6 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>
#include <algorithm>
#include <limits>
@ -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();)
{

View File

@ -4,6 +4,8 @@
#include "DynamicGraph.h"
#include "ImportEdge.h"
#include <tbb/parallel_sort.h>
#include <memory>
struct NodeBasedEdgeData
@ -50,7 +52,7 @@ inline std::shared_ptr<NodeBasedDynamicGraph>
NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &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<NodeBasedDynamicGraph::InputEdge> edges_list;

View File

@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/thread.hpp>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>
#include <algorithm>
#include <array>
@ -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<TreeNode> tree_nodes_in_level;
// pack M elements into leaf node and write to leaf file

View File

@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <tbb/task_scheduler_init.h>
#include <tbb/parallel_sort.h>
typedef QueryEdge::EdgeData EdgeData;
typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
@ -68,8 +69,6 @@ std::vector<ImportEdge> edge_list;
int main(int argc, char *argv[])
{
try
{
LogPolicy::GetInstance().Unmute();