sort edges in StaticGraph in parallel
This commit is contained in:
parent
b875765c52
commit
d240ae3b03
@ -179,6 +179,7 @@ target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT})
|
|||||||
find_package(TBB REQUIRED)
|
find_package(TBB REQUIRED)
|
||||||
target_link_libraries(osrm-extract ${TBB_LIBRARIES})
|
target_link_libraries(osrm-extract ${TBB_LIBRARIES})
|
||||||
target_link_libraries(osrm-prepare ${TBB_LIBRARIES})
|
target_link_libraries(osrm-prepare ${TBB_LIBRARIES})
|
||||||
|
target_link_libraries(osrm-routed ${TBB_LIBRARIES})
|
||||||
include_directories(${TBB_INCLUDE_DIR})
|
include_directories(${TBB_INCLUDE_DIR})
|
||||||
|
|
||||||
find_package(Lua52)
|
find_package(Lua52)
|
||||||
@ -248,6 +249,7 @@ if(WITH_TOOLS)
|
|||||||
endif()
|
endif()
|
||||||
add_executable(osrm-cli Tools/simpleclient.cpp)
|
add_executable(osrm-cli Tools/simpleclient.cpp)
|
||||||
target_link_libraries(osrm-cli ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION)
|
target_link_libraries(osrm-cli ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION)
|
||||||
|
target_link_libraries(osrm-cli ${TBB_LIBRARIES})
|
||||||
add_executable(osrm-io-benchmark Tools/io-benchmark.cpp)
|
add_executable(osrm-io-benchmark Tools/io-benchmark.cpp)
|
||||||
target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES} GITDESCRIPTION)
|
target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES} GITDESCRIPTION)
|
||||||
add_executable(osrm-unlock-all Tools/unlock_all_mutexes.cpp)
|
add_executable(osrm-unlock-all Tools/unlock_all_mutexes.cpp)
|
||||||
|
@ -33,8 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
#include <boost/range/irange.hpp>
|
#include <boost/range/irange.hpp>
|
||||||
|
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -81,7 +84,7 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
|||||||
|
|
||||||
StaticGraph(const int nodes, std::vector<InputEdge> &graph)
|
StaticGraph(const int nodes, std::vector<InputEdge> &graph)
|
||||||
{
|
{
|
||||||
std::sort(graph.begin(), graph.end());
|
tbb::parallel_sort(graph.begin(), graph.end());
|
||||||
number_of_nodes = nodes;
|
number_of_nodes = nodes;
|
||||||
number_of_edges = (EdgeIterator)graph.size();
|
number_of_edges = (EdgeIterator)graph.size();
|
||||||
node_array.resize(number_of_nodes + 1);
|
node_array.resize(number_of_nodes + 1);
|
||||||
@ -106,7 +109,7 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
|||||||
{
|
{
|
||||||
edge_array[i].target = graph[edge].target;
|
edge_array[i].target = graph[edge].target;
|
||||||
edge_array[i].data = graph[edge].data;
|
edge_array[i].data = graph[edge].data;
|
||||||
assert(edge_array[i].data.distance > 0);
|
BOOST_ASSERT(edge_array[i].data.distance > 0);
|
||||||
edge++;
|
edge++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,10 +130,12 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
|||||||
{
|
{
|
||||||
for (auto eid : GetAdjacentEdgeRange(u))
|
for (auto eid : GetAdjacentEdgeRange(u))
|
||||||
{
|
{
|
||||||
const unsigned v = GetTarget(eid);
|
|
||||||
const EdgeData &data = GetEdgeData(eid);
|
const EdgeData &data = GetEdgeData(eid);
|
||||||
if (data.shortcut)
|
if (!data.shortcut)
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const unsigned v = GetTarget(eid);
|
||||||
const EdgeID first_edge_id = FindEdgeInEitherDirection(u, data.id);
|
const EdgeID first_edge_id = FindEdgeInEitherDirection(u, data.id);
|
||||||
if (SPECIAL_EDGEID == first_edge_id)
|
if (SPECIAL_EDGEID == first_edge_id)
|
||||||
{
|
{
|
||||||
@ -148,7 +153,6 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
|||||||
BOOST_ASSERT(false);
|
BOOST_ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
p.printIncrement();
|
p.printIncrement();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user