fix: num-threads wasn't working since it was used before cli parsing

This commit is contained in:
Nikolaus Demmel 2021-02-22 16:38:17 +01:00
parent 7df0427753
commit e040a98b11
2 changed files with 12 additions and 12 deletions

View File

@ -137,6 +137,12 @@ int main(int argc, char** argv) {
app.add_option("--num-threads", num_threads, "Number of threads.");
app.add_option("--step-by-step", step_by_step, "Path to config file.");
try {
app.parse(argc, argv);
} catch (const CLI::ParseError& e) {
return app.exit(e);
}
// global thread limit is in effect until global_control object is destroyed
std::unique_ptr<tbb::global_control> tbb_global_control;
if (num_threads > 0) {
@ -144,12 +150,6 @@ int main(int argc, char** argv) {
tbb::global_control::max_allowed_parallelism, num_threads);
}
try {
app.parse(argc, argv);
} catch (const CLI::ParseError& e) {
return app.exit(e);
}
if (!config_path.empty()) {
vio_config.load(config_path);
} else {

View File

@ -222,6 +222,12 @@ int main(int argc, char** argv) {
"Save trajectory. Supported formats <tum, euroc, kitti>");
app.add_option("--use-imu", use_imu, "Use IMU.");
try {
app.parse(argc, argv);
} catch (const CLI::ParseError& e) {
return app.exit(e);
}
// global thread limit is in effect until global_control object is destroyed
std::unique_ptr<tbb::global_control> tbb_global_control;
if (num_threads > 0) {
@ -229,12 +235,6 @@ int main(int argc, char** argv) {
tbb::global_control::max_allowed_parallelism, num_threads);
}
try {
app.parse(argc, argv);
} catch (const CLI::ParseError& e) {
return app.exit(e);
}
if (!config_path.empty()) {
vio_config.load(config_path);