ports/geo/osrm-backend/patches/patch-src_guidance_guidance_processing_cpp

60 lines
2.4 KiB
Text

make it tolerant of TBB 2020
https://github.com/Project-OSRM/osrm-backend/pull/6493
Index: src/guidance/guidance_processing.cpp
--- src/guidance/guidance_processing.cpp.orig
+++ src/guidance/guidance_processing.cpp
@@ -9,7 +9,11 @@
#include "util/percent.hpp"
#include <tbb/blocked_range.h>
+#if TBB_VERSION_MAJOR == 2020
+#include <tbb/pipeline.h>
+#else
#include <tbb/parallel_pipeline.h>
+#endif
#include <thread>
@@ -97,8 +101,13 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
const constexpr unsigned GRAINSIZE = 100;
// First part of the pipeline generates iterator ranges of IDs in sets of GRAINSIZE
+#if TBB_VERSION_MAJOR == 2020
+ tbb::filter_t<void, tbb::blocked_range<NodeID>> generator_stage(
+ tbb::filter::serial_in_order, [&](tbb::flow_control &fc) {
+#else
tbb::filter<void, tbb::blocked_range<NodeID>> generator_stage(
tbb::filter_mode::serial_in_order, [&](tbb::flow_control &fc) {
+#endif
if (current_node < node_count)
{
auto next_node = std::min(current_node + GRAINSIZE, node_count);
@@ -116,8 +125,13 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
//
// Guidance stage
//
+#if TBB_VERSION_MAJOR == 2020
+ tbb::filter_t<tbb::blocked_range<NodeID>, TurnsPipelineBufferPtr> guidance_stage(
+ tbb::filter::parallel,
+#else
tbb::filter<tbb::blocked_range<NodeID>, TurnsPipelineBufferPtr> guidance_stage(
tbb::filter_mode::parallel,
+#endif
[&](const tbb::blocked_range<NodeID> &intersection_node_range) {
auto buffer = std::make_shared<TurnsPipelineBuffer>();
buffer->nodes_processed = intersection_node_range.size();
@@ -308,8 +322,13 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
util::Percent guidance_progress(log, node_count);
std::vector<guidance::TurnData> delayed_turn_data;
+#if TBB_VERSION_MAJOR == 2020
+ tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage(
+ tbb::filter::serial_in_order, [&](auto buffer) {
+#else
tbb::filter<TurnsPipelineBufferPtr, void> guidance_output_stage(
tbb::filter_mode::serial_in_order, [&](auto buffer) {
+#endif
guidance_progress.PrintAddition(buffer->nodes_processed);
connectivity_checksum = buffer->checksum.update_checksum(connectivity_checksum);