Skip to content

Commit 456b198

Browse files
TheMarexoxidase
authored andcommitted
Remove unused number of threads option again
1 parent dc81c7b commit 456b198

File tree

5 files changed

+8
-21
lines changed

5 files changed

+8
-21
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
- Infrastructure:
1111
- Lua 5.1 support is removed due to lack of support in sol2 https://github.com/ThePhD/sol2/issues/302
1212
- Fixed pkg-config version of OSRM
13-
- Node.js Bindings:
14-
- Exposes `use_threads_number=Number` parameter of `EngineConfig` to limit a number of threads in a TBB internal pool
1513
- Bugfixes:
1614
- Fixed #4348: Some cases of sliproads pre-processing were broken
1715
- Fixed #4331: Correctly compute left/right modifiers of forks in case the fork is curved.

include/engine/engine_config.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct EngineConfig final
8888
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
8989
bool use_shared_memory = true;
9090
Algorithm algorithm = Algorithm::CH;
91-
int use_threads_number = 1;
9291
std::string verbosity;
9392
};
9493
}

include/nodejs/node_osrm_support.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
186186
params->Get(Nan::New("max_locations_map_matching").ToLocalChecked());
187187
auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked());
188188
auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked());
189-
auto use_threads_number = params->Get(Nan::New("use_threads_number").ToLocalChecked());
190189

191190
if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber())
192191
{
@@ -218,11 +217,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
218217
Nan::ThrowError("max_alternatives must be an integral number");
219218
return engine_config_ptr();
220219
}
221-
if (!use_threads_number->IsUndefined() && !use_threads_number->IsNumber())
222-
{
223-
Nan::ThrowError("use_threads_number must be an integral number");
224-
return engine_config_ptr();
225-
}
226220

227221
if (max_locations_trip->IsNumber())
228222
engine_config->max_locations_trip = static_cast<int>(max_locations_trip->NumberValue());
@@ -239,8 +233,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
239233
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
240234
if (max_alternatives->IsNumber())
241235
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
242-
if (use_threads_number->IsNumber())
243-
engine_config->use_threads_number = static_cast<int>(use_threads_number->NumberValue());
244236

245237
return engine_config;
246238
}

src/engine/engine_config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool EngineConfig::IsValid() const
2020
unlimited_or_more_than(max_locations_trip, 2) &&
2121
unlimited_or_more_than(max_locations_viaroute, 2) &&
2222
unlimited_or_more_than(max_results_nearest, 0) &&
23-
max_alternatives >= 0 && use_threads_number >= 1;
23+
max_alternatives >= 0;
2424

2525
return ((use_shared_memory && all_path_are_empty) || storage_config.IsValid()) && limits_valid;
2626
}

src/tools/routed.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ inline unsigned generateServerProgramOptions(const int argc,
8080
std::string &ip_address,
8181
int &ip_port,
8282
bool &trial,
83-
EngineConfig &config)
83+
EngineConfig &config,
84+
int &requested_thread_num)
8485
{
8586
using boost::program_options::value;
8687
using boost::filesystem::path;
@@ -106,7 +107,7 @@ inline unsigned generateServerProgramOptions(const int argc,
106107
value<int>(&ip_port)->default_value(5000),
107108
"TCP/IP port") //
108109
("threads,t",
109-
value<int>(&config.use_threads_number)->default_value(hardware_threads),
110+
value<int>(&requested_thread_num)->default_value(hardware_threads),
110111
"Number of threads to use") //
111112
("shared-memory,s",
112113
value<bool>(&config.use_shared_memory)->implicit_value(true)->default_value(false),
@@ -196,7 +197,7 @@ inline unsigned generateServerProgramOptions(const int argc,
196197
}
197198

198199
// Adjust number of threads to hardware concurrency
199-
config.use_threads_number = std::min(hardware_threads, config.use_threads_number);
200+
requested_thread_num = std::min(hardware_threads, requested_thread_num);
200201

201202
std::cout << visible_options;
202203
return INIT_OK_DO_NOT_START_ENGINE;
@@ -213,8 +214,9 @@ int main(int argc, const char *argv[]) try
213214
EngineConfig config;
214215
boost::filesystem::path base_path;
215216

216-
const unsigned init_result =
217-
generateServerProgramOptions(argc, argv, base_path, ip_address, ip_port, trial_run, config);
217+
int requested_thread_num = 1;
218+
const unsigned init_result = generateServerProgramOptions(
219+
argc, argv, base_path, ip_address, ip_port, trial_run, config, requested_thread_num);
218220
if (init_result == INIT_OK_DO_NOT_START_ENGINE)
219221
{
220222
return EXIT_SUCCESS;
@@ -251,10 +253,6 @@ int main(int argc, const char *argv[]) try
251253
util::Log() << "Loading from shared memory";
252254
}
253255

254-
// Use the same number of threads for Server and TBB threads pools
255-
// It doubles number of used threads
256-
auto requested_thread_num = config.use_threads_number;
257-
258256
util::Log() << "Threads: " << requested_thread_num;
259257
util::Log() << "IP address: " << ip_address;
260258
util::Log() << "IP port: " << ip_port;

0 commit comments

Comments
 (0)