Deprecated tbb::task_scheduler_init replaced with std::thread and tbb::global_control
This commit is contained in:
parent
4d6272b030
commit
03d9e7a8ce
@ -36,7 +36,12 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
#if TBB_VERSION_MAJOR == 2020
|
||||||
|
#include <tbb/global_control.h>
|
||||||
|
#else
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace contractor
|
namespace contractor
|
||||||
@ -44,8 +49,13 @@ namespace contractor
|
|||||||
|
|
||||||
int Contractor::Run()
|
int Contractor::Run()
|
||||||
{
|
{
|
||||||
|
#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);
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
BOOST_ASSERT(init.is_active());
|
BOOST_ASSERT(init.is_active());
|
||||||
|
#endif
|
||||||
|
|
||||||
if (config.core_factor != 1.0)
|
if (config.core_factor != 1.0)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
#if TBB_VERSION_MAJOR == 2020
|
||||||
|
#include <tbb/global_control.h>
|
||||||
|
#else
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -118,8 +122,13 @@ std::vector<CellMetric> customizeFilteredMetrics(const partitioner::MultiLevelEd
|
|||||||
|
|
||||||
int Customizer::Run(const CustomizationConfig &config)
|
int Customizer::Run(const CustomizationConfig &config)
|
||||||
{
|
{
|
||||||
|
#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);
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
BOOST_ASSERT(init.is_active());
|
BOOST_ASSERT(init.is_active());
|
||||||
|
#endif
|
||||||
|
|
||||||
TIMER_START(loading_data);
|
TIMER_START(loading_data);
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <tbb/blocked_range.h>
|
#include <tbb/blocked_range.h>
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
#include <tbb/pipeline.h>
|
#include <tbb/pipeline.h>
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
@ -1080,7 +1080,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
// to be balanced with the GRAINSIZE above - ideally, the pipeline puts as much work
|
// to be balanced with the GRAINSIZE above - ideally, the pipeline puts as much work
|
||||||
// as possible in the `intersection_handler` step so that those parallel workers don't
|
// as possible in the `intersection_handler` step so that those parallel workers don't
|
||||||
// get blocked too much by the slower (io-performing) `buffer_storage`
|
// get blocked too much by the slower (io-performing) `buffer_storage`
|
||||||
tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5,
|
tbb::parallel_pipeline(std::thread::hardware_concurrency() * 5,
|
||||||
generator_stage & processor_stage & output_stage);
|
generator_stage & processor_stage & output_stage);
|
||||||
|
|
||||||
// NOTE: buffer.delayed_data and buffer.delayed_turn_data have the same index
|
// NOTE: buffer.delayed_data and buffer.delayed_turn_data have the same index
|
||||||
|
@ -55,8 +55,12 @@
|
|||||||
#include <osmium/thread/pool.hpp>
|
#include <osmium/thread/pool.hpp>
|
||||||
#include <osmium/visitor.hpp>
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <tbb/pipeline.h>
|
#if TBB_VERSION_MAJOR == 2020
|
||||||
|
#include <tbb/global_control.h>
|
||||||
|
#else
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
|
#include <tbb/pipeline.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -214,11 +218,16 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
{
|
{
|
||||||
util::LogPolicy::GetInstance().Unmute();
|
util::LogPolicy::GetInstance().Unmute();
|
||||||
|
|
||||||
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
|
const unsigned recommended_num_threads = std::thread::hardware_concurrency();
|
||||||
const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads);
|
const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads);
|
||||||
tbb::task_scheduler_init init(number_of_threads ? number_of_threads
|
|
||||||
: tbb::task_scheduler_init::automatic);
|
#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());
|
BOOST_ASSERT(init.is_active());
|
||||||
|
#endif
|
||||||
|
|
||||||
LaneDescriptionMap turn_lane_map;
|
LaneDescriptionMap turn_lane_map;
|
||||||
std::vector<TurnRestriction> turn_restrictions;
|
std::vector<TurnRestriction> turn_restrictions;
|
||||||
@ -604,7 +613,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
|||||||
|
|
||||||
// Parse OSM elements with parallel transformer
|
// Parse OSM elements with parallel transformer
|
||||||
// Number of pipeline tokens that yielded the best speedup was about 1.5 * num_cores
|
// Number of pipeline tokens that yielded the best speedup was about 1.5 * num_cores
|
||||||
const auto num_threads = tbb::task_scheduler_init::default_num_threads() * 1.5;
|
const auto num_threads = std::thread::hardware_concurrency() * 1.5;
|
||||||
const auto read_meta =
|
const auto read_meta =
|
||||||
config.use_metadata ? osmium::io::read_meta::yes : osmium::io::read_meta::no;
|
config.use_metadata ? osmium::io::read_meta::yes : osmium::io::read_meta::no;
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
#include <tbb/blocked_range.h>
|
#include <tbb/blocked_range.h>
|
||||||
#include <tbb/pipeline.h>
|
#include <tbb/pipeline.h>
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -324,7 +325,7 @@ void annotateTurns(const util::NodeBasedDynamicGraph &node_based_graph,
|
|||||||
// to be balanced with the GRAINSIZE above - ideally, the pipeline puts as much work
|
// to be balanced with the GRAINSIZE above - ideally, the pipeline puts as much work
|
||||||
// as possible in the `intersection_handler` step so that those parallel workers don't
|
// as possible in the `intersection_handler` step so that those parallel workers don't
|
||||||
// get blocked too much by the slower (io-performing) `buffer_storage`
|
// get blocked too much by the slower (io-performing) `buffer_storage`
|
||||||
tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5,
|
tbb::parallel_pipeline(std::thread::hardware_concurrency() * 5,
|
||||||
generator_stage & guidance_stage & guidance_output_stage);
|
generator_stage & guidance_stage & guidance_output_stage);
|
||||||
|
|
||||||
// NOTE: EBG edges delayed_data and turns delayed_turn_data have the same index
|
// NOTE: EBG edges delayed_data and turns delayed_turn_data have the same index
|
||||||
|
@ -28,7 +28,11 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
|
||||||
|
#if TBB_VERSION_MAJOR == 2020
|
||||||
|
#include <tbb/global_control.h>
|
||||||
|
#else
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util/geojson_debug_logger.hpp"
|
#include "util/geojson_debug_logger.hpp"
|
||||||
#include "util/geojson_debug_policies.hpp"
|
#include "util/geojson_debug_policies.hpp"
|
||||||
@ -70,8 +74,13 @@ auto getGraphBisection(const PartitionerConfig &config)
|
|||||||
|
|
||||||
int Partitioner::Run(const PartitionerConfig &config)
|
int Partitioner::Run(const PartitionerConfig &config)
|
||||||
{
|
{
|
||||||
|
#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);
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
BOOST_ASSERT(init.is_active());
|
BOOST_ASSERT(init.is_active());
|
||||||
|
#endif
|
||||||
|
|
||||||
const std::vector<BisectionID> &node_based_partition_ids = getGraphBisection(config);
|
const std::vector<BisectionID> &node_based_partition_ids = getGraphBisection(config);
|
||||||
|
|
||||||
|
@ -10,12 +10,11 @@
|
|||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/program_options/errors.hpp>
|
#include <boost/program_options/errors.hpp>
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "util/meminfo.hpp"
|
#include "util/meminfo.hpp"
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ return_code parseArguments(int argc,
|
|||||||
config_options.add_options()(
|
config_options.add_options()(
|
||||||
"threads,t",
|
"threads,t",
|
||||||
boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
|
boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
|
||||||
->default_value(tbb::task_scheduler_init::default_num_threads()),
|
->default_value(std::thread::hardware_concurrency()),
|
||||||
"Number of threads to use")(
|
"Number of threads to use")(
|
||||||
"core,k",
|
"core,k",
|
||||||
boost::program_options::value<double>(&contractor_config.core_factor)->default_value(1.0),
|
boost::program_options::value<double>(&contractor_config.core_factor)->default_value(1.0),
|
||||||
@ -171,7 +170,7 @@ int main(int argc, char *argv[]) try
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
|
const unsigned recommended_num_threads = std::thread::hardware_concurrency();
|
||||||
|
|
||||||
if (recommended_num_threads != contractor_config.requested_num_threads)
|
if (recommended_num_threads != contractor_config.requested_num_threads)
|
||||||
{
|
{
|
||||||
|
@ -5,12 +5,11 @@
|
|||||||
#include "util/meminfo.hpp"
|
#include "util/meminfo.hpp"
|
||||||
#include "util/version.hpp"
|
#include "util/version.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ return_code parseArguments(int argc,
|
|||||||
//
|
//
|
||||||
("threads,t",
|
("threads,t",
|
||||||
boost::program_options::value<unsigned int>(&customization_config.requested_num_threads)
|
boost::program_options::value<unsigned int>(&customization_config.requested_num_threads)
|
||||||
->default_value(tbb::task_scheduler_init::default_num_threads()),
|
->default_value(std::thread::hardware_concurrency()),
|
||||||
"Number of threads to use")(
|
"Number of threads to use")(
|
||||||
"segment-speed-file",
|
"segment-speed-file",
|
||||||
boost::program_options::value<std::vector<std::string>>(
|
boost::program_options::value<std::vector<std::string>>(
|
||||||
|
@ -4,14 +4,13 @@
|
|||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
#include "util/version.hpp"
|
#include "util/version.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "util/meminfo.hpp"
|
#include "util/meminfo.hpp"
|
||||||
|
|
||||||
@ -49,7 +48,7 @@ return_code parseArguments(int argc,
|
|||||||
"Data version. Leave blank to avoid. osmosis - to get timestamp from file")(
|
"Data version. Leave blank to avoid. osmosis - to get timestamp from file")(
|
||||||
"threads,t",
|
"threads,t",
|
||||||
boost::program_options::value<unsigned int>(&extractor_config.requested_num_threads)
|
boost::program_options::value<unsigned int>(&extractor_config.requested_num_threads)
|
||||||
->default_value(tbb::task_scheduler_init::default_num_threads()),
|
->default_value(std::thread::hardware_concurrency()),
|
||||||
"Number of threads to use")(
|
"Number of threads to use")(
|
||||||
"small-component-size",
|
"small-component-size",
|
||||||
boost::program_options::value<unsigned int>(&extractor_config.small_component_size)
|
boost::program_options::value<unsigned int>(&extractor_config.small_component_size)
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include "util/timing_util.hpp"
|
#include "util/timing_util.hpp"
|
||||||
#include "util/version.hpp"
|
#include "util/version.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
@ -17,6 +15,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ return_code parseArguments(int argc,
|
|||||||
//
|
//
|
||||||
("threads,t",
|
("threads,t",
|
||||||
boost::program_options::value<unsigned int>(&config.requested_num_threads)
|
boost::program_options::value<unsigned int>(&config.requested_num_threads)
|
||||||
->default_value(tbb::task_scheduler_init::default_num_threads()),
|
->default_value(std::thread::hardware_concurrency()),
|
||||||
"Number of threads to use")
|
"Number of threads to use")
|
||||||
//
|
//
|
||||||
("balance",
|
("balance",
|
||||||
|
@ -6,7 +6,12 @@
|
|||||||
#include <boost/test/test_case_template.hpp>
|
#include <boost/test/test_case_template.hpp>
|
||||||
#include <boost/test/unit_test.hpp>
|
#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>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
using namespace osrm::contractor;
|
using namespace osrm::contractor;
|
||||||
@ -16,7 +21,11 @@ BOOST_AUTO_TEST_SUITE(graph_contractor)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(contract_graph)
|
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);
|
tbb::task_scheduler_init scheduler(1);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* <--1--<
|
* <--1--<
|
||||||
* (0) >--3--> (1) >--3--> (3)
|
* (0) >--3--> (1) >--3--> (3)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "osrm/contractor.hpp"
|
#include "osrm/contractor.hpp"
|
||||||
#include "osrm/contractor_config.hpp"
|
#include "osrm/contractor_config.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
#include <thread>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(library_contract)
|
BOOST_AUTO_TEST_SUITE(library_contract)
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ BOOST_AUTO_TEST_CASE(test_contract_with_invalid_config)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
osrm::ContractorConfig config;
|
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),
|
BOOST_CHECK_THROW(osrm::contract(config),
|
||||||
std::exception); // including osrm::util::exception, etc.
|
std::exception); // including osrm::util::exception, etc.
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "osrm/customizer.hpp"
|
#include "osrm/customizer.hpp"
|
||||||
#include "osrm/customizer_config.hpp"
|
#include "osrm/customizer_config.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
#include <thread>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(library_customize)
|
BOOST_AUTO_TEST_SUITE(library_customize)
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ BOOST_AUTO_TEST_CASE(test_customize_with_invalid_config)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
osrm::CustomizationConfig config;
|
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),
|
BOOST_CHECK_THROW(osrm::customize(config),
|
||||||
std::exception); // including osrm::util::exception, etc.
|
std::exception); // including osrm::util::exception, etc.
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#include "osrm/extractor.hpp"
|
#include "osrm/extractor.hpp"
|
||||||
#include "osrm/extractor_config.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_SUITE(library_extract)
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_extract_with_invalid_config)
|
BOOST_AUTO_TEST_CASE(test_extract_with_invalid_config)
|
||||||
{
|
{
|
||||||
osrm::ExtractorConfig 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),
|
BOOST_CHECK_THROW(osrm::extract(config),
|
||||||
std::exception); // including osrm::util::exception, osmium::io_error, etc.
|
std::exception); // including osrm::util::exception, osmium::io_error, etc.
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE(test_extract_with_valid_config)
|
|||||||
osrm::ExtractorConfig config;
|
osrm::ExtractorConfig config;
|
||||||
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
|
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
|
||||||
config.UseDefaultOutputNames(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));
|
BOOST_CHECK_NO_THROW(osrm::extract(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "osrm/partitioner.hpp"
|
#include "osrm/partitioner.hpp"
|
||||||
#include "osrm/partitioner_config.hpp"
|
#include "osrm/partitioner_config.hpp"
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h> // default_num_threads
|
#include <thread>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(library_partition)
|
BOOST_AUTO_TEST_SUITE(library_partition)
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ BOOST_AUTO_TEST_CASE(test_partition_with_invalid_config)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
osrm::PartitionerConfig config;
|
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),
|
BOOST_CHECK_THROW(osrm::partition(config),
|
||||||
std::exception); // including osrm::util::exception, etc.
|
std::exception); // including osrm::util::exception, etc.
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,13 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
// make sure not to leak in recursive bisection
|
// 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>
|
#include <tbb/task_scheduler_init.h>
|
||||||
tbb::task_scheduler_init init(2);
|
tbb::task_scheduler_init init(2);
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace osrm::partitioner;
|
using namespace osrm::partitioner;
|
||||||
using namespace osrm::util;
|
using namespace osrm::util;
|
||||||
|
@ -26,10 +26,14 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <tbb/task_scheduler_init.h>
|
|
||||||
|
|
||||||
// explicit TBB scheduler init to register resources cleanup at exit
|
// 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);
|
tbb::task_scheduler_init init(2);
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(static_rtree)
|
BOOST_AUTO_TEST_SUITE(static_rtree)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user