Merge pull request #5813 from woltapp/tbbdeprecation
Partially fixes use of deprecated TBB features
This commit is contained in:
@@ -5,7 +5,12 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <tbb/tbb_stddef.h> // For version lookup
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
#include <tbb/global_control.h>
|
||||
#else
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
#endif
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::contractor;
|
||||
@@ -15,7 +20,11 @@ BOOST_AUTO_TEST_SUITE(graph_contractor)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(contract_graph)
|
||||
{
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
tbb::global_control scheduler(tbb::global_control::max_allowed_parallelism, 1);
|
||||
#else
|
||||
tbb::task_scheduler_init scheduler(1);
|
||||
#endif
|
||||
/*
|
||||
* <--1--<
|
||||
* (0) >--3--> (1) >--3--> (3)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "osrm/contractor.hpp"
|
||||
#include "osrm/contractor_config.hpp"
|
||||
|
||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
||||
#include <thread>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(library_contract)
|
||||
|
||||
@@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(test_contract_with_invalid_config)
|
||||
using namespace osrm;
|
||||
|
||||
osrm::ContractorConfig config;
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
config.requested_num_threads = std::thread::hardware_concurrency();
|
||||
BOOST_CHECK_THROW(osrm::contract(config),
|
||||
std::exception); // including osrm::util::exception, etc.
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "osrm/customizer.hpp"
|
||||
#include "osrm/customizer_config.hpp"
|
||||
|
||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
||||
#include <thread>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(library_customize)
|
||||
|
||||
@@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(test_customize_with_invalid_config)
|
||||
using namespace osrm;
|
||||
|
||||
osrm::CustomizationConfig config;
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
config.requested_num_threads = std::thread::hardware_concurrency();
|
||||
BOOST_CHECK_THROW(osrm::customize(config),
|
||||
std::exception); // including osrm::util::exception, etc.
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
#include "osrm/extractor.hpp"
|
||||
#include "osrm/extractor_config.hpp"
|
||||
|
||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
||||
#include <thread>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(library_extract)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_extract_with_invalid_config)
|
||||
{
|
||||
osrm::ExtractorConfig config;
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
config.requested_num_threads = std::thread::hardware_concurrency();
|
||||
BOOST_CHECK_THROW(osrm::extract(config),
|
||||
std::exception); // including osrm::util::exception, osmium::io_error, etc.
|
||||
}
|
||||
@@ -20,7 +20,7 @@ BOOST_AUTO_TEST_CASE(test_extract_with_valid_config)
|
||||
osrm::ExtractorConfig config;
|
||||
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
|
||||
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
config.requested_num_threads = std::thread::hardware_concurrency();
|
||||
BOOST_CHECK_NO_THROW(osrm::extract(config));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "osrm/partitioner.hpp"
|
||||
#include "osrm/partitioner_config.hpp"
|
||||
|
||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
||||
#include <thread>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(library_partition)
|
||||
|
||||
@@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(test_partition_with_invalid_config)
|
||||
using namespace osrm;
|
||||
|
||||
osrm::PartitionerConfig config;
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
config.requested_num_threads = std::thread::hardware_concurrency();
|
||||
BOOST_CHECK_THROW(osrm::partition(config),
|
||||
std::exception); // including osrm::util::exception, etc.
|
||||
}
|
||||
|
||||
@@ -8,8 +8,13 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// make sure not to leak in recursive bisection
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
#include <tbb/global_control.h>
|
||||
tbb::global_control scheduler(tbb::global_control::max_allowed_parallelism, 2);
|
||||
#else
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
tbb::task_scheduler_init init(2);
|
||||
#endif
|
||||
|
||||
using namespace osrm::partitioner;
|
||||
using namespace osrm::util;
|
||||
|
||||
@@ -24,10 +24,14 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
|
||||
// explicit TBB scheduler init to register resources cleanup at exit
|
||||
#if TBB_VERSION_MAJOR == 2020
|
||||
#include <tbb/global_control.h>
|
||||
tbb::global_control scheduler(tbb::global_control::max_allowed_parallelism, 2);
|
||||
#else
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
tbb::task_scheduler_init init(2);
|
||||
#endif
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(static_rtree)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user