Migrate to modern TBB version (#6300)
This commit is contained in:
committed by
GitHub
parent
a98074a051
commit
91895604c9
+13
-23
@@ -43,13 +43,8 @@
|
||||
#include <osmium/io/any_input.hpp>
|
||||
#include <osmium/thread/pool.hpp>
|
||||
#include <osmium/visitor.hpp>
|
||||
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
#include <tbb/global_control.h>
|
||||
#else
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
#endif
|
||||
#include <tbb/pipeline.h>
|
||||
#include <tbb/parallel_pipeline.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@@ -206,13 +201,8 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
const unsigned recommended_num_threads = std::thread::hardware_concurrency();
|
||||
const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads);
|
||||
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
|
||||
config.requested_num_threads);
|
||||
#else
|
||||
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||
BOOST_ASSERT(init.is_active());
|
||||
#endif
|
||||
|
||||
LaneDescriptionMap turn_lane_map;
|
||||
std::vector<TurnRestriction> turn_restrictions;
|
||||
@@ -456,8 +446,8 @@ std::
|
||||
ExtractionRelationContainer relations;
|
||||
|
||||
const auto buffer_reader = [](osmium::io::Reader &reader) {
|
||||
return tbb::filter_t<void, SharedBuffer>(
|
||||
tbb::filter::serial_in_order, [&reader](tbb::flow_control &fc) {
|
||||
return tbb::filter<void, SharedBuffer>(
|
||||
tbb::filter_mode::serial_in_order, [&reader](tbb::flow_control &fc) {
|
||||
if (auto buffer = reader.read())
|
||||
{
|
||||
return std::make_shared<osmium::memory::Buffer>(std::move(buffer));
|
||||
@@ -478,15 +468,15 @@ std::
|
||||
osmium_index_type location_cache;
|
||||
osmium_location_handler_type location_handler(location_cache);
|
||||
|
||||
tbb::filter_t<SharedBuffer, SharedBuffer> location_cacher(
|
||||
tbb::filter::serial_in_order, [&location_handler](SharedBuffer buffer) {
|
||||
tbb::filter<SharedBuffer, SharedBuffer> location_cacher(
|
||||
tbb::filter_mode::serial_in_order, [&location_handler](SharedBuffer buffer) {
|
||||
osmium::apply(buffer->begin(), buffer->end(), location_handler);
|
||||
return buffer;
|
||||
});
|
||||
|
||||
// OSM elements Lua parser
|
||||
tbb::filter_t<SharedBuffer, ParsedBuffer> buffer_transformer(
|
||||
tbb::filter::parallel,
|
||||
tbb::filter<SharedBuffer, ParsedBuffer> buffer_transformer(
|
||||
tbb::filter_mode::parallel,
|
||||
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||
[&](const SharedBuffer buffer) {
|
||||
ParsedBuffer parsed_buffer;
|
||||
@@ -507,8 +497,8 @@ std::
|
||||
unsigned number_of_ways = 0;
|
||||
unsigned number_of_restrictions = 0;
|
||||
unsigned number_of_maneuver_overrides = 0;
|
||||
tbb::filter_t<ParsedBuffer, void> buffer_storage(
|
||||
tbb::filter::serial_in_order, [&](const ParsedBuffer &parsed_buffer) {
|
||||
tbb::filter<ParsedBuffer, void> buffer_storage(
|
||||
tbb::filter_mode::serial_in_order, [&](const ParsedBuffer &parsed_buffer) {
|
||||
number_of_nodes += parsed_buffer.resulting_nodes.size();
|
||||
// put parsed objects thru extractor callbacks
|
||||
for (const auto &result : parsed_buffer.resulting_nodes)
|
||||
@@ -534,8 +524,8 @@ std::
|
||||
}
|
||||
});
|
||||
|
||||
tbb::filter_t<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache(
|
||||
tbb::filter::parallel,
|
||||
tbb::filter<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache(
|
||||
tbb::filter_mode::parallel,
|
||||
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||
[&](const SharedBuffer buffer) {
|
||||
if (!buffer)
|
||||
@@ -572,8 +562,8 @@ std::
|
||||
});
|
||||
|
||||
unsigned number_of_relations = 0;
|
||||
tbb::filter_t<std::shared_ptr<ExtractionRelationContainer>, void> buffer_storage_relation(
|
||||
tbb::filter::serial_in_order,
|
||||
tbb::filter<std::shared_ptr<ExtractionRelationContainer>, void> buffer_storage_relation(
|
||||
tbb::filter_mode::serial_in_order,
|
||||
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||
[&](const std::shared_ptr<ExtractionRelationContainer> parsed_relations) {
|
||||
number_of_relations += parsed_relations->GetRelationsNum();
|
||||
|
||||
Reference in New Issue
Block a user