Move setting up task_scheduler_init from executables to library
Make entry points of individual pipeline stages responsible for configuring the task scheduler with requested number of threads passed in corresponding configuration bundle (ie. follow extractor).
This commit is contained in:
parent
2987292cc0
commit
30ed1fae99
@ -35,6 +35,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
#include <tbb/task_scheduler_init.h>
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace contractor
|
namespace contractor
|
||||||
@ -42,6 +45,9 @@ namespace contractor
|
|||||||
|
|
||||||
int Contractor::Run()
|
int Contractor::Run()
|
||||||
{
|
{
|
||||||
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
|
BOOST_ASSERT(init.is_active());
|
||||||
|
|
||||||
if (config.core_factor != 1.0)
|
if (config.core_factor != 1.0)
|
||||||
{
|
{
|
||||||
util::Log(logWARNING)
|
util::Log(logWARNING)
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
#include "util/timing_util.hpp"
|
#include "util/timing_util.hpp"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace customizer
|
namespace customizer
|
||||||
@ -115,6 +119,9 @@ std::vector<CellMetric> customizeFilteredMetrics(const MultiLevelEdgeBasedGraph
|
|||||||
|
|
||||||
int Customizer::Run(const CustomizationConfig &config)
|
int Customizer::Run(const CustomizationConfig &config)
|
||||||
{
|
{
|
||||||
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
|
BOOST_ASSERT(init.is_active());
|
||||||
|
|
||||||
TIMER_START(loading_data);
|
TIMER_START(loading_data);
|
||||||
|
|
||||||
partitioner::MultiLevelPartition mlp;
|
partitioner::MultiLevelPartition mlp;
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include "extractor/tarjan_scc.hpp"
|
#include "extractor/tarjan_scc.hpp"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
#include <boost/iterator/function_input_iterator.hpp>
|
#include <boost/iterator/function_input_iterator.hpp>
|
||||||
@ -193,6 +194,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
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 init(number_of_threads ? number_of_threads
|
||||||
: tbb::task_scheduler_init::automatic);
|
: tbb::task_scheduler_init::automatic);
|
||||||
|
BOOST_ASSERT(init.is_active());
|
||||||
|
|
||||||
guidance::LaneDescriptionMap turn_lane_map;
|
guidance::LaneDescriptionMap turn_lane_map;
|
||||||
std::vector<TurnRestriction> turn_restrictions;
|
std::vector<TurnRestriction> turn_restrictions;
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
|
||||||
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
|
||||||
#include "util/geojson_debug_logger.hpp"
|
#include "util/geojson_debug_logger.hpp"
|
||||||
#include "util/geojson_debug_policies.hpp"
|
#include "util/geojson_debug_policies.hpp"
|
||||||
#include "util/json_container.hpp"
|
#include "util/json_container.hpp"
|
||||||
@ -128,6 +130,9 @@ auto getGraphBisection(const PartitionerConfig &config)
|
|||||||
|
|
||||||
int Partitioner::Run(const PartitionerConfig &config)
|
int Partitioner::Run(const PartitionerConfig &config)
|
||||||
{
|
{
|
||||||
|
tbb::task_scheduler_init init(config.requested_num_threads);
|
||||||
|
BOOST_ASSERT(init.is_active());
|
||||||
|
|
||||||
const std::vector<BisectionID> &node_based_partition_ids = getGraphBisection(config);
|
const std::vector<BisectionID> &node_based_partition_ids = getGraphBisection(config);
|
||||||
|
|
||||||
// Up until now we worked on the compressed node based graph.
|
// Up until now we worked on the compressed node based graph.
|
||||||
|
@ -187,8 +187,6 @@ int main(int argc, char *argv[]) try
|
|||||||
util::Log() << "Input file: " << contractor_config.base_path.string() << ".osrm";
|
util::Log() << "Input file: " << contractor_config.base_path.string() << ".osrm";
|
||||||
util::Log() << "Threads: " << contractor_config.requested_num_threads;
|
util::Log() << "Threads: " << contractor_config.requested_num_threads;
|
||||||
|
|
||||||
tbb::task_scheduler_init init(contractor_config.requested_num_threads);
|
|
||||||
|
|
||||||
osrm::contract(contractor_config);
|
osrm::contract(contractor_config);
|
||||||
|
|
||||||
util::DumpSTXXLStats();
|
util::DumpSTXXLStats();
|
||||||
|
@ -166,8 +166,6 @@ int main(int argc, char *argv[]) try
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbb::task_scheduler_init init(customization_config.requested_num_threads);
|
|
||||||
|
|
||||||
auto exitcode = customizer::Customizer().Run(customization_config);
|
auto exitcode = customizer::Customizer().Run(customization_config);
|
||||||
|
|
||||||
util::DumpMemoryStats();
|
util::DumpMemoryStats();
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/assert.hpp>
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
#include <boost/range/adaptor/transformed.hpp>
|
||||||
@ -235,8 +234,6 @@ int main(int argc, char *argv[]) try
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbb::task_scheduler_init init(partition_config.requested_num_threads);
|
|
||||||
BOOST_ASSERT(init.is_active());
|
|
||||||
util::Log() << "Computing recursive bisection";
|
util::Log() << "Computing recursive bisection";
|
||||||
|
|
||||||
TIMER_START(bisect);
|
TIMER_START(bisect);
|
||||||
|
Loading…
Reference in New Issue
Block a user