replace a couple of std::sort calls with tbb::parallel_sort
This commit is contained in:
parent
6a03f13d55
commit
5057ae920c
@ -43,6 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <tbb/enumerable_thread_specific.h>
|
#include <tbb/enumerable_thread_specific.h>
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -188,7 +189,7 @@ class Contractor
|
|||||||
}
|
}
|
||||||
// clear input vector and trim the current set of edges with the well-known swap trick
|
// clear input vector and trim the current set of edges with the well-known swap trick
|
||||||
input_edge_list.clear();
|
input_edge_list.clear();
|
||||||
sort(edges.begin(), edges.end());
|
tbb::parallel_sort(edges.begin(), edges.end());
|
||||||
NodeID edge = 0;
|
NodeID edge = 0;
|
||||||
for (NodeID i = 0; i < edges.size();)
|
for (NodeID i = 0; i < edges.size();)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "DynamicGraph.h"
|
#include "DynamicGraph.h"
|
||||||
#include "ImportEdge.h"
|
#include "ImportEdge.h"
|
||||||
|
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
struct NodeBasedEdgeData
|
struct NodeBasedEdgeData
|
||||||
@ -50,7 +52,7 @@ inline std::shared_ptr<NodeBasedDynamicGraph>
|
|||||||
NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &input_edge_list)
|
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");
|
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
|
// TODO: remove duplicate edges
|
||||||
DeallocatingVector<NodeBasedDynamicGraph::InputEdge> edges_list;
|
DeallocatingVector<NodeBasedDynamicGraph::InputEdge> edges_list;
|
||||||
|
@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -313,7 +314,7 @@ class StaticRTree
|
|||||||
leaf_node_file.write((char *)&m_element_count, sizeof(uint64_t));
|
leaf_node_file.write((char *)&m_element_count, sizeof(uint64_t));
|
||||||
|
|
||||||
// sort the hilbert-value representatives
|
// 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;
|
std::vector<TreeNode> tree_nodes_in_level;
|
||||||
|
|
||||||
// pack M elements into leaf node and write to leaf file
|
// pack M elements into leaf node and write to leaf file
|
||||||
|
@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
typedef QueryEdge::EdgeData EdgeData;
|
typedef QueryEdge::EdgeData EdgeData;
|
||||||
typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
|
typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
|
||||||
@ -68,8 +69,6 @@ std::vector<ImportEdge> edge_list;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogPolicy::GetInstance().Unmute();
|
LogPolicy::GetInstance().Unmute();
|
||||||
|
Loading…
Reference in New Issue
Block a user