View | Details | Raw Unified | Return to bug 252790 | Differences between
and this patch

Collapse All | Expand All

(-)www/osrm-backend/Makefile (-2 / +4 lines)
Lines 3-8 Link Here
3
PORTNAME=	osrm-backend
3
PORTNAME=	osrm-backend
4
DISTVERSIONPREFIX=	v
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	5.24.0
5
DISTVERSION=	5.24.0
6
PORTREVISION=	1
6
CATEGORIES=	www
7
CATEGORIES=	www
7
8
8
MAINTAINER=	freebsd@mosedal.net
9
MAINTAINER=	freebsd@mosedal.net
Lines 21-28 Link Here
21
		libboost_thread.so:devel/boost-libs \
22
		libboost_thread.so:devel/boost-libs \
22
		libexpat.so:textproc/expat2 \
23
		libexpat.so:textproc/expat2 \
23
		libluabind.so:devel/luabind \
24
		libluabind.so:devel/luabind \
24
		libtbb.so:devel/tbb \
25
		libtbb.so:devel/onetbb \
25
		libtbbmalloc.so:devel/tbb
26
		libtbbmalloc.so:devel/onetbb
26
27
27
USES=		cmake compiler:c++14-lang lua:53
28
USES=		cmake compiler:c++14-lang lua:53
28
USE_GITHUB=	yes
29
USE_GITHUB=	yes
Lines 29-34 Link Here
29
GH_ACCOUNT=	Project-OSRM
30
GH_ACCOUNT=	Project-OSRM
30
OPTIONS_DEFINE=	DEBUG
31
OPTIONS_DEFINE=	DEBUG
31
32
33
CONFIGURE_ENV+=	TBB_INSTALL_DIR=${LOCALBASE}
32
USE_RC_SUBR=	osrm
34
USE_RC_SUBR=	osrm
33
35
34
USERS=		osrm
36
USERS=		osrm
(-)www/osrm-backend/files/patch-cmake_FindTBB.cmake (+25 lines)
Line 0 Link Here
1
--- cmake/FindTBB.cmake.orig	2020-10-14 21:08:23 UTC
2
+++ cmake/FindTBB.cmake
3
@@ -180,11 +180,11 @@ endmacro(TBB_CORRECT_LIB_DIR var_content)
4
 
5
 
6
 #-- Look for include directory and set ${TBB_INCLUDE_DIR}
7
-set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
8
+set (TBB_INC_SEARCH_DIR /usr/local/include/oneapi)
9
 # Jiri: tbbvars now sets the CPATH environment variable to the directory
10
 #       containing the headers.
11
 find_path(TBB_INCLUDE_DIR
12
-    tbb/task_scheduler_init.h
13
+    tbb/task_scheduler_observer.h
14
     HINTS ${TBB_INC_SEARCH_DIR} ENV CPATH
15
 )
16
 mark_as_advanced(TBB_INCLUDE_DIR)
17
@@ -279,7 +279,7 @@ endif (NOT _TBB_INSTALL_DIR)
18
 
19
 if (TBB_FOUND)
20
 	set(TBB_INTERFACE_VERSION 0)
21
-	FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
22
+	FILE(READ "${TBB_INCLUDE_DIRS}/tbb/version.h" _TBB_VERSION_CONTENTS)
23
 	STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
24
 	set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
25
         message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
(-)www/osrm-backend/files/patch-include_util_packed__vector.hpp (+42 lines)
Line 0 Link Here
1
--- include/util/packed_vector.hpp.orig	2020-10-14 21:08:23 UTC
2
+++ include/util/packed_vector.hpp
3
@@ -11,7 +11,7 @@
4
 #include <boost/iterator/iterator_facade.hpp>
5
 #include <boost/iterator/reverse_iterator.hpp>
6
 
7
-#include <tbb/atomic.h>
8
+#include <atomic>
9
 
10
 #include <array>
11
 #include <cmath>
12
@@ -512,7 +512,7 @@ template <typename T, std::size_t Bits, storage::Owner
13
     inline void set_value(const InternalIndex internal_index, const T value)
14
     {
15
         // ⚠ The method uses CAS spinlocks to prevent data races in parallel calls
16
-        // TBB internal atomic's are used for CAS on non-atomic data
17
+        // std internal atomic's are used for CAS on non-atomic data
18
         // Parallel read and write access is not allowed
19
 
20
         auto &lower_word = vec[internal_index.lower_word];
21
@@ -527,8 +527,8 @@ template <typename T, std::size_t Bits, storage::Owner
22
                                                        lower_mask[internal_index.element],
23
                                                        lower_offset[internal_index.element],
24
                                                        value);
25
-        } while (tbb::internal::as_atomic(lower_word)
26
-                     .compare_and_swap(new_lower_word, local_lower_word) != local_lower_word);
27
+        } while (std::atomic<WordT>(lower_word)
28
+                     .compare_exchange_weak(new_lower_word, local_lower_word) != local_lower_word);
29
 
30
         // Lock-free update of the upper word
31
         WordT local_upper_word, new_upper_word;
32
@@ -539,8 +539,8 @@ template <typename T, std::size_t Bits, storage::Owner
33
                                                        upper_mask[internal_index.element],
34
                                                        upper_offset[internal_index.element],
35
                                                        value);
36
-        } while (tbb::internal::as_atomic(upper_word)
37
-                     .compare_and_swap(new_upper_word, local_upper_word) != local_upper_word);
38
+        } while (std::atomic<WordT>(upper_word)
39
+                     .compare_exchange_weak(new_upper_word, local_upper_word) != local_upper_word);
40
     }
41
 
42
     util::ViewOrVector<WordT, Ownership> vec;
(-)www/osrm-backend/files/patch-src_contractor_contractor.cpp (+20 lines)
Line 0 Link Here
1
--- src/contractor/contractor.cpp.orig	2021-01-31 11:25:33 UTC
2
+++ src/contractor/contractor.cpp
3
@@ -36,7 +36,7 @@
4
 
5
 #include <boost/assert.hpp>
6
 
7
-#if TBB_VERSION_MAJOR == 2020
8
+#if TBB_VERSION_MAJOR >= 2020
9
 #include <tbb/global_control.h>
10
 #else
11
 #include <tbb/task_scheduler_init.h>
12
@@ -49,7 +49,7 @@ namespace contractor
13
 
14
 int Contractor::Run()
15
 {
16
-#if TBB_VERSION_MAJOR == 2020
17
+#if TBB_VERSION_MAJOR >= 2020
18
     tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
19
                            config.requested_num_threads);
20
 #else
(-)www/osrm-backend/files/patch-src_customize_customizer.cpp (+20 lines)
Line 0 Link Here
1
--- src/customize/customizer.cpp.orig	2021-02-06 01:53:00 UTC
2
+++ src/customize/customizer.cpp
3
@@ -21,7 +21,7 @@
4
 
5
 #include <boost/assert.hpp>
6
 
7
-#if TBB_VERSION_MAJOR == 2020
8
+#if TBB_VERSION_MAJOR >= 2020
9
 #include <tbb/global_control.h>
10
 #else
11
 #include <tbb/task_scheduler_init.h>
12
@@ -122,7 +122,7 @@ std::vector<CellMetric> customizeFilteredMetrics(const
13
 
14
 int Customizer::Run(const CustomizationConfig &config)
15
 {
16
-#if TBB_VERSION_MAJOR == 2020
17
+#if TBB_VERSION_MAJOR >= 2020
18
     tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
19
                            config.requested_num_threads);
20
 #else
(-)www/osrm-backend/files/patch-src_extractor_edge__based__graph__factory.cpp (+44 lines)
Line 0 Link Here
1
--- src/extractor/edge_based_graph_factory.cpp.orig	2021-01-31 16:20:02 UTC
2
+++ src/extractor/edge_based_graph_factory.cpp
3
@@ -37,7 +37,7 @@
4
 
5
 #include <tbb/blocked_range.h>
6
 #include <tbb/parallel_for.h>
7
-#include <tbb/pipeline.h>
8
+#include <tbb/parallel_pipeline.h>
9
 
10
 namespace std
11
 {
12
@@ -527,8 +527,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
13
         const constexpr unsigned GRAINSIZE = 100;
14
 
15
         // First part of the pipeline generates iterator ranges of IDs in sets of GRAINSIZE
16
-        tbb::filter_t<void, tbb::blocked_range<NodeID>> generator_stage(
17
-            tbb::filter::serial_in_order, [&](tbb::flow_control &fc) {
18
+        auto generator_stage = tbb::make_filter<void, tbb::blocked_range<NodeID>>(
19
+            tbb::filter_mode::serial_in_order, [&](tbb::flow_control &fc) {
20
                 if (current_node < node_count)
21
                 {
22
                     auto next_node = std::min(current_node + GRAINSIZE, node_count);
23
@@ -662,8 +662,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
24
         //
25
         // Edge-based-graph stage
26
         //
27
-        tbb::filter_t<tbb::blocked_range<NodeID>, EdgesPipelineBufferPtr> processor_stage(
28
-            tbb::filter::parallel, [&](const tbb::blocked_range<NodeID> &intersection_node_range) {
29
+        auto processor_stage = tbb::make_filter<tbb::blocked_range<NodeID>, EdgesPipelineBufferPtr>(
30
+            tbb::filter_mode::parallel, [&](const tbb::blocked_range<NodeID> &intersection_node_range) {
31
                 auto buffer = std::make_shared<EdgesPipelineBuffer>();
32
                 buffer->nodes_processed = intersection_node_range.size();
33
 
34
@@ -1060,8 +1060,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
35
         util::UnbufferedLog log;
36
         util::Percent routing_progress(log, node_count);
37
         std::vector<EdgeWithData> delayed_data;
38
-        tbb::filter_t<EdgesPipelineBufferPtr, void> output_stage(
39
-            tbb::filter::serial_in_order, [&](auto buffer) {
40
+        auto output_stage = tbb::make_filter<EdgesPipelineBufferPtr, void>(
41
+            tbb::filter_mode::serial_in_order, [&](auto buffer) {
42
                 routing_progress.PrintAddition(buffer->nodes_processed);
43
 
44
                 m_connectivity_checksum = buffer->checksum.update_checksum(m_connectivity_checksum);
(-)www/osrm-backend/files/patch-src_extractor_extractor.cpp (+90 lines)
Line 0 Link Here
1
--- src/extractor/extractor.cpp.orig	2021-02-06 00:31:54 UTC
2
+++ src/extractor/extractor.cpp
3
@@ -44,12 +44,12 @@
4
 #include <osmium/thread/pool.hpp>
5
 #include <osmium/visitor.hpp>
6
 
7
-#if TBB_VERSION_MAJOR == 2020
8
+#if TBB_VERSION_MAJOR >= 2020
9
 #include <tbb/global_control.h>
10
 #else
11
 #include <tbb/task_scheduler_init.h>
12
 #endif
13
-#include <tbb/pipeline.h>
14
+#include <tbb/parallel_pipeline.h>
15
 
16
 #include <algorithm>
17
 #include <atomic>
18
@@ -206,7 +206,7 @@ int Extractor::run(ScriptingEnvironment &scripting_env
19
     const unsigned recommended_num_threads = std::thread::hardware_concurrency();
20
     const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads);
21
 
22
-#if TBB_VERSION_MAJOR == 2020
23
+#if TBB_VERSION_MAJOR >= 2020
24
     tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
25
                            config.requested_num_threads);
26
 #else
27
@@ -454,8 +454,8 @@ std::
28
     ExtractionRelationContainer relations;
29
 
30
     const auto buffer_reader = [](osmium::io::Reader &reader) {
31
-        return tbb::filter_t<void, SharedBuffer>(
32
-            tbb::filter::serial_in_order, [&reader](tbb::flow_control &fc) {
33
+        return tbb::make_filter<void, SharedBuffer>(
34
+            tbb::filter_mode::serial_in_order, [&reader](tbb::flow_control &fc) {
35
                 if (auto buffer = reader.read())
36
                 {
37
                     return std::make_shared<osmium::memory::Buffer>(std::move(buffer));
38
@@ -476,15 +476,15 @@ std::
39
     osmium_index_type location_cache;
40
     osmium_location_handler_type location_handler(location_cache);
41
 
42
-    tbb::filter_t<SharedBuffer, SharedBuffer> location_cacher(
43
-        tbb::filter::serial_in_order, [&location_handler](SharedBuffer buffer) {
44
+    auto location_cacher = tbb::make_filter<SharedBuffer, SharedBuffer>(
45
+        tbb::filter_mode::serial_in_order, [&location_handler](SharedBuffer buffer) {
46
             osmium::apply(buffer->begin(), buffer->end(), location_handler);
47
             return buffer;
48
         });
49
 
50
     // OSM elements Lua parser
51
-    tbb::filter_t<SharedBuffer, ParsedBuffer> buffer_transformer(
52
-        tbb::filter::parallel, [&](const SharedBuffer buffer) {
53
+    auto buffer_transformer = tbb::make_filter<SharedBuffer, ParsedBuffer>(
54
+        tbb::filter_mode::parallel, [&](const SharedBuffer buffer) {
55
             ParsedBuffer parsed_buffer;
56
             parsed_buffer.buffer = buffer;
57
             scripting_environment.ProcessElements(*buffer,
58
@@ -503,8 +503,8 @@ std::
59
     unsigned number_of_ways = 0;
60
     unsigned number_of_restrictions = 0;
61
     unsigned number_of_maneuver_overrides = 0;
62
-    tbb::filter_t<ParsedBuffer, void> buffer_storage(
63
-        tbb::filter::serial_in_order, [&](const ParsedBuffer &parsed_buffer) {
64
+    auto buffer_storage = tbb::make_filter<ParsedBuffer, void>(
65
+        tbb::filter_mode::serial_in_order, [&](const ParsedBuffer &parsed_buffer) {
66
             number_of_nodes += parsed_buffer.resulting_nodes.size();
67
             // put parsed objects thru extractor callbacks
68
             for (const auto &result : parsed_buffer.resulting_nodes)
69
@@ -530,8 +530,8 @@ std::
70
             }
71
         });
72
 
73
-    tbb::filter_t<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache(
74
-        tbb::filter::parallel, [&](const SharedBuffer buffer) {
75
+    auto buffer_relation_cache = tbb::make_filter<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>>(
76
+        tbb::filter_mode::parallel, [&](const SharedBuffer buffer) {
77
             if (!buffer)
78
                 return std::shared_ptr<ExtractionRelationContainer>{};
79
 
80
@@ -566,8 +566,8 @@ std::
81
         });
82
 
83
     unsigned number_of_relations = 0;
84
-    tbb::filter_t<std::shared_ptr<ExtractionRelationContainer>, void> buffer_storage_relation(
85
-        tbb::filter::serial_in_order,
86
+    auto buffer_storage_relation = tbb::make_filter<std::shared_ptr<ExtractionRelationContainer>, void>(
87
+        tbb::filter_mode::serial_in_order,
88
         [&](const std::shared_ptr<ExtractionRelationContainer> parsed_relations) {
89
             number_of_relations += parsed_relations->GetRelationsNum();
90
             relations.Merge(std::move(*parsed_relations));
(-)www/osrm-backend/files/patch-src_guidance_guidance__processing.cpp (+44 lines)
Line 0 Link Here
1
--- src/guidance/guidance_processing.cpp.orig	2021-02-06 01:01:50 UTC
2
+++ src/guidance/guidance_processing.cpp
3
@@ -9,7 +9,7 @@
4
 #include "util/percent.hpp"
5
 
6
 #include <tbb/blocked_range.h>
7
-#include <tbb/pipeline.h>
8
+#include <tbb/parallel_pipeline.h>
9
 
10
 #include <thread>
11
 
12
@@ -97,8 +97,8 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
13
         const constexpr unsigned GRAINSIZE = 100;
14
 
15
         // First part of the pipeline generates iterator ranges of IDs in sets of GRAINSIZE
16
-        tbb::filter_t<void, tbb::blocked_range<NodeID>> generator_stage(
17
-            tbb::filter::serial_in_order, [&](tbb::flow_control &fc) {
18
+        auto generator_stage = tbb::make_filter<void, tbb::blocked_range<NodeID>>(
19
+            tbb::filter_mode::serial_in_order, [&](tbb::flow_control &fc) {
20
                 if (current_node < node_count)
21
                 {
22
                     auto next_node = std::min(current_node + GRAINSIZE, node_count);
23
@@ -116,8 +116,8 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
24
         //
25
         // Guidance stage
26
         //
27
-        tbb::filter_t<tbb::blocked_range<NodeID>, TurnsPipelineBufferPtr> guidance_stage(
28
-            tbb::filter::parallel, [&](const tbb::blocked_range<NodeID> &intersection_node_range) {
29
+        auto guidance_stage = tbb::make_filter<tbb::blocked_range<NodeID>, TurnsPipelineBufferPtr>(
30
+            tbb::filter_mode::parallel, [&](const tbb::blocked_range<NodeID> &intersection_node_range) {
31
                 auto buffer = std::make_shared<TurnsPipelineBuffer>();
32
                 buffer->nodes_processed = intersection_node_range.size();
33
 
34
@@ -307,8 +307,8 @@ void annotateTurns(const util::NodeBasedDynamicGraph &
35
         util::Percent guidance_progress(log, node_count);
36
         std::vector<guidance::TurnData> delayed_turn_data;
37
 
38
-        tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage(
39
-            tbb::filter::serial_in_order, [&](auto buffer) {
40
+        auto guidance_output_stage = tbb::make_filter<TurnsPipelineBufferPtr, void>(
41
+            tbb::filter_mode::serial_in_order, [&](auto buffer) {
42
                 guidance_progress.PrintAddition(buffer->nodes_processed);
43
 
44
                 connectivity_checksum = buffer->checksum.update_checksum(connectivity_checksum);
(-)www/osrm-backend/files/patch-src_partitioner_partitioner.cpp (+20 lines)
Line 0 Link Here
1
--- src/partitioner/partitioner.cpp.orig	2021-02-06 02:03:55 UTC
2
+++ src/partitioner/partitioner.cpp
3
@@ -28,7 +28,7 @@
4
 #include <boost/assert.hpp>
5
 #include <boost/filesystem/operations.hpp>
6
 
7
-#if TBB_VERSION_MAJOR == 2020
8
+#if TBB_VERSION_MAJOR >= 2020
9
 #include <tbb/global_control.h>
10
 #else
11
 #include <tbb/task_scheduler_init.h>
12
@@ -74,7 +74,7 @@ auto getGraphBisection(const PartitionerConfig &config
13
 
14
 int Partitioner::Run(const PartitionerConfig &config)
15
 {
16
-#if TBB_VERSION_MAJOR == 2020
17
+#if TBB_VERSION_MAJOR >= 2020
18
     tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
19
                            config.requested_num_threads);
20
 #else
(-)www/osrm-backend/files/patch-src_partitioner_recursive__bisection.cpp (+26 lines)
Line 0 Link Here
1
--- src/partitioner/recursive_bisection.cpp.orig	2021-02-06 10:08:31 UTC
2
+++ src/partitioner/recursive_bisection.cpp
3
@@ -7,7 +7,7 @@
4
 #include "util/log.hpp"
5
 #include "util/timing_util.hpp"
6
 
7
-#include <tbb/parallel_do.h>
8
+#include <tbb/parallel_for_each.h>
9
 
10
 #include <algorithm>
11
 #include <climits> // for CHAR_BIT
12
@@ -64,12 +64,12 @@ RecursiveBisection::RecursiveBisection(BisectionGraph 
13
         return TreeNode{std::move(graph), internal_state.SCCDepth()};
14
     });
15
 
16
-    using Feeder = tbb::parallel_do_feeder<TreeNode>;
17
+    using Feeder = tbb::feeder<TreeNode>;
18
 
19
     TIMER_START(bisection);
20
 
21
     // Bisect graph into two parts. Get partition point and recurse left and right in parallel.
22
-    tbb::parallel_do(begin(forest), end(forest), [&](const TreeNode &node, Feeder &feeder) {
23
+    tbb::parallel_for_each(forest.begin(), forest.end(), [&](const TreeNode &node, Feeder &feeder) {
24
         const auto cut =
25
             computeInertialFlowCut(node.graph, num_optimizing_cuts, balance, boundary_factor);
26
         const auto center = internal_state.ApplyBisection(

Return to bug 252790