From a790ffc2d1e89c0d9e1ee2bdf11aa3eaa7710747 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Thu, 22 Nov 2012 17:23:31 +0100 Subject: [PATCH] Fetching number of threads from extractor.ini --- extractor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extractor.cpp b/extractor.cpp index eb4e643ba..ba2815cfc 100644 --- a/extractor.cpp +++ b/extractor.cpp @@ -32,6 +32,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "Util/BaseConfiguration.h" #include "Util/InputFileUtil.h" #include "Util/MachineInfo.h" +#include "Util/StringUtil.h" typedef BaseConfiguration ExtractorConfiguration; @@ -42,6 +43,16 @@ int main (int argc, char *argv[]) { ERR("usage: \n" << argv[0] << " []"); } + unsigned numberOfThreads = omp_get_num_procs(); + if(testDataFile("extractor.ini")) { + ExtractorConfiguration extractorConfig("extractor.ini"); + unsigned rawNumber = stringToInt(extractorConfig.GetParameter("Threads")); + if( rawNumber != 0 && rawNumber <= numberOfThreads) + numberOfThreads = rawNumber; + } + omp_set_num_threads(numberOfThreads); + + INFO("extracting data from input file " << argv[1]); bool isPBF(false); std::string outputFileName(argv[1]);