Remove unused number of threads option again

This commit is contained in:
Patrick Niklaus 2017-10-16 13:17:09 +00:00 committed by Michael Krasnyk
parent dc81c7b926
commit 456b198702
5 changed files with 8 additions and 21 deletions

View File

@ -10,8 +10,6 @@
- Infrastructure:
- Lua 5.1 support is removed due to lack of support in sol2 https://github.com/ThePhD/sol2/issues/302
- Fixed pkg-config version of OSRM
- Node.js Bindings:
- Exposes `use_threads_number=Number` parameter of `EngineConfig` to limit a number of threads in a TBB internal pool
- Bugfixes:
- Fixed #4348: Some cases of sliproads pre-processing were broken
- Fixed #4331: Correctly compute left/right modifiers of forks in case the fork is curved.

View File

@ -88,7 +88,6 @@ struct EngineConfig final
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
bool use_shared_memory = true;
Algorithm algorithm = Algorithm::CH;
int use_threads_number = 1;
std::string verbosity;
};
}

View File

@ -186,7 +186,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
params->Get(Nan::New("max_locations_map_matching").ToLocalChecked());
auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked());
auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked());
auto use_threads_number = params->Get(Nan::New("use_threads_number").ToLocalChecked());
if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber())
{
@ -218,11 +217,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
Nan::ThrowError("max_alternatives must be an integral number");
return engine_config_ptr();
}
if (!use_threads_number->IsUndefined() && !use_threads_number->IsNumber())
{
Nan::ThrowError("use_threads_number must be an integral number");
return engine_config_ptr();
}
if (max_locations_trip->IsNumber())
engine_config->max_locations_trip = static_cast<int>(max_locations_trip->NumberValue());
@ -239,8 +233,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
if (max_alternatives->IsNumber())
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
if (use_threads_number->IsNumber())
engine_config->use_threads_number = static_cast<int>(use_threads_number->NumberValue());
return engine_config;
}

View File

@ -20,7 +20,7 @@ bool EngineConfig::IsValid() const
unlimited_or_more_than(max_locations_trip, 2) &&
unlimited_or_more_than(max_locations_viaroute, 2) &&
unlimited_or_more_than(max_results_nearest, 0) &&
max_alternatives >= 0 && use_threads_number >= 1;
max_alternatives >= 0;
return ((use_shared_memory && all_path_are_empty) || storage_config.IsValid()) && limits_valid;
}

View File

@ -80,7 +80,8 @@ inline unsigned generateServerProgramOptions(const int argc,
std::string &ip_address,
int &ip_port,
bool &trial,
EngineConfig &config)
EngineConfig &config,
int &requested_thread_num)
{
using boost::program_options::value;
using boost::filesystem::path;
@ -106,7 +107,7 @@ inline unsigned generateServerProgramOptions(const int argc,
value<int>(&ip_port)->default_value(5000),
"TCP/IP port") //
("threads,t",
value<int>(&config.use_threads_number)->default_value(hardware_threads),
value<int>(&requested_thread_num)->default_value(hardware_threads),
"Number of threads to use") //
("shared-memory,s",
value<bool>(&config.use_shared_memory)->implicit_value(true)->default_value(false),
@ -196,7 +197,7 @@ inline unsigned generateServerProgramOptions(const int argc,
}
// Adjust number of threads to hardware concurrency
config.use_threads_number = std::min(hardware_threads, config.use_threads_number);
requested_thread_num = std::min(hardware_threads, requested_thread_num);
std::cout << visible_options;
return INIT_OK_DO_NOT_START_ENGINE;
@ -213,8 +214,9 @@ int main(int argc, const char *argv[]) try
EngineConfig config;
boost::filesystem::path base_path;
const unsigned init_result =
generateServerProgramOptions(argc, argv, base_path, ip_address, ip_port, trial_run, config);
int requested_thread_num = 1;
const unsigned init_result = generateServerProgramOptions(
argc, argv, base_path, ip_address, ip_port, trial_run, config, requested_thread_num);
if (init_result == INIT_OK_DO_NOT_START_ENGINE)
{
return EXIT_SUCCESS;
@ -251,10 +253,6 @@ int main(int argc, const char *argv[]) try
util::Log() << "Loading from shared memory";
}
// Use the same number of threads for Server and TBB threads pools
// It doubles number of used threads
auto requested_thread_num = config.use_threads_number;
util::Log() << "Threads: " << requested_thread_num;
util::Log() << "IP address: " << ip_address;
util::Log() << "IP port: " << ip_port;